SlideShare a Scribd company logo
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

More Related Content

What's hot (20)

ODP
Linux commands
Balakumaran Arunachalam
 
PPTX
Linux commands
penetration Tester
 
PPT
Linux basic commands
MohanKumar Palanichamy
 
PDF
Shell scripting
Manav Prasad
 
PPTX
Bash shell scripting
VIKAS TIWARI
 
PPT
Basic command ppt
Rohit Kumar
 
PPT
Linux command ppt
kalyanineve
 
PDF
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
PDF
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
PPTX
Linux basics part 1
Lilesh Pathe
 
PDF
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
PPT
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
PPTX
Introduction 2 linux
Papu Kumar
 
PDF
Linux Networking Explained
Thomas Graf
 
PDF
Linux introduction
Md. Zahid Hossain Shoeb
 
PDF
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
PDF
Ansible 101
Gena Mykhailiuta
 
PPTX
Basics of shell programming
Chandan Kumar Rana
 
PPTX
Linux standard file system
Taaanu01
 
Linux commands
Balakumaran Arunachalam
 
Linux commands
penetration Tester
 
Linux basic commands
MohanKumar Palanichamy
 
Shell scripting
Manav Prasad
 
Bash shell scripting
VIKAS TIWARI
 
Basic command ppt
Rohit Kumar
 
Linux command ppt
kalyanineve
 
Course 102: Lecture 20: Networking In Linux (Basic Concepts)
Ahmed El-Arabawy
 
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Linux basics part 1
Lilesh Pathe
 
DevConf 2014 Kernel Networking Walkthrough
Thomas Graf
 
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
Introduction 2 linux
Papu Kumar
 
Linux Networking Explained
Thomas Graf
 
Linux introduction
Md. Zahid Hossain Shoeb
 
LinuxCon 2015 Linux Kernel Networking Walkthrough
Thomas Graf
 
Ansible 101
Gena Mykhailiuta
 
Basics of shell programming
Chandan Kumar Rana
 
Linux standard file system
Taaanu01
 

Viewers also liked (20)

DOCX
C graphics programs file
shubham kanojia
 
PDF
Visual basic 6
allen cervantes
 
PPT
Presentation3 partial differentials equation
Alen Pepa
 
PDF
CG OpenGL surface detection+illumination+rendering models-course 9
fungfung Chen
 
PPTX
Visual basic 6
mohamedsaad24
 
PPTX
Mis 03 management information systems
Tushar B Kute
 
DOCX
Computer Graphics Lab File C Programs
Kandarp Tiwari
 
DOC
Computer Graphics HAND BOOK 2013
gouse_1210
 
PPT
Illumination model
Ankur Kumar
 
PDF
Computer Graphics Notes (B.Tech, KUK, MDU)
Rajesh Kamboj
 
PPT
computer graphics
ashpri156
 
PPTX
Introduction to computer graphics
Kamal Acharya
 
PDF
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
WE-IT TUTORIALS
 
PPT
lecture1 introduction to computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
PDF
Notes 2D-Transformation Unit 2 Computer graphics
NANDINI SHARMA
 
PPTX
Computer Graphics
Deepak Kumar Mohapatra
 
PPT
Introduction to computer graphics
Amandeep Kaur
 
PPTX
Presentation on visual basic 6 (vb6)
pbarasia
 
PPT
Introduction to visual basic programming
Roger Argarin
 
C graphics programs file
shubham kanojia
 
Visual basic 6
allen cervantes
 
Presentation3 partial differentials equation
Alen Pepa
 
CG OpenGL surface detection+illumination+rendering models-course 9
fungfung Chen
 
Visual basic 6
mohamedsaad24
 
Mis 03 management information systems
Tushar B Kute
 
Computer Graphics Lab File C Programs
Kandarp Tiwari
 
Computer Graphics HAND BOOK 2013
gouse_1210
 
Illumination model
Ankur Kumar
 
Computer Graphics Notes (B.Tech, KUK, MDU)
Rajesh Kamboj
 
computer graphics
ashpri156
 
Introduction to computer graphics
Kamal Acharya
 
