Skip to content

Instantly share code, notes, and snippets.

@abFunctions
Forked from yomolify/terminal-cheatsheet.md
Created October 9, 2020 03:41
Show Gist options
  • Save abFunctions/b12f6c170243df8dbbe3eb43947ce818 to your computer and use it in GitHub Desktop.
Save abFunctions/b12f6c170243df8dbbe3eb43947ce818 to your computer and use it in GitHub Desktop.
Terminal Cheatsheet

Lines starting with $ are terminal commands

View current directory

  • $ pwd
  • eg output: /Users/winnie06

List all files and folders in current directory

  • $ ls
  • $ ls -la (for listing all files including hidden files)

Change Directory

  • 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 directory in finder

  • Open current directory in finder

  • $ open .

  • Open specified path in finder (similar to cd /path/to/directory)

  • $ open /path/to/directory

Text editor Emacs

  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment