I often need to use bash, sometimes I don’t remember using of program, here are some often helpful scripts:

  • netstat -an | grep ESTABLISHED – shows all established connections
  • ps -aux | grep nobody – displays all processes of user nobody
  • who (or better: w) – who is logged on the machine
  • nmap host – shows open ports
  • find . -name ‘*.txt’ | xargs grep java – recursively finds all ‘java’ occurrences in files with txt extension
  • grep -R java . – recursively finds all ’java’ occurrences in all type files
  • nmap -sP – shows all IP’s, that are up
  • nmblookup -A – displays name of PC in the local network
  • scp -r root@host_name:/path /myPath – remotely copying files (-r – recurcively)
  • host – displays host name
  • ping domain – displays IP number
  • smbclient -L hostname – shows Windows resources for Linux
  • wc -l file – shows number of lines in the file