Jesus Vigo curates a list of entry-level operational commands aimed at understanding and using Terminal.
Terminal, or the command line interface (CLI), is considered by many to be the Holy Grail of computer management. At one time the CLI was the only way to accomplish anything on a computer; then, the CLI gave way to the graphical user interface (GUI) as the popularity of PCs increased. The purists among us often prefer to use the CLI as a means of manipulating the computer and getting it to perform tasks instead of using a mouse to get things done.
So who's right?
There's no right or wrong per se — only convenience. As the GUI has changed the way we work, many people still use the command line for its ability to control nodes, automate tasks, and even configure features that are only accessible through the CLI.
I try to learn as much about the CLI for any particular OS I manage in an effort to work smarter, not harder and also to learn multiple ways of accomplishing the same tasks. After all, the more you know, the better you'll be at your job. With this in mind, I present these basic Terminal commands to introduce some of the Terminal's features and to provide a working understanding of the app.
1. Change Directory
What it does: Changes the directory of the command line path.
Example: cd "path/to/directory/" (Figure A)
2. Listing Directory
What it does: Lists the contents of a directory.
Example: ls "path/to/directory/" (Figure B)
3. Open files
What it does: Opens a file.
Example: open "filename" (Figure C)
4. Copy a file to another directory
Example: cp "filename" "newfilename" (Figure D)
5. Move a file
Example: mv "filename" "path/to/new/file/location" (Figure E)
6. Renaming a file
Example: mv "path/to/filename" "path/to/newfilename" (Figure F)
7. Create a directory
Example: mkdir "path/to/new/directory" (Figure G)
8. Remove an empty directory
Example: rmdir "path/to/directory" (Figure H)
9. Remove nested directories
Command: rm -R
Example: rm -R "/path/to/root/directory" (Figure I)
10. Execute commands with superuser privileges
Example: sudo "command" (Figure J)
11. List actively running computer processes
Example: top (Figure K)
12. Quit sub-screen and return to Terminal
Example: After executing a command, such as "top" to view active processes, press "q" to exit. (Figure L)
13. Clear the Terminal screen of all previous commands
Example: clear (Figure M)
14. Get help for a command
Example: help "command" (Figure N)
15. Get one-line description for a command
Example: whatis "command" (Figure O)
16. Show manual page for a command
Example: man "command" (Figure P)
The "exit" command
A special note goes out to the "exit" command, which closes the Terminal session.
Example: exit (Figure Q)
What are your go-to Terminal commands?
While this article is more focused at those new to OS X or perhaps coming from another OS such as Windows, I hope that even experienced users will be able to reinforce their knowledge base.
What Terminal commands do you use most often? What Terminal commands would you add to this list? We'd love to hear from you!