The first command,
cd, says to change directory; with no other argument given, we go to our home directory. To see where we are in the file system we can do
pwd: print working directory. Also, the ~ symbol is a shorthand for the user's home directory.
The "shell" is smart and has "command-completion." For example, from my home directory I enter
cd Deand then press tab. The shell fills out "Desktop."
Another very common command is
ls: list the contents of the current directory (since there is no argument). And to see the contents of a file you might do
catwith the results shown.
Any directory may have "hidden" files whose names are prefaced by a dot `.`. These can be shown with
ls -a. There are many (many) other options with results cataloged under
The shell understands paths to files in both an absolute and relative sense. A path starting with
/is absolute, otherwise it's relative. Hence
/usr/binis a directory starting from the root of the file system, while
Desktopis only understood as a valid destination if I'm in my home directory (or some other directory with Desktop as a sub-directory).
*is a wild card and matches anything;
ls /usr/bin/pyth*lists all the entries matching pyth- + something in the given directory.
Sometimes we want to make a jump in the file system but intend to come right back.
popdare useful here, with results as shown.
As one more example of using options or arguments to a command,
cattakes the option
-n, which numbers the output lines.
calis probably faster than finding the Calendar.app, since I don't usually have it in the Dock.
Finally, to move toward the tips of the file system tree, you specify the directory at the next level so it has to be explicit, but there is only one parent, which we can reach implicitly with
cd .., meaning "go up."