Interview Questions: Linux/Unix

One thing I have neglected to study are the not-to-often used commands of Linux and Unix.  In an effort to make sure I never forget them, I’ll keep a list of the few that I have been asked about:

  • lsof – lists all of the files currently open in the operating system.
  • echo $SHELL – displays which shell you are currently using.
  • uname – displays which operating system you are running.  By itself it doesn’t tell you much, but uname -a tells you everything about the computer you are logged into.
  • find vs grep – use grep to find stuff in files, use find to find files by file name.  Specifically: find . -name filename -print looks for files matching the filename string.  You can use * for wildcard, eg: *brian* to look for any files containing brian (case sensative).