Lines starting with $ are terminal commands
$ pwd
- eg output: /Users/winnie06
$ ls
$ ls -la
(for listing all files including hidden files)
-
Go up one directory level
-
$ cd ..
-
Change directory to home directory (/Users/winnie06)
-
$ cd ~
-
Change directory to specific path. eg no matter whichever directory you are currently in, in the terminal, if you run
$ cd /Users/winnie06/Downloads/
, you'll change the directory to Downloads -
$ cd /path/to/directory
-
Open current directory in finder
-
$ open .
-
Open specified path in finder (similar to cd /path/to/directory)
-
$ open /path/to/directory
- Open specified file or create it if it doesn't exist, eg. try
$ emacs blog.html
and then$ ls
$ emacs /path/to/file
- Once in emacs, save file by pressing Control + X and then Control + S
- Once in emacs, exit to terminal by pressing Control + X and then Control + C
Comprehensive terminal reference: https://github.com/0nn0/terminal-mac-cheatsheet