SlideShare una empresa de Scribd logo
1 de 26
Descargar para leer sin conexión
Linux
Basic Commands
Y.Shashidhar
shashi@cse.iitb.ac.in
Basic Linux Commands
• File Handling
• Text Processing
• System Administration
• Process Management
• Archival
• Network
• File Systems
• Advanced Commands
Sources to learn commands??


Primary – man(manual) pages. 






man <command>  ­ shows all information about the 
command 
<command> ­­help  ­ shows the available options 
for that command    

Secondary – Books and Internet
File Handling commands

• mkdir – make directories                                                                 
         Usage: mkdir [OPTION] DIRECTORY...                               
        eg. mkdir prabhat

• ls – list directory contents                                                                 
        Usage: ls [OPTION]... [FILE]...                                               
        eg. ls, ls ­l, ls prabhat

• cd – changes directories                                                                    
        Usage: cd [DIRECTORY]                                                        
        eg. cd prabhat
File Handling(contd...)

• pwd ­  print name of current working directory                              
      Usage: pwd                        

• vim – Vi Improved, a programmers text editor                               
      Usage: vim [OPTION] [file]...                                                   
      eg. vim file1.txt
                                           
     
File Handling(contd...)


cp – copy files and directories                                              

         Usage: cp [OPTION]... SOURCE DEST                     

         eg. cp sample.txt sample_copy.txt                              
               cp sample_copy.txt target_dir                              


mv – move (rename) files                                                     

        Usage: mv [OPTION]... SOURCE DEST                     

        eg. mv source.txt target_dir                                          
              mv old.txt new.txt
File Handling(contd...)
• rm ­ remove files or directories                                      
         Usage: rm [OPTION]... FILE...                               
         eg. rm file1.txt , rm ­rf some_dir    

• find – search for files in a directory hierarchy                 
        Usage: find [OPTION] [path] [pattern]                    
        eg. find file1.txt, find ­name file1.txt 
• history – prints recently used commands                         
         Usage: history            
Pattern
A Pattern is an expression that describes a set of
strings which is used to give a concise description
of a set, without having to list all elements.
eg. ab*cd matches anything that starts with ab and
ends with cd etc.
ls *.txt – prints all text files
Text Processing

• cat – concatenate files and print on the standard output                   
     Usage: cat [OPTION] [FILE]...                                                   
     eg. cat file1.txt file2.txt

         cat ­n file1.txt                                                                          

• echo – display a line of text                                                              
     Usage: echo [OPTION] [string] ...                                               
     eg. echo I love India                                                                     
           echo $HOME
Text Processing(contd...)

• grep ­ print lines matching a pattern                                                 
    Usage: grep [OPTION] PATTERN [FILE]...                               
    eg. grep ­i apple sample.txt                                                           
                                                                   

• wc ­ print the number of newlines, words, and bytes in files           
     Usage: wc [OPTION]... [FILE]...                                                
     eg.  wc file1.txt                                                                             
            wc ­L file1.txt
Text Processing(contd...)
• sort – sort lines of text files                                                    
     Usage: sort [OPTION]... [FILE]...                                     
     eg. sort file1.txt  
         sort ­r file1.txt
Linux File Permissions

• 3 types of file permissions – read, write, execute
• 10 bit format from 'ls ­l' command
                 1             2 3 4      5 6 7     8 9 10 
             file type    owner     group    others
eg. drwxrw­r­­   means owner has all three permissions,
      group has read and write, others have only read             
  permission
• read permission – 4, write – 2, execute ­1    
        eg. rwxrw­r­­   = 764
              673    =   rw­rwx­wx
System Administration

• chmod – change file access permissions                                          
       Usage: chmod [OPTION] [MODE] [FILE]                               
      eg. chmod 744 calculate.sh                                                         

• chown – change file owner and group                                              
      Usage: chown [OPTION]... OWNER[:[GROUP]] FILE...        
      eg. chown remo myfile.txt
System Administration (contd...)
•  su –  change user ID or become super­user                      
       Usage: su [OPTION] [LOGIN]                                         
       eg. su remo, su
• passwd – update  a user’s authentication tokens(s)           
       Usage: passwd [OPTION]                                               
       eg. passwd
• who – show who is logged on                                             
       Usage: who [OPTION]                                                    
       eg. who , who ­b , who ­q
Process Management

• ps – report a snapshot of the current processes                                
     Usage: ps [OPTION]                                                                    
     eg. ps,  ps ­el        

• kill – to kill a process(using signal mechanism)                               
     Usage: kill [OPTION] pid                                                            
     eg. kill ­9 2275 
Archival

• tar – to archive a file                                                                       
      Usage: tar [OPTION] DEST SOURCE                                    
      eg. tar ­cvf /home/archive.tar /home/original                            
            tar ­xvf /home/archive.tar

