Alex Kaloostian

Apple Certified Master Trainer | Systems Integrator | Video Editor | Motion Graphics Artist

Command Line Basics 7 – review time

Leave a comment

Nothing new today, I just wanted to post a little handy reference for all the things we’ve covered so far.

Remember, some commands can simply be typed into the Terminal followed by a return, and they will run:

uptime

but some commands will stay running until you quit them with the q key:

top

Some commands can be enhanced with one or more Options. Options come after a hyphen, like so:

ls
ls -l
ls -lahG
top
top -u
top -s5

And some commands need a target, so they know where you want to go. Targets come after the command, WITHOUT a hyphen:

ls /Applications
ls ~
cd /System
man ls
man uptime
man man

Finally, putting it all together, we can type a command, followed by a space, a hyphen and multiple options, followed by another space, and a target.

ls -lah /Applications
man -h ls

Remember this simple example:

command -options target

Remember to place a backslash before a space, like so:

cd Important\ stuff

You can auto-complete a long name with the tab key

You can auto-type a whole path by dragging-and-dropping a file or folder into the Terminal window

You can scroll back through your whole history with the up and down arrow keys

Here’s a list of all the commands we’ve covered so far:

uptime - display time your Mac has been running
top - display running processes
man - read the instruction manual for any command
ls - list contents of a folder
cd - change directory
pwd - print working directory (show where you are).
less - read a text file in the command line 
q - quit
control-c - cancel, interrupt
control-l - clear screen

And here are all the lessons so far:
Lesson 1 – The Terminal
Lesson 2 – Command options
Lesson 3 – Man pages
Lesson 4 – Targets
Lesson 5 – Paths
Lesson 6 – Time savers

Advertisements

Author: alexkaloostian

I'm a video editor, motion graphics designer and Mac IT consultant in the Boston area.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s