Mac Shell

Links

Bash scripting cheatsheet

Shell commands cheatsheet

Common

Clear Shell screen

$ clear

Shortcut: ⌘ K

Content of woring directory

$ ls

Content of specific directory

$ ls foldername

Manual for a shell command

$ man ls

quit with : Q

Navigation - change working directory

Print working Directory

$ pwd

Navigate into Folder

$ cd foldername

Navigate one level up

$ cd ..

Navigate into home directory

$ cd ~

Navigate into root directory

$ cd /

File

Create file

$ touch helloworld.txt

Rename file

$mv <old-Name> <new-Name>

Copy

copy file

$cp <file-path> <new-file-path>

copy folder

$cp <sounce-folder> <target-folder>

copy folder with whole content

$cp <sounce-folder> -r <target-folder>

Remove file/folder

🚨 take care! Files are not moved to trash. Content is deleted permanently

remove single file

$rm <file-Name>

remove empty folder

$rm <folder-Name>

remove folder with content (recursive)

$rm <folder-Name> -r