Recently, the Rocket Yard introduced you to one of macOS and OS X’s most powerful apps – the Terminal app. (If you missed it, you can catch up by reading Part 1 and Part 2).
While the Terminal app is quite powerful, it can also be quite confusing. And making sense of the hundreds of different terminal commands can feel like a Sisyphean task. Fortunately, there is a quick and easy way to view all of the nearly 1,500 possible commands. There’s also a simple way to find out what those esoteric phrases actually do.
Read on to find out how to view the commands. As far as putting them into use … that’s a conversation for another day.
Viewing the commands
1) Open the Terminal app which is located at /Applications/Utilities/
2) Once you’re at the bash prompt, simply hold the Escape key, or hit it two times (depending on your OS).
3) You will then be asked if you want to “Display all 1445 possibilites? (y or n).” Type “y” to see the commands. (This total may vary based on your OS version).
4.) Press Return continuously to scroll through all of the commands.
Discovering what they mean
1) With the Terminal window still open, right click on any command that you’re curious about.
2) Select “Open man Page” from the list.
3) You will then see an explanation of the command in a new window similar to the image below.
4) Repeat this process about 1,400 times and memorize the explanations to become a true Terminal command expert!
Have a favorite Terminal command? Let us know in the comments section. And for more tricks and guides, be sure to check out the Rocket Yard’s Tech Tips section.
Didn’t work in csh (my default) but did in sh.
with 10.15.2 and a touch bar, the escape command does not work for listing terminal commands
No Escape key? Hold down the Control key and hit the [ key.
ESC, Control Key [, does not work on my Touch Bar Mac.
zsh … a better shell than bash. And the license is more compatible with MacOS ;>
Excellent info !!!!
Absolutely excellent, thank you.
As an old DOS user this article made me nostalgic, totally.
Thanks
silvio
While not necessarily a Terminal command, my favorite technique is how to make a shell script double-clickable in Finder WITHOUT using automator. The key is to name the file with a “.command” file name extension and to use chmod to make the file executable (chmod +x [path to file]).
To produce a list of all the man pages in a section, say section 1, with descriptions, use the command
man -k . | grep -F ‘(1)’
The man pages are in /usr/share/man
There are 10 sections, man1 thru man9 and one more, mann
Taking you command line to the next step and putting the commands all in one text file. Note: in my Documents folder I have a folder called “_Commands”.
cd ~/Documents/_Commands
man -k . | grep -F 1 >TerminalCommandsListing.txt
man -k . | grep -F 2 >>TerminalCommandsListing.txt
man -k . | grep -F 3 >>TerminalCommandsListing.txt
man -k . | grep -F 4 >>TerminalCommandsListing.txt
man -k . | grep -F 5 >>TerminalCommandsListing.txt
man -k . | grep -F 6 >>TerminalCommandsListing.txt
man -k . | grep -F 7 >>TerminalCommandsListing.txt
man -k . | grep -F 8 >>TerminalCommandsListing.txt
man -k . | grep -F 9 >>TerminalCommandsListing.txt
man -k . | grep -F n >>TerminalCommandsListing.txt
How will i know ten process of CPU by terminal?
man top
scroll down to the example section – there an example that will give the command to show you the top 20 processes, sorted by CPU usage, updated every 10 seconds.
Top has been handy to see why my Mac is slow. [“Oh, yeah, I forgot to quit out of all three browsers.”]
hit the Escape key two times
not working for me
notice I start in tcsh, not bash
been a while since I UNIXed
so don’t remember how to change
open -a application-name
Launches a graphic-windows Mac application from Terminal.
I have Sierra, ESC ESC does nothing for me there, it should be TAB TAB to open the list of terminal commands. ESC twice in El Capitan and presumably lower works.
TAB does filename completion, which is not the same thing as described here. Close, though. Heh.
Are there specific versions or settings required for the two escape key presses to work? My terminal simply beeped at me on the second key press and nothing else happened. (Running 10.12.3 on a Mac Pro – late 2013)
Tried it again and it worked great. Didn’t work the first 3 times I tried. weird.
On OS 10.9.5, it requires hitting ESCAPE four times, presumably to escape the escapes. Escape as a verb here means to stop whatever is intercepting the chars before they get passed to the place where they invoke the action described here.
Surely you’re kidding.
My favorite command is ‘ls’ and redirecting its output to a file with ‘>’. Suppose you need a list of all .jpg images in a folder in a text file, just type ‘ls -la >images.txt’ and you are done. Of course, other increduble interesting tools are ‘cat’, ‘find’, ‘grep’ and ‘sips’ for batch image convertions, among many others
Isn’t the more common scenario that, rather than knowing the command and wondering what it does, you know what you want to do and wonder what command will do it?
Yup.
man -k searchterm
Will show all man pages that discuss searchterm.
How helpful! Keep up the fine articles in the Rocket Yard. (Loved the “repeat about 1400 times…”)
Yeah terminal don’t bash it til you try it
I don’t think it’s too much You can run everything using terminal commands . I’m not even going to use my Regular interface anymore only terminal . I’m terminally deranged for terminal.
I’m totally kidding of course but Terminal is very usefull to me thank you for the great tip
Many thanks for this – it is much needed and older folks like me (83) have a hard time to find out about such things.
Again, many thanks and please keep it up. Jim Frese
This is very cool! I dind’t know this and I”ve been doing unix on the command line longer than the Mac has :-) The ‘Open Man page’ works on any command in the terminal, too, whether or not it’s listed here or not. that alone will save me a bunch of time…
Repeat 1400 times and memorize! Ha! Good one. I liked it.
Don’t you mean the Tab key instead of escape?
This reminded me of a tool some readers will find useful – a GUI for all this stuff. Heh. And, it’s free.
rixstep.com/4/0/clix/
awk
In order for the double ESC to work, you have to be using the U.S. keyboard.