Successfully reported this slideshow.
Your SlideShare is downloading. ×

Using the command line on macOS

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Upcoming SlideShare
Basic linux commands
Basic linux commands
Loading in …3
×

Check these out next

1 of 17 Ad
Advertisement

More Related Content

Similar to Using the command line on macOS (20)

Advertisement

Recently uploaded (20)

Using the command line on macOS

  1. 1. Command Line From zero to hero.
  2. 2. What is a shell? Look, a shell! —> * Unix pioneered shells. * Shells are computer programs [Bash, ZSH, Fish, etc] * You can talk to your OS by issuing commands to the shell, in a command line interface / terminal. * You can change your default shell using chsh
  3. 3. Which shell does macOS use? Did you just say GPL? * macOS used to use a very old version of bash, the most popular and well known shell. * Newest versions of Bash use GPL3 License. Shipping this with macOS would mean Apple would need to publish source code for their programs, which sounds like it would empower the user. * macOS now uses zsh
  4. 4. So what programs can you run? Anything that is in PATH If you run echo $PATH you can see places where programs are loaded from for your current shell session . Traditionally: /usr/bi n Modern: /usr/local/bin (<— This is where home-brew puts its programs ) You can run apropos and a search term to find programs that match your term, i.e apropos text editing
  5. 5. How to use a program Conventions help discovery ProgramName -f flagValue input ProgramName --flag flagValue input
  6. 6. Unix + File Systems Everything is a fi le
  7. 7. Files, Files & More Files Things you can do with fi les * ls <- List files * ls -la <- List files including hidden files (start with a .) * file my_file.txt <- Describe file * pwd <- Where am I in the filesystem? * cd aDirectory/ <- change directory to aDirectory * cd ~ <- change directory to home * rm aFile ~ <- Remove a file * rm -rf aDirectory/ ~ <- Remove a directory
  8. 8. History Re-running commands * Press up on D-Pad to get last command * Ctrl + R <- search over history of previous commands . * sudo !! <- Rerun last command as Sudo
  9. 9. Pipes Take output from one command, use it in another cat file.txt | grep “a string I think is in this file” cat file.txt | wc -l
  10. 10. Copy & Paste pbcopy < file.txt pbpaste > file.txt pbpaste >> file.txt Overwrite Append
  11. 11. Symlinks * ln ~/some_folder/some_file <- hard link a file * ln -s ~/some_folder/some_file <- soft link a file
  12. 12. Backgrounding Processes * Ctrl+Z <- background current process. * fg <- re-focus process.
  13. 13. De fi ne an alias Run alias to see all aliases currently load in the shell
  14. 14. Profiles + Custom Configuration ~/.zshrc Change this, and source it (or restart your terminal)
  15. 15. Cool stuff I use * fzf <- Fuzzy finder * oh-my-zsh <- Lots of additions to zsh + plugin support (I use git + fzf plugins) * jenv, pyenv, rvm, nvm <- Language managers * tmux <- Terminal multiplexer * rg <- Ripgrep, much faster that grep

×