SlideShare ist ein Scribd-Unternehmen logo
1 von 17
Downloaden Sie, um offline zu lesen
Command Line
From zero to hero.
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
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

Weitere ähnliche Inhalte

Was ist angesagt?

Linux commands
Linux commandsLinux commands
Linux commandsU.P Police
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsYusuf Felly
 
3.1.a linux commands reference
3.1.a linux commands reference3.1.a linux commands reference
3.1.a linux commands referenceAcácio Oliveira
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginnersSuKyeong Jang
 
Basic command ppt
Basic command pptBasic command ppt
Basic command pptRohit Kumar
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manualdummy
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command ShellTushar B Kute
 
Basic linux bash
Basic linux bashBasic linux bash
Basic linux bash皓鈞 張
 
[PDF] 2021 Termux basic commands list
[PDF] 2021 Termux basic commands list [PDF] 2021 Termux basic commands list
[PDF] 2021 Termux basic commands list nisivaasdfghj
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commandsswtjerin4u
 
Compression
CompressionCompression
Compressionaswathyu
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Noé Fernández-Pozo
 

Was ist angesagt? (19)

Linux commands
Linux commandsLinux commands
Linux commands
 
Top 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu CommandsTop 10 Random Linux/Ubuntu Commands
Top 10 Random Linux/Ubuntu Commands
 
Basic linux commands
Basic linux commandsBasic linux commands
Basic linux commands
 
Linux command line
Linux command lineLinux command line
Linux command line
 
Linux basics
Linux basicsLinux basics
Linux basics
 
3.1.a linux commands reference
3.1.a linux commands reference3.1.a linux commands reference
3.1.a linux commands reference
 
Linux command for beginners
Linux command for beginnersLinux command for beginners
Linux command for beginners
 
Linux cheat-sheet
Linux cheat-sheetLinux cheat-sheet
Linux cheat-sheet
 
Basic command ppt
Basic command pptBasic command ppt
Basic command ppt
 
One Page Linux Manual
One Page Linux ManualOne Page Linux Manual
One Page Linux Manual
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Linux cheat sheet
Linux cheat sheetLinux cheat sheet
Linux cheat sheet
 
Linux Commands
Linux CommandsLinux Commands
Linux Commands
 
Basic linux bash
Basic linux bashBasic linux bash
Basic linux bash
 
[PDF] 2021 Termux basic commands list
[PDF] 2021 Termux basic commands list [PDF] 2021 Termux basic commands list
[PDF] 2021 Termux basic commands list
 
Basic unix commands
Basic unix commandsBasic unix commands
Basic unix commands
 
Compression
CompressionCompression
Compression
 
Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014Unix Command-Line Cheat Sheet BTI2014
Unix Command-Line Cheat Sheet BTI2014
 
Unix for Librarians
Unix for LibrariansUnix for Librarians
Unix for Librarians
 

Ähnlich wie Using the command line on macOS

Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologistAjay Murali
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to LinuxDimas Prasetyo
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line ToolsDavid Harris
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.pptKiranMantri
 
Using Unix
Using UnixUsing Unix
Using UnixDr.Ravi
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Wave Digitech
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Tushar B Kute
 
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 

Ähnlich wie Using the command line on macOS (20)

Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologist
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformaticsBITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
 
Directories description
Directories descriptionDirectories description
Directories description
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Unix Basics For Testers
Unix Basics For TestersUnix Basics For Testers
Unix Basics For Testers
 
linux cmds.pptx
linux cmds.pptxlinux cmds.pptx
linux cmds.pptx
 
Examples -partII
Examples -partIIExamples -partII
Examples -partII
 
Command Line Tools
Command Line ToolsCommand Line Tools
Command Line Tools
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
50 most frequently used unix
50 most frequently used unix50 most frequently used unix
50 most frequently used unix
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
 
Using Unix
Using UnixUsing Unix
Using Unix
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
Linux
LinuxLinux
Linux
 
Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013Unix Linux Commands Presentation 2013
Unix Linux Commands Presentation 2013
 
Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.Module 3 Using Linux Softwares.
Module 3 Using Linux Softwares.
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 

Kürzlich hochgeladen

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Kürzlich hochgeladen (20)

Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Using the command line on macOS

  • 2.
  • 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
  • 8.
  • 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