An Introduction to Command-Line Unix Tools

September 01, 2016 | 2 Minute Read

I’m relatively new to Unix tools, and when I began, I was frustrated because I felt like the only way I knew how to find new tools was to ask people with more experience. The goal of this post is to provide some starting places if you’d like to learn more about what you can do on the command line, but it’s not intended to be an exhaustive list.

  1. apropos - I’m listing this one first because hopefully it will help you find others! Searches your man pages for the keyword(s) you pass into it. Ex: apropos networking will search for man pages that include the word “networking.”
  2. curl - get data over a network, via basically any protocol you can think of. It has a LOT of flags and can do oodles of stuff. I once made a joke about how I’d be back in six hours after hunting through the curl docs to find the flag I needed. The joke was on me; it really did take me that long to read the entire man page. Ex: curl -v will give you the HTTP response (including headers) for a GET to Alternative (Linux only): wget.
  3. netstat - show network connections. Ex: netstat -tunapl (example is Linux only).
  4. ps - list currently-running processes. Ex: ps aux will list all processes for all users, including the percentages of CPU and memory being used. Alternative: pstree is a Linux-only tool that will show you a graph of all parent/children process relationships.
  5. top - live view of current processes, including things like CPU percentage.
  6. strace (Linux only) - trace system calls. Alternative for Mac OSX: dtrace. I’m not going to explain this one too much because Julia Evans wrote a great zine on it. If you’re not sure what system calls are, Julia’s zine explains that too!
  7. /proc (Linux only) - a virtual directory that keeps track of information related to currently running processes. Once you have a process’s PID, you can go to /proc/<PID> to find a variety of info. Ex: /proc/<PID>/fd is a directory listing all of the file descriptors (files being touched) for the given process, and /proc/<PID>/environ is a file listing a process’s environment.

Further Reading

The TLDR Pages project has simplified explanations of the content of some man pages.

If you’re looking for something more exhaustive, the Linux man-pages project might help.

Netflix has a great post on “Linux Performance Analysis in 60 Seconds” with a list of Unix tools useful for troubleshooting performance issues.