I'm using tcpdump to dump, debug and monitor traffic on a network. However, there is lots of noise and I would like to exclude ssh from my dumps. How do I monitor all traffic except my ssh session?
The tcpdump command displays out the headers of packets on a network interface that match the boolean expression. In other words you can use boolean expression to drop ssh traffic from dumping and monitoring operation using the following syntax:
tcpdump -i eth1 -s 1500 port not 22
You can skip additional ports too:
tcpdump -i eth1 -s 1500 port not 22 and port not 53
You can also use ip or hostname:
tcpdump -i eth1 port not 22 and host 1.2.3.4
See also:
man tcpdump
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop













{ 5 comments… read them below or add one }
There are unmatched ‘pre’ tags in the first example.
And btw, please switch sides of text and banners if possible. :\
Thanks for the heads up and sorry for the mixup. I’ve fixed css issue :)
It’s also possible to use the service names in /etc/services, like
# tcpdump -i eth0 “port not ssh”
a little more automatic… =)
tcpdump -i eth0 port not 22 and host not `echo $SSH_CLIENT | awk ‘{print $1}’`
pretty darn useful stuff. kiu.