Chapter 2: Directories and files

Where am I?

face Robert Craven Josiah Wang

Recall that the terminal prompt shows the name of your working directory.

username@MACHINE:~$ 

Currently, this is ~ (a special name for your home directory).

We can use the command pwd to give the full name of the working directory. Type the following.

username@MACHINE:~$ pwd
/homes/username

So: ~ is just a shorthand for this /homes/username, given that you are username.

Exercise 2

Try the following commands, one at a time (replace username by your college username).

  • ls ~
  • ls /homes/username
  • ls

Explain to yourself the relationship between the results of these three commands.