• zip – package and compress (archive) files                                    
      Usage: zip [OPTION] DEST SOURSE                                    
      eg. zip original.zip original
• unzip – list, test and extract compressed files in a ZIP archive     
     Usage: unzip filename
        eg. unzip original.zip
Network

• ssh – SSH client (remote login program)                                    
    “ssh is a program for logging into a remote machine and for         
   executing commands on a remote machine”      
 Usage: ssh [options] [user]@hostname  

 eg. ssh ­X guest@10.105.11.20                                   
• scp – secure copy (remote file copy program)                            
          “scp copies files between hosts on a network”         
Usage: scp [options] [[user]@host1:file1] [[user]@host2:file2]
 eg. scp file1.txt guest@10.105.11.20:~/Desktop/
File Systems
• fdisk – partition manipulator                                                  
     eg. sudo fdisk ­l
• mount – mount a file system                                                  
    Usage: mount ­t type device dir                                          
    eg. mount /dev/sda5 /media/target                                      
• umount – unmount file systems                                             
    Usage: umount [OPTIONS] dir | device...                          
    eg.  umount /media/target                                                   
          
File Systems(contd...)

• du – estimate file space usage                                                         
     Usage:  du [OPTION]... [FILE]...                                               
     eg. du     

• df – report filesystem disk space usage                                           
    Usage: df [OPTION]... [FILE]...                                                 
    eg. df    

• quota – display disk usage and limits                                             
    Usage: quota [OPTION]                                                              
    eg. quota ­v                                                                 
Advanced Commands
• reboot – reboot the system                                                     
       Usage: reboot [OPTION]                                                 
     eg. reboot                                                                          
                
• poweroff – power off the system                                           
       Usage: poweroff [OPTION]
     eg. poweroff 
Suggested Material
• The UNIX Programming Environment              
by Kernighan and Pike (PrenticeHall)                 
• Your UNIX: The Ultimate Guide                      
by Sumitabha Das
Thank You

 

 
Editor commands

• kate – KDE Advanced Text Editor                                                 
      Usage:  kate [options][file(s)]                                                    
      eg. kate file1.txt file2.txt                                                            
 

• vim – Vi Improved, a programmers text editor                               
      Usage: vim [OPTION] [file]...                                                   
      eg. vi hello.c

• gedit ­ A text Editor. Used to create and edit files.                         
               Usage: gedit [OPTION] [FILE]...                                     
               eg. gedit                         
Process Management(contd...)
• bg – make a foreground process to run in background              
         Usage: type 'ctrl+z'  and then 'bg <job id>'  
• fg – to make background process as foreground process           
          Usage: fg [jobid]
• jobs – displays the names and ids of background jobs              
          Usage: jobs
Advanced Commands (contd...)
• sed ­  stream editor for filtering and transforming text          
    Usage: sed [OPTION] [input­file]...                                   
    eg. sed 's/love/hate/g' loveletter.txt                                     
              
• awk ­ pattern scanning and processing language                   
    eg.  awk ­F: '{ print $1 }' sample_awk.txt
• find ­ search for files in a directory hierarchy                  
                    Usage: find [OPTION] [path] [pattern]        
                                    eg. find ­name file1.txt
• locate – find or locate a file
     Usage: locate [OPTION]... FILE...
     eg. locate file1.txt

Más contenido relacionado

La actualidad más candente

Linux presentation
Linux presentationLinux presentation
Linux presentation
Nikhil Jain
 
Converter 5.5を使ったP2V V2V
Converter 5.5を使ったP2V V2VConverter 5.5を使ったP2V V2V
Converter 5.5を使ったP2V V2V
z2015026
 

La actualidad más candente (20)

Linux
LinuxLinux
Linux
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Linux command ppt
Linux command pptLinux command ppt
Linux command ppt
 
Linux System Monitoring
Linux System Monitoring Linux System Monitoring
Linux System Monitoring
 
Users and groups
Users and groupsUsers and groups
Users and groups
 
Linux
LinuxLinux
Linux
 
Linux basics
Linux basicsLinux basics
Linux basics
 
Intro to Linux Shell Scripting
Intro to Linux Shell ScriptingIntro to Linux Shell Scripting
Intro to Linux Shell Scripting
 
Linux presentation
Linux presentationLinux presentation
Linux presentation
 
Basic commands of linux
Basic commands of linuxBasic commands of linux
Basic commands of linux
 
Linux
Linux Linux
Linux
 
Linux System Monitoring basic commands
Linux System Monitoring basic commandsLinux System Monitoring basic commands
Linux System Monitoring basic commands
 
Linux operating system
Linux operating systemLinux operating system
Linux operating system
 
GIT presentation
GIT presentationGIT presentation
GIT presentation
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
Bash Shell Scripting
Bash Shell ScriptingBash Shell Scripting
Bash Shell Scripting
 
Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management Course 102: Lecture 22: Package Management
Course 102: Lecture 22: Package Management
 
