Linux Commands - Commands I use a lot

From ZENworks Ninja
Jump to: navigation, search
Search all subdirectories and files for string1 and replace with string2
Linux:> grep -R /etc/opt/novell | xargs sed -i s/string1/string2/g
{{{3}}}
Show Established and Listening Connections
Linux:> netstat -nap | awk '/tcp/ {print $6}'| sort | uniq -c
1 ESTABLISHED 7 LISTEN 11 TIME_WAIT


Packet capture with the current time
Linux:> tcpdump -vvvs 1024 -l -A host 172.16.1.1 -w /var/log/trace-$HOSTNAME-`date +%Y-%m-%d_%H%M%S`.cap
14 packets received by filter


Determine LDAP certificate Dates
Linux:> echo | openssl s_client -connect site:port 2>/dev/null | openssl x509 -noout -dates
notBefore=Sep 29 17:18:00 2014 GMT notAfter=Mar 16 05:53:00 2019 GMT