SlideShare a Scribd company logo
1 of 21
Command-line 101
GETTING TO
KNOW THE
UNIX/LINUX CLI
https://commons.wikimedia.org/wiki/File:Ken_Thompson_(sitting)_and_Dennis_Ritchie_at_PDP-11_(2876612463).jpg
Warning
http://knowyourmeme.com/memes/i-have-no-idea-what-i-m-doinghttp://nedroid.com/2012/05/honk-the-databus/
What is the Command Line?
A terminal window, is a text-only window in a graphical user interface
(GUI) that emulates a console.
A GUI is a type of human-computer interface (i.e., a system for people to
interact with a computer) that uses windows, icons, pull-down menus and a
pointer and that can be manipulated by a mouse (and usually to some extent
by a keyboard as well).
A command is an instruction telling a computer to do something, such as
launch a program.
A command line interface (CLI) is an all-text display mode that has a
command interpreter running in it and that shows commands, including their
arguments, and other data as they are typed in at the keyboard as well as
the results of most such commands.
A command interpreter, also referred to as a shell, is a program whose
primary function is to read commands that are typed into a console or
terminal window and then execute (i.e., run) them.
From the Linux Information Project (http://www.linfo.org/terminal_window.html)
Navigation
> pwd
Shows the path to the current directory.
(Where am I?)
“print working directory”
Navigation
> ls
List the contents of the current directory
Options:
• -l structured (includes permissions,
owners, access dates) long list format
• -R recursive (show subdirectories too)
• -a all (show hidden system files too)
(What’s in here?)
“list contents”
Navigation
In your terminal, try:
> ls --help
This will list all the available options with brief explanations for
each. Some might not make sense yet – don’t worry. Try a few out! Can
you figure out what the following do?
> ls -r
> ls -A
> ls –s –h –S
Useful CLI tips and tricks
If you want to… Try:
See basic help <command> --help
See the manual for a command man <command>
Exit from manual or page view q
Show last command you entered up arrow
Autocomplete filename or path tab
Kill a process CTRL + c
Jump to beginning of a command CTRL + a
Navigation
> cd <directory name>
Changes to the specified directory
(How do I get over there?)
> cd .. Up one level
> cd ../.. Up two levels (etc.)
> cd ~ Home directory
> cd Home directory
> cd - Change to last directory
“change directory”
READING, CREATING, COPYING, REMOVING, EDITING
http://www.slashfilm.com/hackers-oral-history/
Creating directories
> mkdir <name>
Makes a new directory called <name>
(How can I make a new folder?)
“make directory”
> mkdir –v Verbose – output info after
> mkdir –p Create parents as needed
Deleting directories
> rmdir <name>
Deletes directory called <name>. Directory
MUST be empty for the command to succeed.
(How can I remove an existing folder?)
“remove directory”
> rmdir –v Verbose – output info after
> rmdir –p Delete parents as well
(if also empty – if there are
files in there or other
directories it will fail)
Deleting files
> rm <filename>
Deletes file called <filename>.
(How can I remove an existing file?)
“remove”
> rm -v Verbose – output info after
> rm –i Prompt before every deletion
> rm –r
Recursive – remove subdirs and
contents below as well
> rm –f Force – ignore warnings
DANGER!
rm is a powerful
command, and you can
easily accidentally
delete a lot with the
–r and –f options…
https://steemit.com/health/@kyusho/danger-will-robinson
Copying files
> cp <file1> <file2>
Makes a copy of <file1> in location and with
name of <file2>. Example:
(How can I copy a file to another place?)
“copy”
> cp atom/LICENSE /vagrant/atom-license.txt
NOTE: if /vagrant/atom-license.txt already exists,
then it will be overwritten!
See the manual for other options
Moving files
> mv <file1> <file2>
Moves <file1> to new location <file2>. Can
rename file as part of the operation.
(How can I move a file to another place?)
“move”
NOTE: if <file2> already exists, then it will be
overwritten by the contents of <file1>
See the manual for other options
Reading files
(How can I view the contents of a file?)
> less <filename>
Show 1 page at a time. Space bar
will page through, q to quit
> cat <filename> Print whole file in terminal
> head <filename>
Display first 10 lines of
<filename>
> tail <filename> Display last 10 lines
> tail –f <filename>
Display last 10 lines and
contents as the file grows.
Useful for logs, etc.
Show current date and time > date
See a calendar of the current month > cal
See a calendar of the current year > cal -y
List users logged on to this server > who
Show your username > whoami
List users and session info > w
https://www.therefinedgeek.com.au/index.php/2012/10/02/mcpixel-oh-the-lols-you-will-have/
Clear current commands out of view > clear
Clear current commands out of view > CTRL + L
Show full history of commands in
this session
> history
copy to clipboard in the terminal > CTRL + INSERT
paste from clipboard in terminal > SHIFT + INSERT
Repeat the last command > !!
Exit current session, close terminal > exit
https://www.therefinedgeek.com.au/index.php/2012/10/02/mcpixel-oh-the-lols-you-will-have/
Resources – Cheat Sheets
• FossWire Unix/Linux Command
Reference
• GettingGeneticsDone blog
cheat sheet maintained at
Tufts University
• CheatSheetWorld Unix/Linux
cheat sheet
• LinOxide Linux cheat sheet
There are plenty more out there!
Resources – Tutorials
• LinuxCommand – Learning the Shell tutorial
• LearnPythonTheHardWay – Command Line Crash
Course
• Ryan’s Tutorials – Linux Tutorial
• Learn Enough Society – Learn Enough of the
Command Line to be Dangerous
There are plenty more out there!
Getting Started with the Command Line Interface

More Related Content

What's hot (20)

Shell programming
Shell programmingShell programming
Shell programming
 
Php Presentation
Php PresentationPhp Presentation
Php Presentation
 
Responsive web-design through bootstrap
Responsive web-design through bootstrapResponsive web-design through bootstrap
Responsive web-design through bootstrap
 
package mangement
package mangementpackage mangement
package mangement
 
Linux basic commands
Linux basic commandsLinux basic commands
Linux basic commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Introduction to xampp
Introduction to xamppIntroduction to xampp
Introduction to xampp
 
Html form tag
Html form tagHtml form tag
Html form tag
 
Quick Guide with Linux Command Line
Quick Guide with Linux Command LineQuick Guide with Linux Command Line
Quick Guide with Linux Command Line
 
Basics of-linux
Basics of-linuxBasics of-linux
Basics of-linux
 
Html5
Html5Html5
Html5
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Lesson 2 php data types
Lesson 2   php data typesLesson 2   php data types
Lesson 2 php data types
 
Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview Course 102: Lecture 1: Course Overview
Course 102: Lecture 1: Course Overview
 
Operating systems unix
Operating systems   unixOperating systems   unix
Operating systems unix
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands Course 102: Lecture 3: Basic Concepts And Commands
Course 102: Lecture 3: Basic Concepts And Commands
 
Html ppt
Html pptHtml ppt
Html ppt
 
Os ppt
Os pptOs ppt
Os ppt
 

Similar to Getting Started with the Command Line Interface

Introduction to LINUX
Introduction to LINUXIntroduction to LINUX
Introduction to LINUXAVI DHALL
 
Bash cheat sheet
Bash cheat sheetBash cheat sheet
Bash cheat sheetJogesh Rao
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to UnixSudharsan S
 
Operating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptOperating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptPDhivyabharathi2
 
Linux command-cheat-sheet
Linux command-cheat-sheetLinux command-cheat-sheet
Linux command-cheat-sheetIfshar Ahmad
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editorshanmuga rajan
 
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
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:wensheng wei
 
Unix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basiUnix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basiPriyadarshini648418
 
Linux Administration
Linux AdministrationLinux Administration
Linux AdministrationHarish1983
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administrationharirxg
 

Similar to Getting Started with the Command Line Interface (20)

Linux lecture5
Linux lecture5Linux lecture5
Linux lecture5
 
Linux cheat sheet
Linux cheat sheetLinux cheat sheet
Linux cheat sheet
 
Introduction to LINUX
Introduction to LINUXIntroduction to LINUX
Introduction to LINUX
 
Bash cheat sheet
Bash cheat sheetBash cheat sheet
Bash cheat sheet
 
Bash cheat sheet
Bash cheat sheetBash cheat sheet
Bash cheat sheet
 
Introduction to Unix
Introduction to UnixIntroduction to Unix
Introduction to Unix
 
60761 linux
60761 linux60761 linux
60761 linux
 
Operating System Laboratory presentation .ppt
Operating System Laboratory presentation .pptOperating System Laboratory presentation .ppt
Operating System Laboratory presentation .ppt
 
Linux command-cheat-sheet
Linux command-cheat-sheetLinux command-cheat-sheet
Linux command-cheat-sheet
 
basic-unix.pdf
basic-unix.pdfbasic-unix.pdf
basic-unix.pdf
 
Linux Basic commands and VI Editor
Linux Basic commands and VI EditorLinux Basic commands and VI Editor
Linux Basic commands and VI Editor
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
Linux commands
Linux commandsLinux commands
Linux commands
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
 
Linux
LinuxLinux
Linux
 
Unix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basiUnix_Introduction_BCA.pptx the very basi
Unix_Introduction_BCA.pptx the very basi
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux Administration
Linux AdministrationLinux Administration
Linux Administration
 
Linux
LinuxLinux
Linux
 
Dos commands new
Dos commands new Dos commands new
Dos commands new
 

More from Artefactual Systems - AtoM

Things I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchasThings I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchasArtefactual Systems - AtoM
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantArtefactual Systems - AtoM
 
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...Artefactual Systems - AtoM
 
Looking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and futureLooking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and futureArtefactual Systems - AtoM
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...Artefactual Systems - AtoM
 
An Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsAn Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsArtefactual Systems - AtoM
 
National Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshopNational Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshopArtefactual Systems - AtoM
 

More from Artefactual Systems - AtoM (20)

CSV import in AtoM
CSV import in AtoMCSV import in AtoM
CSV import in AtoM
 
Things I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchasThings I wish I'd known - AtoM tips, tricks, and gotchas
Things I wish I'd known - AtoM tips, tricks, and gotchas
 
AtoM Community Update: 2019-05
AtoM Community Update: 2019-05AtoM Community Update: 2019-05
AtoM Community Update: 2019-05
 
Creating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with VagrantCreating your own AtoM demo data set for re-use with Vagrant
Creating your own AtoM demo data set for re-use with Vagrant
 
Searching in AtoM
Searching in AtoMSearching in AtoM
Searching in AtoM
 
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
Building the Future Together: AtoM3, Governance, and the Sustainability of Op...
 
AtoM Implementations
AtoM ImplementationsAtoM Implementations
AtoM Implementations
 
AtoM Data Migrations
AtoM Data MigrationsAtoM Data Migrations
AtoM Data Migrations
 
Looking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and futureLooking Ahead: AtoM's governance, development, and future
Looking Ahead: AtoM's governance, development, and future
 
Contributing to the AtoM documentation
Contributing to the AtoM documentationContributing to the AtoM documentation
Contributing to the AtoM documentation
 
Installing AtoM with Ansible
Installing AtoM with AnsibleInstalling AtoM with Ansible
Installing AtoM with Ansible
 
AtoM feature development
AtoM feature developmentAtoM feature development
AtoM feature development
 
Constructing SQL queries for AtoM
Constructing SQL queries for AtoMConstructing SQL queries for AtoM
Constructing SQL queries for AtoM
 
Creating custom themes in AtoM
Creating custom themes in AtoMCreating custom themes in AtoM
Creating custom themes in AtoM
 
Installing and Upgrading AtoM
Installing and Upgrading AtoMInstalling and Upgrading AtoM
Installing and Upgrading AtoM
 
Get to Know AtoM's Codebase
Get to Know AtoM's CodebaseGet to Know AtoM's Codebase
Get to Know AtoM's Codebase
 
AtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An IntroductionAtoM's Command Line Tasks - An Introduction
AtoM's Command Line Tasks - An Introduction
 
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
AtoM and Vagrant: Installing and Configuring the AtoM Vagrant Box for Local T...
 
An Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual SystemsAn Introduction to AtoM, Archivematica, and Artefactual Systems
An Introduction to AtoM, Archivematica, and Artefactual Systems
 
National Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshopNational Archives of Norway - AtoM and Archivematica intro workshop
National Archives of Norway - AtoM and Archivematica intro workshop
 

Recently uploaded

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesZilliz
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clashcharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Vector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector DatabasesVector Databases 101 - An introduction to the world of Vector Databases
Vector Databases 101 - An introduction to the world of Vector Databases
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Powerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time ClashPowerpoint exploring the locations used in television show Time Clash
Powerpoint exploring the locations used in television show Time Clash
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 

Getting Started with the Command Line Interface

  • 1. Command-line 101 GETTING TO KNOW THE UNIX/LINUX CLI https://commons.wikimedia.org/wiki/File:Ken_Thompson_(sitting)_and_Dennis_Ritchie_at_PDP-11_(2876612463).jpg
  • 3. What is the Command Line? A terminal window, is a text-only window in a graphical user interface (GUI) that emulates a console. A GUI is a type of human-computer interface (i.e., a system for people to interact with a computer) that uses windows, icons, pull-down menus and a pointer and that can be manipulated by a mouse (and usually to some extent by a keyboard as well). A command is an instruction telling a computer to do something, such as launch a program. A command line interface (CLI) is an all-text display mode that has a command interpreter running in it and that shows commands, including their arguments, and other data as they are typed in at the keyboard as well as the results of most such commands. A command interpreter, also referred to as a shell, is a program whose primary function is to read commands that are typed into a console or terminal window and then execute (i.e., run) them. From the Linux Information Project (http://www.linfo.org/terminal_window.html)
  • 4. Navigation > pwd Shows the path to the current directory. (Where am I?) “print working directory”
  • 5. Navigation > ls List the contents of the current directory Options: • -l structured (includes permissions, owners, access dates) long list format • -R recursive (show subdirectories too) • -a all (show hidden system files too) (What’s in here?) “list contents”
  • 6. Navigation In your terminal, try: > ls --help This will list all the available options with brief explanations for each. Some might not make sense yet – don’t worry. Try a few out! Can you figure out what the following do? > ls -r > ls -A > ls –s –h –S
  • 7. Useful CLI tips and tricks If you want to… Try: See basic help <command> --help See the manual for a command man <command> Exit from manual or page view q Show last command you entered up arrow Autocomplete filename or path tab Kill a process CTRL + c Jump to beginning of a command CTRL + a
  • 8. Navigation > cd <directory name> Changes to the specified directory (How do I get over there?) > cd .. Up one level > cd ../.. Up two levels (etc.) > cd ~ Home directory > cd Home directory > cd - Change to last directory “change directory”
  • 9. READING, CREATING, COPYING, REMOVING, EDITING http://www.slashfilm.com/hackers-oral-history/
  • 10. Creating directories > mkdir <name> Makes a new directory called <name> (How can I make a new folder?) “make directory” > mkdir –v Verbose – output info after > mkdir –p Create parents as needed
  • 11. Deleting directories > rmdir <name> Deletes directory called <name>. Directory MUST be empty for the command to succeed. (How can I remove an existing folder?) “remove directory” > rmdir –v Verbose – output info after > rmdir –p Delete parents as well (if also empty – if there are files in there or other directories it will fail)
  • 12. Deleting files > rm <filename> Deletes file called <filename>. (How can I remove an existing file?) “remove” > rm -v Verbose – output info after > rm –i Prompt before every deletion > rm –r Recursive – remove subdirs and contents below as well > rm –f Force – ignore warnings
  • 13. DANGER! rm is a powerful command, and you can easily accidentally delete a lot with the –r and –f options… https://steemit.com/health/@kyusho/danger-will-robinson
  • 14. Copying files > cp <file1> <file2> Makes a copy of <file1> in location and with name of <file2>. Example: (How can I copy a file to another place?) “copy” > cp atom/LICENSE /vagrant/atom-license.txt NOTE: if /vagrant/atom-license.txt already exists, then it will be overwritten! See the manual for other options
  • 15. Moving files > mv <file1> <file2> Moves <file1> to new location <file2>. Can rename file as part of the operation. (How can I move a file to another place?) “move” NOTE: if <file2> already exists, then it will be overwritten by the contents of <file1> See the manual for other options
  • 16. Reading files (How can I view the contents of a file?) > less <filename> Show 1 page at a time. Space bar will page through, q to quit > cat <filename> Print whole file in terminal > head <filename> Display first 10 lines of <filename> > tail <filename> Display last 10 lines > tail –f <filename> Display last 10 lines and contents as the file grows. Useful for logs, etc.
  • 17. Show current date and time > date See a calendar of the current month > cal See a calendar of the current year > cal -y List users logged on to this server > who Show your username > whoami List users and session info > w https://www.therefinedgeek.com.au/index.php/2012/10/02/mcpixel-oh-the-lols-you-will-have/
  • 18. Clear current commands out of view > clear Clear current commands out of view > CTRL + L Show full history of commands in this session > history copy to clipboard in the terminal > CTRL + INSERT paste from clipboard in terminal > SHIFT + INSERT Repeat the last command > !! Exit current session, close terminal > exit https://www.therefinedgeek.com.au/index.php/2012/10/02/mcpixel-oh-the-lols-you-will-have/
  • 19. Resources – Cheat Sheets • FossWire Unix/Linux Command Reference • GettingGeneticsDone blog cheat sheet maintained at Tufts University • CheatSheetWorld Unix/Linux cheat sheet • LinOxide Linux cheat sheet There are plenty more out there!
  • 20. Resources – Tutorials • LinuxCommand – Learning the Shell tutorial • LearnPythonTheHardWay – Command Line Crash Course • Ryan’s Tutorials – Linux Tutorial • Learn Enough Society – Learn Enough of the Command Line to be Dangerous There are plenty more out there!