16 Terminal commands every user should know
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.
SEE: 20 Terminal shortcuts developers need to know
1. Change Directory
Command: cd
What it does: Changes the directory of the command line path.
Example: cd “path/to/directory/” (Figure A)
Figure A
2. Listing Directory
Command: ls
What it does: Lists the contents of a directory.
Example: ls “path/to/directory/” (Figure B)
Figure B
3. Open files
Command: open
What it does: Opens a file.
Example: open “filename” (Figure C)
Figure C
4. Copy a file to another directory
Command: cp
Example: cp “filename” “newfilename” (Figure D)
Figure D
5. Move a file
Command: mv
Example: mv “filename” “path/to/new/file/location” (Figure E)
Figure E
6. Renaming a file
Command: mv
Example: mv “path/to/filename” “path/to/newfilename” (Figure F)
Figure F
7. Create a directory
Command: mkdir
Example: mkdir “path/to/new/directory” (Figure G)
Figure G
8. Remove an empty directory
Command: rmdir
Example: rmdir “path/to/directory” (Figure H)
Figure H
9. Remove nested directories
Command: rm -R
Example: rm -R “/path/to/root/directory” (Figure I)
Figure I
10. Execute commands with superuser privileges
Command: sudo
Example: sudo “command” (Figure J)
Figure J
11. List actively running computer processes
Command: top
Example: top (Figure K)
Figure K
12. Quit sub-screen and return to Terminal
Command: q
Example: After executing a command, such as “top” to view active processes, press “q” to exit. (Figure L)
Figure L
13. Clear the Terminal screen of all previous commands
Command: Clear
Example: clear (Figure M)
Figure M
14. Get help for a command
Command: help
Example: help “command” (Figure N)
Figure N
15. Get one-line description for a command
Command: whatis
Example: whatis “command” (Figure O)
Figure O
16. Show manual page for a command
Command: man
Example: man “command” (Figure P)
Figure P
The “exit” command
A special note goes out to the “exit” command, which closes the Terminal session.
Command: exit
Example: exit (Figure Q)
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!
Also see
For all the latest Technology News Click Here
For the latest news and updates, follow us on Google News.