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
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
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
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
How to use a program
Conventions help discovery
ProgramName -f flagValue input
ProgramName --flag flagValue input
Files, Files & More Files
Things you can do with
* 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
* Press up on D-Pad to get last command
* Ctrl + R <- search over history of previous commands
* sudo !! <- Rerun last command as Sudo
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
ne an alias
Run alias to see all aliases currently load in the shell
Profiles + Custom Configuration
Change this, and source it (or restart your terminal)
Cool stuff I use
* fzf <- Fuzzy finder
* oh-my-zsh <- Lots of additions to zsh + plugin support (I use git + fzf
* jenv, pyenv, rvm, nvm <- Language managers
* tmux <- Terminal multiplexer
* rg <- Ripgrep, much faster that grep
Slides from a talk I gave in work about using the command line. Geared towards iOS developer using macOS