Bash and the Command Line 5 lessons
  1. 1 Getting your bearings
  2. 2 Files, and the commands that change them sign in to open
  3. 3 Pipes, redirection and the Unix idea sign in to open
  4. 4 Writing a script sign in to open
  5. 5 Working on a server sign in to open
Course overview
Data: video · change

This lesson: 122KB

Bash and the Command Line · Lesson 1 of 5

Getting your bearings

Move around a machine without a mouse.

The terminal is not a test of memory. It is six commands you use constantly and a way of looking the rest up.

Where am I, what is here, go there. pwd prints the current directory. ls lists what is in it, and ls with the long and all flags shows permissions, sizes, dates and hidden files, which is what you usually want. cd changes directory. Three shortcuts save most of the typing: a single dot is here, two dots is the parent, and a tilde is your home directory. cd with nothing goes home.

Absolute and relative paths. A path starting with a slash is from the root of the filesystem and means the same thing from anywhere. Anything else is relative to where you are standing. Most confusion in the first week is standing somewhere other than you think, which pwd settles instantly.

Tab completion is the whole skill. Type the first few letters and press Tab. It completes, and pressing it twice shows the options. People who find the terminal slow are usually typing full paths by hand. Nobody does that.

History. The up arrow walks back through what you ran. Ctrl+R searches it, which is how you find the long command you ran last Tuesday.

Reading the manual. man followed by a command, or the command with a help flag, is faster than searching the web for the flag you half remember.

Finally, learn Ctrl+C to stop a running command and q to leave a pager. Being stuck inside something with no exit is what makes beginners nervous.

Lab — try it yourself

With no mouse, move to a project folder, list everything including hidden files, and return home using a shortcut. Use Tab for every path.

Check what you learned

Create your free BvLogic ID to take the quiz and record your score.

Create your BvLogic ID
Continue to lesson 2 Up next 2. Files, and the commands that change them