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                                            
     

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...)
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
• 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 
Process Management
• 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
Archival
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 (19)

PPT
Unix cmc
Oussama BENNANI
 
PPT
Basic Linux
Tan Huynh Cong
 
PDF
The unix file system
gsandeepmenon
 
PDF
Unix files
Sunil Rm
 
PPT
Unix files
Sunil Rm
 
PDF
Lesson 3 Working with Files in Linux
Sadia Bashir
 
PDF
beginner.en.print
aniruddh Tyagi
 
DOCX
Comp practical
Kritika Sharma
 
PPT
Linux fundamentals Training
Love Steven
 
PPT
Unix File System
student(MCA)
 
PDF
Linux directory structure by jitu mistry
JITU MISTRY
 
PPTX
Linux Fundamentals
DianaWhitney4
 
PPT
Linux: Basics OF Linux
Omkar Walavalkar
 
PPSX
Management file and directory in linux
Zkre Saleh
 
PPTX
File permission in linux
Prakash Poudel
 
PPT
Unix file systems 2 in unix internal systems
senthilamul
 
PPT
Xfs file system for linux
Ajay Sood
 
ODP
Basic orientation to Linux
Vidyaratha Kissoon
 
PDF
Linux practicals T.Y.B.ScIT
vignesh0009
 
Unix cmc
Oussama BENNANI
 
Basic Linux
Tan Huynh Cong
 
The unix file system
gsandeepmenon
 
Unix files
Sunil Rm
 
Unix files
Sunil Rm
 
Lesson 3 Working with Files in Linux
Sadia Bashir
 
beginner.en.print
aniruddh Tyagi
 
Comp practical
Kritika Sharma
 
Linux fundamentals Training
Love Steven
 
Unix File System
student(MCA)
 
Linux directory structure by jitu mistry
JITU MISTRY
 
Linux Fundamentals
DianaWhitney4
 
Linux: Basics OF Linux
Omkar Walavalkar
 
Management file and directory in linux
Zkre Saleh
 
File permission in linux
Prakash Poudel
 
Unix file systems 2 in unix internal systems
senthilamul
 
Xfs file system for linux
Ajay Sood
 
Basic orientation to Linux
Vidyaratha Kissoon
 
Linux practicals T.Y.B.ScIT
vignesh0009
 

Similar to Linux commands (20)

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

Recently uploaded (20)

PDF
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
PDF
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
PDF
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
PPTX
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
PPTX
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
PDF
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
PDF
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
PDF
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
PDF
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
PPTX
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
PPTX
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
PDF
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
PDF
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
PPTX
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
PPTX
Tally software_Introduction_Presentation
AditiBansal54083
 
PDF
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
The 5 Reasons for IT Maintenance - Arna Softech
Arna Softech
 
SAP Firmaya İade ABAB Kodları - ABAB ile yazılmıl hazır kod örneği
Salih Küçük
 
AI + DevOps = Smart Automation with devseccops.ai.pdf
Devseccops.ai
 
OpenChain @ OSS NA - In From the Cold: Open Source as Part of Mainstream Soft...
Shane Coughlan
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pptx
Varsha Nayak
 
Open Chain Q2 Steering Committee Meeting - 2025-06-25
Shane Coughlan
 
Driver Easy Pro 6.1.1 Crack Licensce key 2025 FREE
utfefguu
 
Alexander Marshalov - How to use AI Assistants with your Monitoring system Q2...
VictoriaMetrics
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
MiniTool Partition Wizard 12.8 Crack License Key LATEST
hashhshs786
 
Automate Cybersecurity Tasks with Python
VICTOR MAESTRE RAMIREZ
 
Agentic Automation Journey Series Day 2 – Prompt Engineering for UiPath Agents
klpathrudu
 
Agentic Automation Journey Session 1/5: Context Grounding and Autopilot for E...
klpathrudu
 
vMix Pro 28.0.0.42 Download vMix Registration key Bundle
kulindacore
 
Why Businesses Are Switching to Open Source Alternatives to Crystal Reports.pdf
Varsha Nayak
 
Empowering Asian Contributions: The Rise of Regional User Groups in Open Sour...
Shane Coughlan
 
Tally software_Introduction_Presentation
AditiBansal54083
 
MiniTool Partition Wizard Free Crack + Full Free Download 2025
bashirkhan333g
 
Ad

Linux commands