21 essential OS X command line tools

21 essential OS X command line tools

Underneath the graphical user interface (GUI) of OS X lies a powerful command line interface and its army of utilities. These tools are task oriented programs that was the sole interface to computer before the age of GUI. Most of what you do with OS X can be deal within GUI programs, but command line still offers the most power and flexibility for certain tasks. 

Proficiency in using command line tools is critical for IT professional such as administrator and developer. For the rest of us, a good grasp of basic command line utilities is in the realm of power users, that improves your understanding on how OS X works, and will pay dividends when it comes to automating tasks with your Mac.

There are hundreds of command line utilities. We will be going in depth in future posts on command line tool usage. For now, we highlight with brief overview 21 essential ones. To use any of these tools, you need to run them under command line interface. OS X comes with the Terminal app (Applications > Utilities > Terminal) for command line interface.

cd  – Change Directory. Change the current working directory.

ls List. List the content of current directory.

pwd Print Working Directory. Display the current working directory. Useful when you’ve lost track of where you are in current terminal session.

mkdirMake Directory. Create a new directory.

rmdirRemove Directory. Remove a directory.

cpCopy. Copy files or directories to a new location.

mvMove. Move files or directories to a new location. Commonly use to rename files or directories.

rmRemove. Remove files or directories.

ps – Process Status. Display information about the processes running in your Mac.

history – Display the history log of the command lines that you’ve entered.

man – Manual. This will display the man (manual) page of command. For example “man ls” will display the man page for ls command with its description, command line switches and usage examples.

whoamiWho Am I. Display the user name.

uptime – Report how long the system has been running since last reboot.

kill – Terminate a specified running process.

exit – Exits out of running program or ends a command line session.

find – Searches for files at specified directory that matches a set of condition. Useful for quickly finding certain files.

grep – Search through input files, return lines that matches a string pattern. 

sudo – Runs a program as super user that has no permissions limitation.

dfDisplay free disk space. Display the disk usage info of the file system.

ping – Check if an Internet host is reachable. Probably the first tool you use to troubleshoot a network issue.

wget – Download URL file and resource from the Internet.