# Directories in UNIX :::{note} If you're one of those people who's only used a {abbr}`GUI (Graphical User Interface)`, or you save all of your files on your Desktop, this sub-section is for you. There are plenty of [web sites](https://www.tutorialspoint.com/unix/unix-directories.htm) that discuss directories; this is just a brief overview. ::: The "folders" that you see when you look at your GUI are actually directories in your operating system. That tells you what a directory is: a container for other files, including other directories. The separator for directory names is "/", so `a/b/c` is directory `c` within directory `b` within directory `a`.[^f4] [^f4]: Now you know why it's hard to put a / in a folder name: The operating system can't tell the difference between a / that's within a folder name versus a / that is a directory separator. Everything in UNIX is within a directory. Yes, even your Desktop; typically, that is a directory whose name is `~/Desktop`. That leads us to common abbreviations and commands for directories when you're using the command line: - `~` means the home directory of the user \[^f5]. Just plain `~` means your own home directory. So `~/Desktop` means a directory named Desktop within your home directory. [^f5]: It's always something like "~seligman" (tilde-seligman), never "--seligman" (dash-seligman). Depending on the exact font used to print or display this tutorial, sometimes tildes look like dashes. On most keyboards, tilde is typed with SHIFT-\` where \` (backtick) is near the upper-left-hand corner of the keyboard. - `cd` is the command to "change directory." It's the usual way to go from one directory to another. If there were a directory named `Root`[^f6] in your home directory, you could visit that directory with: > cd ~/Root [^f6]: UNIX is normally a case-sensitive operating system. `~/Root`, `~/ROOT`, and `~/root` are three *different* directories. Exception: In Mac OS Darwin, by default file names are *case-insensitive*; all three of those directories would be the same. - `..` is a reference to your parent directory, the one "above" the one you're currently in. If you wanted to return to your home directory from `~/Root`, you could type: > cd .. If you use the `cd` command without any arguments, it will return you to your home directory:[^f7] > cd [^f7]: Knowing this will become useful in the future, as you become more sophisticated in your use of UNIX. Eventually you'll learn about shell variables. Sooner or later, you'll make a typo in a variable name; e.g., > cd $ROTSYS Instead of going to `$ROOTSYS`, your intended destination, you'll find yourself in your home directory. That's because `$ROTSYS` doesn't have a value, so UNIX interpreted this as the `cd` command without any arguments. - To look at the contents of your current directory, use the `ls` command: > ls You can also list the contents of any other directory (for which you have permission to view): > ls ~seligman/root-class - If you forget which directory you're in, use the `pwd` ("print working directory") command: > pwd :::{figure-md} porn_folder-fig :class: align-center xkcd porn_folder by Randall Munroe. Moral: Be careful how you organize your directories! :::