SlideShare ist ein Scribd-Unternehmen logo
1 von 18
BASIC LINUX COMMANDS
What the ~*&?!
~ “tilde” indicates your home directory: /home/you
* “star”: wildcard, matches anything
? wildcard, matches any one character
! History substitution, do not use
& run a job in the background, or redirect errors
#% special characters for most crystallography programs
`([“’ back-quote, backslash, etc. special to shell
_ underscore, use this instead of spaces!!!
Where am I?
Print name of the “current working directory”
This is the default directory/folder where the shell program will
look first for programs, files, etc. It is “where you are” in Unix
space.
pwd
What is a directory?
Directories are places you put files. They are
represented as words connected by the “/”
character. On Windows, they use a “”, just to be
different. On Mac, they are called “folders”.
Whatever you do…
DO NOT PUT SPACES
In directory/file names!
/home/yourname/whatever
What have we here?
List contents of the current working directory
ls –l - long listing, with dates, owners, etc.
ls –lrt - above, but sorted by time
ls –lrt /home/yourname/something
- long-list a different directory
ls
Go somewhere else?
Change the current working directory
cd /tmp/yourname/
- go to your temporary directory
cd - - go back to where you just were
cd - no arguments, go back “home”
“home” is where your login starts
cd
A new beginning…
Create a new directory.
mkdir ./something - make it
cd ./something - go there
ls - check its is empty
mkdir
How do I get help?
Display the manual for a given program
man ls - see manual for the “ls” command
man tcsh - learn about the C shell
man bash - learn about that other shell
man man - read the manual for the manual
to return to the command prompt, type “q”
man
Move it!
Move or rename a file. If you think about it, these are the same thing.
mv stupidname.txt bettername.txt
- change name
mv stupidplace/file.txt ../betterplace/file.txt
- same name, different directory
mv stupidname_*.img bettername_*.img
Will not work! Never ever do this!
mv
Copy machine
Copy a file. This is just like “mv”
except it does not delete the original.
cp stupidname.txt bettername.txt
- change name, keep original
rm stupidname.txt
- now this is the same as “mv”
cp
“Permission denied” !?
Change the “permission” of a file.
chmod a+r filename.txt
- make it so everyone can read it
chmod u+rwx filename.txt
- make it you can read/write/execute it
chmod –R u+rw /some/random/place
- make it so you can read/write everything under
a directory
chmod
Destroy! Destroy!
Remove a file forever. There is no “trash” or “undelete” in unix.
rm unwanted_file.txt
- delete file with that name
rm –f /tmp/yourname/*
- forcefully remove everything in your
temporary directory.
Will not prompt for confirmation!
rm
less is more
Display the contents of a text file, page by page
more filename.txt - display contents
less filename.txt - many installs now have a
replacement for “more” called “less” which has nicer search
features.
to return to the command prompt, type “q”
more
After the download…
File compression and decompression
gunzip ~/Downloads/whatever.tar.gz
- decompress
gzip ~/Downloads/whatever.tar
- compress, creates file with .gz extension
gunzip
Where the %$#& is it?
Search through directories, find files
find ./ -name ’important*.txt’
- look at everything under current working directory
with name starting with “important” and ending in “.txt”
find / -name ’important*.txt’
- will always find it, but take a very long time!
find
Did I run out of disk space?
Check how much space is left on disks
df - look at space left on all disks
df . - look at space left in the current working directory
du –sk . | sort –g
- add up space taken up by all files and
subdirectories, list biggest hog last
df du
Why so slow?
Look for programs that may be eating up CPU or memory.
top - list processes in order of CPU usage
jobs - list jobs running in background of current terminal
ps –fHu yourname
- list jobs belonging to your account in order of what
spawned what
ps top
Die Die Die!
Stop jobs that are running in the background
kill %1 - kill job [1], as listed in “jobs”
kill 1234 - kill job listed as 1234 by “ps” or “top”
kill -9 1234 - that was not a suggestion!
kill -9 -g 1234 – seriously kill that job and the
program that launched it
kill

Weitere ähnliche Inhalte

Ähnlich wie Linux Commands.pptx

Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologistAjay Murali
 
OS Lab Manual.pdf
OS Lab Manual.pdfOS Lab Manual.pdf
OS Lab Manual.pdfQucHunh15
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsBITS
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOSAdamFallon4
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to LinuxDimas Prasetyo
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdfharikrishnapolaki
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.pptKiranMantri
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdfCesleySCruz
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overviewAmeer Sameer
 
Linux presentation
Linux presentationLinux presentation
Linux presentationNikhil Jain
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2Gourav Varma
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unixsouthees
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic CommandsHanan Nmr
 
Treebeard's Unix Cheat Sheet
Treebeard's Unix Cheat SheetTreebeard's Unix Cheat Sheet
Treebeard's Unix Cheat Sheetwensheng wei
 

Ähnlich wie Linux Commands.pptx (20)

Linux basic for CADD biologist
Linux basic for CADD biologistLinux basic for CADD biologist
Linux basic for CADD biologist
 
Operating system lab manual
Operating system lab manualOperating system lab manual
Operating system lab manual
 
OS Lab Manual.pdf
OS Lab Manual.pdfOS Lab Manual.pdf
OS Lab Manual.pdf
 
The structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformaticsThe structure of Linux - Introduction to Linux for bioinformatics
The structure of Linux - Introduction to Linux for bioinformatics
 
Using the command line on macOS
Using the command line on macOSUsing the command line on macOS
Using the command line on macOS
 
MCLS 45 Lab Manual
MCLS 45 Lab ManualMCLS 45 Lab Manual
MCLS 45 Lab Manual
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Shell Scripting crash course.pdf
Shell Scripting crash course.pdfShell Scripting crash course.pdf
Shell Scripting crash course.pdf
 
Shell_Scripting.ppt
Shell_Scripting.pptShell_Scripting.ppt
Shell_Scripting.ppt
 
Linux shell scripting
Linux shell scriptingLinux shell scripting
Linux shell scripting
 
linux cmds.pptx
linux cmds.pptxlinux cmds.pptx
linux cmds.pptx
 
Introduction to the linux command line.pdf
Introduction to the linux command line.pdfIntroduction to the linux command line.pdf
Introduction to the linux command line.pdf
 
Common linux ubuntu commands overview
Common linux  ubuntu commands overviewCommon linux  ubuntu commands overview
Common linux ubuntu commands overview
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Introduction to linux2
Introduction to linux2Introduction to linux2
Introduction to linux2
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Linux Basic Commands
Linux Basic CommandsLinux Basic Commands
Linux Basic Commands
 
Introduction to linux day1
Introduction to linux day1Introduction to linux day1
Introduction to linux day1
 
Treebeard's Unix Cheat Sheet
Treebeard's Unix Cheat SheetTreebeard's Unix Cheat Sheet
Treebeard's Unix Cheat Sheet
 

Kürzlich hochgeladen

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991RKavithamani
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxRoyAbrique
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Kürzlich hochgeladen (20)

Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
Industrial Policy - 1948, 1956, 1973, 1977, 1980, 1991
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptxContemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Linux Commands.pptx

  • 2. What the ~*&?! ~ “tilde” indicates your home directory: /home/you * “star”: wildcard, matches anything ? wildcard, matches any one character ! History substitution, do not use & run a job in the background, or redirect errors #% special characters for most crystallography programs `([“’ back-quote, backslash, etc. special to shell _ underscore, use this instead of spaces!!!
  • 3. Where am I? Print name of the “current working directory” This is the default directory/folder where the shell program will look first for programs, files, etc. It is “where you are” in Unix space. pwd
  • 4. What is a directory? Directories are places you put files. They are represented as words connected by the “/” character. On Windows, they use a “”, just to be different. On Mac, they are called “folders”. Whatever you do… DO NOT PUT SPACES In directory/file names! /home/yourname/whatever
  • 5. What have we here? List contents of the current working directory ls –l - long listing, with dates, owners, etc. ls –lrt - above, but sorted by time ls –lrt /home/yourname/something - long-list a different directory ls
  • 6. Go somewhere else? Change the current working directory cd /tmp/yourname/ - go to your temporary directory cd - - go back to where you just were cd - no arguments, go back “home” “home” is where your login starts cd
  • 7. A new beginning… Create a new directory. mkdir ./something - make it cd ./something - go there ls - check its is empty mkdir
  • 8. How do I get help? Display the manual for a given program man ls - see manual for the “ls” command man tcsh - learn about the C shell man bash - learn about that other shell man man - read the manual for the manual to return to the command prompt, type “q” man
  • 9. Move it! Move or rename a file. If you think about it, these are the same thing. mv stupidname.txt bettername.txt - change name mv stupidplace/file.txt ../betterplace/file.txt - same name, different directory mv stupidname_*.img bettername_*.img Will not work! Never ever do this! mv
  • 10. Copy machine Copy a file. This is just like “mv” except it does not delete the original. cp stupidname.txt bettername.txt - change name, keep original rm stupidname.txt - now this is the same as “mv” cp
  • 11. “Permission denied” !? Change the “permission” of a file. chmod a+r filename.txt - make it so everyone can read it chmod u+rwx filename.txt - make it you can read/write/execute it chmod –R u+rw /some/random/place - make it so you can read/write everything under a directory chmod
  • 12. Destroy! Destroy! Remove a file forever. There is no “trash” or “undelete” in unix. rm unwanted_file.txt - delete file with that name rm –f /tmp/yourname/* - forcefully remove everything in your temporary directory. Will not prompt for confirmation! rm
  • 13. less is more Display the contents of a text file, page by page more filename.txt - display contents less filename.txt - many installs now have a replacement for “more” called “less” which has nicer search features. to return to the command prompt, type “q” more
  • 14. After the download… File compression and decompression gunzip ~/Downloads/whatever.tar.gz - decompress gzip ~/Downloads/whatever.tar - compress, creates file with .gz extension gunzip
  • 15. Where the %$#& is it? Search through directories, find files find ./ -name ’important*.txt’ - look at everything under current working directory with name starting with “important” and ending in “.txt” find / -name ’important*.txt’ - will always find it, but take a very long time! find
  • 16. Did I run out of disk space? Check how much space is left on disks df - look at space left on all disks df . - look at space left in the current working directory du –sk . | sort –g - add up space taken up by all files and subdirectories, list biggest hog last df du
  • 17. Why so slow? Look for programs that may be eating up CPU or memory. top - list processes in order of CPU usage jobs - list jobs running in background of current terminal ps –fHu yourname - list jobs belonging to your account in order of what spawned what ps top
  • 18. Die Die Die! Stop jobs that are running in the background kill %1 - kill job [1], as listed in “jobs” kill 1234 - kill job listed as 1234 by “ps” or “top” kill -9 1234 - that was not a suggestion! kill -9 -g 1234 – seriously kill that job and the program that launched it kill