Manage files and folders
- cd - change directory
- ls - list the content of a directory
- pwd - parent working dir
- mkdir - create a new directory
- rm - Remove files and folders
- cp - Copy files and folders
- mv - Move files and folders
- ditto - Move files and folders (advanced)
Acess and permission to files/folders
mkdir
Syntax: mkdir [-Options] <directory>
Usage/Result: Create a new directory/folder
Options:
| -m | Add permissions for the new directory |
| -p | Create a tree of folders at once, for example: /my/new/path |
| -v | Verbose: Outputs the name of the new directories as they are being created. |
Examples
| mkdir temp | Creates a new directory called temp. |
| mkdir /usr/local/myfolder | Create a new directory called myfolder at the given path (/usr/local/). |
| mkdir dir1 dir2 "A new dir" | Create three new directories in the current working dir. The third directory name needs quote's since it has spaces. |
| mkdir -p /dir1/dir2/dir3 | Create a tree of directories all at once: dir2 will become a subfolder of dir1 and so on. Note the "-p" which is necessary to be able to create a chain of directories. |
Quick tip:
Sometimes you might not be able to perform a certain command or task from the Terminal.
This might be because you don't have the right permission to do so.
When that happens you can try to add the word "sudo" in the beginning of the line.
Sudo is an abbreviation of superuser do and means that you want to execute the following command as a user with extended permissions, most often as an Administrator.
When using "sudo" you sometimes need to enter the password of the root account.
Learn more about sudo.