
Terminal - Commands using uniq - 172 results
sed -e "s/| /\n/g" ~/.bash_history | cut -d ' ' -f 1 | sort | uniq -c | sort -nr | head
This is sample output - yours may be different.
"some line input" | sort | uniq -c | sort -nr
This is sample output - yours may be different.
sed 's/[ \t]*$//' < emails.txt | tr 'A-Z' 'a-z' | sort | uniq > emails_sorted.txt
This is sample output - yours may be different.
lsof | awk '{print $1}' | sort | uniq -c | sort -rn | head
This is sample output - yours may be different.
sten@fenris:~$ sudo lsof | awk '{print $1}' | sort | uniq -c | sort -rn | head
3002 php5-cgi
122 master
116 sshd
115 freeswitc
82 mysqld
60 ssh
60 slapd
52 lighttpd
47 beam.smp
43 inet_geth
I think I could cut down the number of pipes here, any suggestions?
netstat -alpn | grep :80 | awk '{print $4}' |awk -F: '{print $(NF-1)}' |sort |
uniq -c | sort -n
This is sample output - yours may be different.
1 127.0.0.1
8 192.168.1.147
21 192.168.1.146
Useful to check DDoS attacks on servers.
last | grep -v "^$" | awk '{ print $1 }' | sort -nr | uniq -c
This is sample output - yours may be different.
1 wtmp
2 reboot
31 oracle
15 jsmith
142 jdoe
3 root
This command takes the output of the 'last' command, removes empty lines, gets just the first field ($USERNAME), sort the $USERNAMES in reverse order and then gives a summary count of unique matches.
history | awk '{print $2}' | sort | uniq -c | sort -rn | head
This is sample output - yours may be different.
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n | tail
This is sample output - yours may be different.
[root@vps10 root]# netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n | tail
8 200.217.193.102
8 82.101.189.139
9 84.195.188.60
11 189.63.98.3
11 60.28.166.169
13 24.227.166.150
15 200.214.44.134
16 189.92.141.77
22 189.14.101.44
31 127.0.0.1
This command does a tally of concurrent active connections from single IPs and prints out those IPs that have the most active concurrent connections. VERY useful in determining the source of a DoS or DDoS attack.
netstat -anl | grep :80 | awk '{print $5}' | cut -d ":" -f 1 | uniq -c | sort -n | grep -c IPHERE
This is sample output - yours may be different.
This will tell you who has the most Apache connections by IP (replace IPHERE with the actual IP you wish to check). Or if you wish, remove | grep -c IPHERE for the full list.
netstat -pant 2> /dev/null | grep SYN_ | awk '{print $5;}' | cut -d: -f1 | sort | uniq -c | sort -n | tail -20
This is sample output - yours may be different.
1 125.162.92.184
1 125.164.121.250
1 125.71.93.177
1 128.107.229.110
1 189.147.101.11
1 202.40.210.145
1 202.40.210.164
1 203.130.201.198
1 41.201.190.148
1 41.201.238.148
1 81.199.44.161
1 81.202.11.253
2 202.134.71.158
7 218.4.59.190
List top 20 IP from which TCP connection is in SYN_RECV state.
Useful on web servers to detect a syn flood attack.
Replace SYN_ with ESTA to find established connections
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.
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.
# 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.
netstat -ant | awk '{print $NF}' | grep -v '[a-z]' | sort | uniq -c
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.
alias counts=sort | uniq -c | sort -nr
This is sample output - yours may be different.
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.
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.
find . -name "*\.php" | xargs grep -o --color "\w\+::\w\+" | cut -d":" -f2 | sort | uniq -c
This is sample output - yours may be different.
Searches all .php files for a static instantiation of a class and displays the class names along with their frequencies.