SlideShare a Scribd company logo
Command Line
From zero to hero.
Using the command line on macOS
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
.

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
How to use a program
Conventions help discovery
ProgramName -f flagValue input


ProgramName --flag flagValue input
Unix + File Systems
Everything is a
fi
le
Using the command line on macOS
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
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
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
Copy & Paste
pbcopy < file.txt


pbpaste > file.txt
pbpaste >> file.txt
Overwrite
Append
Symlinks
* ln ~/some_folder/some_file <- hard link a file

* ln -s ~/some_folder/some_file <- soft link a file
Backgrounding Processes
* Ctrl+Z <- background current process.

* fg <- re-focus process.
De
fi
ne an alias
Run alias to see all aliases currently load in the shell
Profiles + Custom Configuration
~/.zshrc
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
plugins)

* jenv, pyenv, rvm, nvm <- Language managers

* tmux <- Terminal multiplexer

* rg <- Ripgrep, much faster that grep

More Related Content

DOCX
Basic linux commands
PDF
Basic linux commands for bioinformatics
PDF
Basic Linux commands
PPTX
Linux basic commands
PPT
Anandha ganesh linux1.ppt
PPT
Common linux ubuntu commands overview
PDF
Linux basic commands with examples
PDF
Basic linux commands
Basic linux commands
Basic linux commands for bioinformatics
Basic Linux commands
Linux basic commands
Anandha ganesh linux1.ppt
Common linux ubuntu commands overview
Linux basic commands with examples
Basic linux commands

What's hot (19)

PPT
Linux commands
PDF
Top 10 Random Linux/Ubuntu Commands
PDF
Basic linux commands
PDF
Linux command line
PPTX
Linux basics
PDF
3.1.a linux commands reference
PPTX
Linux command for beginners
PDF
Linux cheat-sheet
PPT
Basic command ppt
PDF
One Page Linux Manual
PDF
Module 02 Using Linux Command Shell
PDF
Linux cheat sheet
PPT
Linux Commands
PPTX
Basic linux bash
PDF
[PDF] 2021 Termux basic commands list
PPTX
Basic unix commands
PPTX
Compression
PDF
Unix Command-Line Cheat Sheet BTI2014
PDF
Unix for Librarians
Linux commands
Top 10 Random Linux/Ubuntu Commands
Basic linux commands
Linux command line
Linux basics
3.1.a linux commands reference
Linux command for beginners
Linux cheat-sheet
Basic command ppt
One Page Linux Manual
Module 02 Using Linux Command Shell
Linux cheat sheet
Linux Commands
Basic linux bash
[PDF] 2021 Termux basic commands list
Basic unix commands
Compression
Unix Command-Line Cheat Sheet BTI2014
Unix for Librarians
Ad

Similar to Using the command line on macOS (20)

PDF
Unleash your inner console cowboy
PDF
Unleash your inner console cowboy
PPTX
linux system administration for system admin jobs
PDF
Unleash your inner console cowboy
PPT
PDF
Commands
PDF
Basic shell commands by Jeremy Sanders
PPTX
Linux Shell Basics
ODP
Nguyễn Vũ Hưng: Basic Linux Power Tools
PDF
Lecture1 2 intro-unix
PDF
Complete Guide for Linux shell programming
PDF
Quick guide of the most common linux commands
PPT
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
PPT
PowerPoint_merge.ppt on unix programming
ODP
Linux introduction-commands2338
ODP
Linux introduction-commands2338
ODP
Linux Introduction (Commands)
PDF
Information about linux operating system
PPT
Karkha unix shell scritping
PDF
Tips and Tricks for Increased Development Efficiency
Unleash your inner console cowboy
Unleash your inner console cowboy
linux system administration for system admin jobs
Unleash your inner console cowboy
Commands
Basic shell commands by Jeremy Sanders
Linux Shell Basics
Nguyễn Vũ Hưng: Basic Linux Power Tools
Lecture1 2 intro-unix
Complete Guide for Linux shell programming
Quick guide of the most common linux commands
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
PowerPoint_merge.ppt on unix programming
Linux introduction-commands2338
Linux introduction-commands2338
Linux Introduction (Commands)
Information about linux operating system
Karkha unix shell scritping
Tips and Tricks for Increased Development Efficiency
Ad

Recently uploaded (20)

PDF
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
KodekX | Application Modernization Development
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Advanced IT Governance
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
cuic standard and advanced reporting.pdf
PDF
Approach and Philosophy of On baking technology
PDF
Electronic commerce courselecture one. Pdf
PPT
Teaching material agriculture food technology
PDF
Spectral efficient network and resource selection model in 5G networks
solutions_manual_-_materials___processing_in_manufacturing__demargo_.pdf
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
NewMind AI Monthly Chronicles - July 2025
Diabetes mellitus diagnosis method based random forest with bat algorithm
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Advanced methodologies resolving dimensionality complications for autism neur...
Unlocking AI with Model Context Protocol (MCP)
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
KodekX | Application Modernization Development
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Advanced IT Governance
GamePlan Trading System Review: Professional Trader's Honest Take
Review of recent advances in non-invasive hemoglobin estimation
cuic standard and advanced reporting.pdf
Approach and Philosophy of On baking technology
Electronic commerce courselecture one. Pdf
Teaching material agriculture food technology
Spectral efficient network and resource selection model in 5G networks

Using the command line on macOS

  • 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
  • 7. Unix + File Systems Everything is a fi le
  • 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
  • 12. Copy & Paste pbcopy < file.txt pbpaste > file.txt pbpaste >> file.txt Overwrite Append
  • 13. Symlinks * ln ~/some_folder/some_file <- hard link a file * ln -s ~/some_folder/some_file <- soft link a file
  • 14. Backgrounding Processes * Ctrl+Z <- background current process. * fg <- re-focus process.
  • 15. De fi ne an alias Run alias to see all aliases currently load in the shell
  • 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