
Terminal - Commands using sort - 526 results
netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | sed s/::ffff:// | cut -d: -f1 | sort | uniq -c | sort -n
This is sample output - yours may be different.
14 111.111.111.111
28 123.123.123.123
34 0.0.0.0
usefull in case of abuser/DoS attacks.
find -printf '%u %g\n' | sort | uniq
This is sample output - yours may be different.
apache apache
root root
user1 apache
find -printf '%u\n' | sort | uniq #just users
find -printf '%g\n' | sort | uniq #just groups
history | awk '{a[$2]++}END{for(i in a){print a[i] " " i}}' | sort -rn | head
This is sample output - yours may be different.
sort -n -t . -k 1,1 -k 2,2 -k 3,3 -k 4,4 /file/of/ip/addresses
This is sample output - yours may be different.
find / -xdev -size +1024 -exec ls -al {} \; | sort -r -k 5
This is sample output - yours may be different.
ls -la | awk '{print $5, " " ,$9}' | sort -rn
This is sample output - yours may be different.
last | awk '{ print $1 }' | sort | uniq -c | grep -v wtmp
This is sample output - yours may be different.
sed -e 's/ *$//' ~/.bash_history | sort | uniq -cd | sort -nr | head
This is sample output - yours may be different.
kill -HUP ` ps -aef | grep -i firefox | sort -k 2 -r | sed 1d | awk ' { print $2 } ' `
This is sample output - yours may be different.
Imaging a Firefox window disappearing :-)
(It kills the hanging firefox process.)
# cut -d ' ' -f1 /var/log/nginx/nginx-access.log | sort | uniq -c | sort -nr | head -10 | nl
This is sample output - yours may be different.
perl -pe 's/.+;//' ~/.zsh_history | sort | uniq -c | sort -r|head -10
This is sample output - yours may be different.
3940 ls
1427 sudo emerge -vpuDN world
1084 top
684 tail /var/log/samba/log.smbd -n 50
601 sudo emerge --sync
573 sudo emerge --depclean
566 ls -alh
561 df -ah
523 cd
430 sudo revdep-rebuild
cd ~/.purple/logs/; egrep -ri "i can haz|pwn|l33t|w00|zomg" * | cut -d'/' -f 3 | sort | uniq | xargs -I {} echo "Note to self: ban user '{}'"
This is sample output - yours may be different.
Note to self, ban user 'aoluser'
Note to self, ban user 'msnuser'
Greps IRC logs for phrases and lists users who said them.
find $PWD -exec rpm --query -f {} \; | sort -u | grep -v "not owned"
This is sample output - yours may be different.
shows all RPMs with files in the current directory & its subdirectories.
netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c
This is sample output - yours may be different.
echo "SHOW PROCESSLIST\G" | mysql -u root -p | grep "Info:" | awk -F":" '{count[$NF]++}END{for(i in count){printf("%d: %s\n", count[i], i)}}' | sort -n
This is sample output - yours may be different.
sudo lsof | awk '{printf("%s %s %s\n", $1, $3, $NF)}' | grep -v "(" | sort -k 4 | gawk '$NF==prv{ct++;next} {printf("%d %s\n",ct,$0);ct=1;prv=$NF}' | uniq | sort -nr
This is sample output - yours may be different.
for i in $(locate your_search_phrase); do dirname $i; done | sort | uniq
This is sample output - yours may be different.
Ever use 'locate' to find a common phrase in a filename or directory name? Often you'll get a huge list of matches, many of which are redundant, and typically the results are not sorted. This command will 'locate' your search phrase, then show you a sorted list of just the relevant directories, with no duplications. So, for example, maybe you have installed several versions of the java jre and you want to track down every directory where files matching "java" might exist. Well, a 'locate java' is likely to return a huge list with many repeated directories since many files in one directory could contain the phrase "java". This command will whittle down the results to a minimal list of unique directory names where your search phrase finds a match.
tar -tvjf backup.tar.bz2 | sort -nrk 3 | head
This is sample output - yours may be different.
This is sample output - yours may be different.
alias counts=sort | uniq -c | sort -nr
This is sample output - yours may be different.
diff <(sort file1) <(sort file2)
This is sample output - yours may be different.
bash/ksh subshell redirection (as file descriptors) used as input to diff
grep -o "\(new \(\w\+\)\|\w\+::\)" file.php | sed 's/new \|:://' | sort | uniq -c | sort
This is sample output - yours may be different.
1 parent
1 product_Item
1 promotion_Base
1 swc_Response
2 product_ViewHelper
2 product_ViewTransformer
4 promotion_Tab
5 site_Template
6 self
This grabs all lines that make an instantation or static call, then filters out the cruft and displays a summary of each class called and the frequency.
du | sort -gr > file_sizes
This is sample output - yours may be different.
712 .
328 ./test
176 ./lib
144 ./doc
100 ./test/data
96 ./lib/rake
64 ./doc/release_notes
Recursively searches current directory and outputs sorted list of each directory's disk usage to a text file.
tail -10000 access_log | awk '{print $1}' | sort | uniq -c | sort -n | tail
This is sample output - yours may be different.
This uses awk to grab the IP address from each request and then sorts and summarises the top 10.
ps aux | sort -nk +4 | tail
This is sample output - yours may be different.
david 13257 0.1 1.8 80788 38736 ? Sl 15:31 0:09 evince file:///tmp/phparch-xdebug-qa.pdf
david 6755 0.3 2.1 87732 44272 ? Sl 08:58 1:31 /usr/bin/cli /usr/lib/gnome-do/Do.exe
david 6757 0.0 2.1 98872 44632 ? Sl 08:58 0:23 /usr/bin/python /usr/local/bin/gwibber
david 15191 0.1 2.3 91580 48308 ? Sl 12:28 0:32 pidgin
david 30577 1.2 3.1 189016 64768 ? Sl 10:06 5:14 /usr/lib/firefox-3.0.5/firefox -P FireFTP -no-remote
root 6225 8.6 3.6 86648 76024 tty7 Ss+ 08:57 42:25 /usr/X11R6/bin/X :0 -br -audit 0 -auth /var/lib/gdm/:0.Xauth -nolisten tcp vt7
david 8050 2.6 4.2 227412 86964 ? Sl 09:01 13:04 epiphany-browser
david 9465 0.2 5.3 155852 110272 ? S 09:05 1:13 /usr/lib/opera/9.27-20080331.6/opera
david 10836 3.5 8.2 302092 170212 ? Sl 15:24 3:48 /usr/lib/firefox-3.0.5/firefox -P default -no-remote
david 27109 9.7 22.0 760784 454376 ? Sl 09:56 42:16 /home/david/programs/pdt/eclipse/eclipse
ps returns all running processes which are then sorted by the 4th field in numerical order and the top 10 are sent to STDOUT.