3. 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
4. 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
5. 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
6. How to use a program
Conventions help discovery
ProgramName -f flagValue input
ProgramName --flag flagValue input
9. 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
10. 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
11. 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
16. Profiles + Custom Configuration
~/.zshrc
Change this, and source it (or restart your terminal)
17. 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