tybsc it sem 5 Linux administration notes of unit 1,2,3,4,5,6 version 3
WE-IT TUTORIALS
 
lecture1 introduction to computer graphics(Computer graphics tutorials)
Daroko blog(www.professionalbloggertricks.com)
 
Notes 2D-Transformation Unit 2 Computer graphics
NANDINI SHARMA
 
Computer Graphics
Deepak Kumar Mohapatra
 
Introduction to computer graphics
Amandeep Kaur
 
Presentation on visual basic 6 (vb6)
pbarasia
 
Introduction to visual basic programming
Roger Argarin
 
Ad

Similar to Linux commands (20)

PDF
Linux commands
Saurabh Gupta
 
PPTX
Basic commands of linux
shravan saini
 
PPT
Basiccommandppt 130415133716-phpapp02
Kamalakannan Kuppan
 
PDF
LinuxCommands (1).pdf
AnkitKushwaha792697
 
PPTX
Linux commands presentation topic discrete structure.ppt
akshitabansal1815
 
PPTX
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Ciceer Ghimirey
 
PPTX
Using linux in schools
saeed7878
 
DOCX
Linux basic commands tutorial
Teja Bheemanapally
 
PPTX
Linux Commands
Vishal Kothari
 
PDF
Linux basics and commands - from lynxbee.com
Green Ecosystem
 
DOCX
Lab Report.1.docx
1KWatching
 
PPTX
Linux Commands - Basic commands for Beginners
reachadhinvs
 
PDF
Linux Basics
Luther Hill
 
PPT
linux-lecture4.ppt
LuigysToro
 
PPT
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
PPTX
Linux week 2
Vinoth Sn
 
PDF
Module 02 Using Linux Command Shell
Tushar B Kute
 
PDF
008-Basic-Linux-Commands.pdf
ssuser584832
 
PPT
Linux directory commands:more options on cd and ls command
bhatvijetha
 
PDF
Ubuntu – Linux Useful Commands
University of Technology
 
Linux commands
Saurabh Gupta
 
Basic commands of linux
shravan saini
 
Basiccommandppt 130415133716-phpapp02
Kamalakannan Kuppan
 
LinuxCommands (1).pdf
AnkitKushwaha792697
 
Linux commands presentation topic discrete structure.ppt
akshitabansal1815
 
Lab 3 -Linux Files, Directories and Basic Commands.pptx
Ciceer Ghimirey
 
Using linux in schools
saeed7878
 
Linux basic commands tutorial
Teja Bheemanapally
 
Linux Commands
Vishal Kothari
 
Linux basics and commands - from lynxbee.com
Green Ecosystem
 
Lab Report.1.docx
1KWatching
 
Linux Commands - Basic commands for Beginners
reachadhinvs
 
Linux Basics
Luther Hill
 
linux-lecture4.ppt
LuigysToro
 
linux-lecture4.pptuyhbjhbiibihbiuhbbihbi
YajnadattaPattanayak
 
Linux week 2
Vinoth Sn
 
Module 02 Using Linux Command Shell
Tushar B Kute
 
008-Basic-Linux-Commands.pdf
ssuser584832
 
Linux directory commands:more options on cd and ls command
bhatvijetha
 
Ubuntu – Linux Useful Commands
University of Technology
 
Ad

Recently uploaded (20)

PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPT
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PPTX
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
PDF
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
PDF
The Different Types of Non-Experimental Research
Thelma Villaflores
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
Talk on Critical Theory, Part One, Philosophy of Social Sciences
Soraj Hongladarom
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
I AM MALALA The Girl Who Stood Up for Education and was Shot by the Taliban...
Beena E S
 
QNL June Edition hosted by Pragya the official Quiz Club of the University of...
Pragya - UEM Kolkata Quiz Club
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
CATEGORIES OF NURSING PERSONNEL: HOSPITAL & COLLEGE
PRADEEP ABOTHU
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
GRADE-3-PPT-EVE-2025-ENG-Q1-LESSON-1.pptx
EveOdrapngimapNarido
 
The Different Types of Non-Experimental Research
Thelma Villaflores
 

Linux commands