UNIX: Working with directories
Directories are often also called folders.
Changing directories
The cd command changes directories.
Examples
- Change to a directory named dir
- cd dir
- Change to the parent directory
- cd ..
- Change to your home directory
- cd
Present directory
To find out the name of the directory you're currently in, use the command pwd.
Creating a directory
Use the command mkdir to make a new directory. For example, use mkdir dir to make a directory called dir.
Deleting a directory
Use the command rmdir to delete a new directory. For example, use rmdir dir to delete a directory called dir.
A directory won't be deleted unless it is empty.