Bash shell scripting
Bash shell scriptingBash shell scripting
Bash shell scripting
 
Converter 5.5を使ったP2V V2V
Converter 5.5を使ったP2V V2VConverter 5.5を使ったP2V V2V
Converter 5.5を使ったP2V V2V
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 

Destacado

Presentation3 partial differentials equation
Presentation3  partial differentials equationPresentation3  partial differentials equation
Presentation3 partial differentials equation
Alen Pepa
 
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
WE-IT TUTORIALS
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
Amandeep Kaur
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
pbarasia
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
Roger Argarin
 

Destacado (20)

C graphics programs file
C graphics programs fileC graphics programs file
C graphics programs file
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
Presentation3 partial differentials equation
Presentation3  partial differentials equationPresentation3  partial differentials equation
Presentation3 partial differentials equation
 
CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9CG OpenGL surface detection+illumination+rendering models-course 9
CG OpenGL surface detection+illumination+rendering models-course 9
 
Visual basic 6
Visual basic 6Visual basic 6
Visual basic 6
 
Mis 03 management information systems
Mis 03  management information systemsMis 03  management information systems
Mis 03 management information systems
 
management information system
management information systemmanagement information system
management information system
 
Computer Graphics Lab File C Programs
Computer Graphics Lab File C ProgramsComputer Graphics Lab File C Programs
Computer Graphics Lab File C Programs
 
Computer Graphics HAND BOOK 2013
Computer Graphics HAND BOOK 2013Computer Graphics HAND BOOK 2013
Computer Graphics HAND BOOK 2013
 
Illumination model
Illumination modelIllumination model
Illumination model
 
Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)Computer Graphics Notes (B.Tech, KUK, MDU)
Computer Graphics Notes (B.Tech, KUK, MDU)
 
computer graphics
computer graphicscomputer graphics
computer graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
 
lecture1 introduction to computer graphics(Computer graphics tutorials)
lecture1 introduction to computer graphics(Computer graphics tutorials)lecture1 introduction to computer graphics(Computer graphics tutorials)
lecture1 introduction to computer graphics(Computer graphics tutorials)
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Introduction to computer graphics
Introduction to computer graphicsIntroduction to computer graphics
Introduction to computer graphics
 
Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)Presentation on visual basic 6 (vb6)
Presentation on visual basic 6 (vb6)
 
Introduction to visual basic programming
Introduction to visual basic programmingIntroduction to visual basic programming
Introduction to visual basic programming
 

Similar a Linux commands

PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
Priyadarshini648418
 
File handling and permisions.pptx
File handling and permisions.pptxFile handling and permisions.pptx
File handling and permisions.pptx
AkampaPhilomena
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
Ravikumar Nandigam
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
southees
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
Dimas Prasetyo
 

Similar a Linux commands (20)

Linux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.comLinux basics and commands - from lynxbee.com
Linux basics and commands - from lynxbee.com
 
Marwan al suwaidi
Marwan al suwaidiMarwan al suwaidi
Marwan al suwaidi
 
linux commands.pdf
linux commands.pdflinux commands.pdf
linux commands.pdf
 
Module 02 Using Linux Command Shell
Module 02 Using Linux Command ShellModule 02 Using Linux Command Shell
Module 02 Using Linux Command Shell
 
2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx2. UNIX OS System Architecture easy.pptx
2. UNIX OS System Architecture easy.pptx
 
Basic Linux commands
Basic Linux commandsBasic Linux commands
Basic Linux commands
 
proj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.pptproj2-the UNIX SYSTEM.ppt
proj2-the UNIX SYSTEM.ppt
 
Linux: Basics OF Linux
Linux: Basics OF LinuxLinux: Basics OF Linux
Linux: Basics OF Linux
 
PowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programmingPowerPoint_merge.ppt on unix programming
PowerPoint_merge.ppt on unix programming
 
Linux commands
Linux commandsLinux commands
Linux commands
 
File handling and permisions.pptx
File handling and permisions.pptxFile handling and permisions.pptx
File handling and permisions.pptx
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 
Group13
Group13Group13
Group13
 
LinuxCommands (1).pdf
LinuxCommands (1).pdfLinuxCommands (1).pdf
LinuxCommands (1).pdf
 
Linux file system nevigation
Linux file system nevigationLinux file system nevigation
Linux file system nevigation
 
8.1.intro unix
8.1.intro unix8.1.intro unix
8.1.intro unix
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
UNIX.pptx
UNIX.pptxUNIX.pptx
UNIX.pptx
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 

Último

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 

Último (20)

Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Plant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptxPlant propagation: Sexual and Asexual propapagation.pptx
Plant propagation: Sexual and Asexual propapagation.pptx
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024FSB Advising Checklist - Orientation 2024
FSB Advising Checklist - Orientation 2024
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 

Linux commands