Few great UNIX commands & useful links

Following are the some advanced UNIX commands which i found very useful.

DNS (Domain Name Service)
host stringPerform forward or reverse lookup on string
dig @nameserver stringLookup string's host info from nameserver
System Hardware Information
grep -i memtotal /proc/meminfoFind total amount of RAM in the system
dmidecode -qDisplay DMI/SMBIOS information
cat /proc/cpuinfoDisplay CPU information
egrep '(vmx|svm)' /proc/cpuinfoSee if a processor supports hardware virtualization
lspci -tvDisplay PCI information
lsusb -tvDisplay USB information
hdparm -i /dev/sdaDisplay disk information for sda
Quick HTML Editing Site Wide
find . -type f -print -exec sed -i -e 's|X|Y|g' {} \;Replace all X's with Y's in all files this directory and below.
perl -pi -w -e 's/X/Y/g;' *.txtReplace all X's with Y's in all files ending with *.txt
find -name '*' | xargs grep 'string'Print filename and all lines containing 'string'
SSH (Secure Shell)
scp -p -r [USER]@[HOST]:file /dirRecursively copy while preserving permissions
ssh-copy-id [USER]@[HOST]Install public key for trusted login on HOST
Troubleshooting
ps -auxfFull process list with Child Process Tree
netstat -tupList all active network connections and state
lsof -i :80Show information related to http (port 80) connections
lsof -u useridList open files by a particular userid
iftopList active network connections consuming bandwidth
iptrafMonitor IP Traffic
htopLike top, but with an h
mtrMy Traceroute - An improved traceroute
multitailTail mutiple files at the same time
siegeA http/web stress test utility
Samba / Windows File Sharing
smbtreeScan local network for windows shares
Isolate DoS (Denial of Service) Attacks with netstat
netstat -an | grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
netstat -anp | grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
netstat -ntu | grep -v TIME_WAIT | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -nr
Bit Torrent Clients
rtorrentBit Torrent Client
aria2Bit Torrent Client



Other Links:
http://members.unine.ch/philippe.renard/unix2.html
http://www.indiastudychannel.com/resources/121854-Advanced-Unix-Commands.aspx



Comments