Developer’s Cheatsheet

  • Get command exit status:
echo $?
  • Search which debian package provides specific file:
sudo apt-file search <file-to-search>
  • Search which RPM package provides specific file:
yum whatprovides <file-to-search>
  • List all open files (including sockets, devices, regular files):
lsof
  • Display list of system calls made by a specific application(process)
strace <application-name>
  • Display routing table:
route
  • Display all open tcp server ports:
netstat -tlnp
  • Quickly go back to previous directory:
cd -
  • Enable IP Forwarding:
  • Method 1: Edit file and add (or comment out) line:
/etc/sysctl.conf:
net.ipv4.ip_forward = 1
  • Method 2: Till next boot
sysctl -w net.ipv4.ip_forward=1

or

echo 1 > /proc/sys/net/ipv4/ip_forward