• Run the last command as root user.
sudo !!
  • Serve current directory tree at http://127.0.0.1:4444 (Listens on all interfaces)
python3 -m http.server 4444
  • Get your external internet facing IP
curl ifconfig.me
  • Mount a temporary RAM partition
mount -t tmpfs tmpfs /mnt -o size=1024m
  • List all lisening ports together with the PID of the associated process
sudo lsof -Pan -i tcp -i udp
  • List all listening ports
sudo lsof -Pni4 | grep LISTEN
  • SSH network throuput test
yes | pv | ssh $host "cat > /dev/null"
  • Print line numbers of terminal output
$command | nl
  • Bind a key with a command
bind '"\C-l":"ls -l"'
  • Push file over SSH
scp [local_file] [user]@[host]:[remote_file]
  • Pull file over SSH
scp [remote_file] [user]@[host]:.
  • Mount .iso file
mount /path/to/file.iso /mnt/cdrom -oloop
  • List all open files used by process/command
lsof -c [command]
  • Sniff network traffic on a given interface (eth0) and display IP addresses of the machines communicating with the current host
sudo tcpdump -i eth0 -n ip | awk '{ print gensub(/(.*)\..*/,"\\1","g",$3), $4, gensub(/(.*)\..*/,"\\1","g",$5) }' | awk -F " > " '{print $1""$2}'
  • Look up a word in the dictonary
curl dict://dict.org/d:somthing
  • Clone the apt pkgs installed on another Debian based system.
sudo install apt-get install `ssh root@host_you_want_to_clone "dpkg -l | grep ii" | awk '{print $2}'`
  • List the /usr/bin folder with explanations on what the pkgs are.
ls /usr/bin | xargs whatis | less
  • Generate random string 30 characters long
gpg --gen-random --armor 1 30
  • OpenSSL MD5 CPU test
openssl speed md5
  • Man page explaining linux file system hierarchy
man hier
  • Create a html page listing computers hardware
sudo lshw -html > hardware.html