SlideShare a Scribd company logo
Basic Linux Commands
What is Linux
• Linux is a Unix system
• Free
• Open Source
• Developed by Linus Torvalds in 1991
• There are several Linux distributions:
– Red hat
– Fedora
– Ubantu
What is Linux Shell?
• Accepts your instruction or command
• If it is valid command, it is passed to
the kernel (part of the OS).
• Several shells available with Linux.
– BASH
• To find current shell type:
– $ echo $SHELL
• To know about command:
– Ex: man ls
Files and rights
• List your file
– $ ls
– $ ls –l
– $ ls –a
• Display entire file
– $ cat filename
• Copy
– $ cp filename1 filename2
• Move or change name
– $ mv filename1 filename2
Files and rights
• Remove file
– $ rm file_name
– $ rm -i
– $ rm –r
– $ rm -rf
• Display entire file
– $ cat file_name
• Copy
– $ cp file_name1 file_name2
• Change permissions
– $ chmod [options] file_name
Files and rights
• To change the rights, 2 methods with chmod:
• $ chmod o+r myfile, chmod g-rw myfile, chmod u=rw,go=r
myfile
• $ chmod 777 myfile, chmod 555 myfile
• Note: to change the rights on an entire directory:
• $ chmod –R 777 mydirectory, chmod -R g+rw.
• To change the owner: chown
– $ chown sumedh myfile
Directories and paths
• Make a new directory:
• $ mkdir dir_name
• “. “ is your current directory
• “..” is your upper level directory
• To Paths can be absolute or relative:
– /home/sumedh/bill/foo.txt is an absolute path.
– ../bill/foo.txt is a relative path.
Directories and paths
• Change directory:
• $ cd dir_name
• $ cd ..
• $ cd or cd ~
• $ cd ~/bill = cd /home/sumedh/bill
• Current directory
• $ pwd
• Disk usage
• $ du file_name
• $ du -h
Job Control
• List your prcesses:
• $ top
• $ ps –ef
• $ ps –ef | grep jboss
• $ cd ~/bill = cd /home/sumedh/bill
• Kill a process
• $ kill [options] PID
• Ex: $ kill -9 624535
• Launch a job in background
• $ ./run.sh &
Miscellaneous
• Which user you have logged in:
• $ whoami
• Change the user:
• $ su – Sumdh_Kakde
• Date
• $ date
• Achieving : tar
• $ tar –cvzf archieve_name.tar dir_name/
• $ tar –xzvf archieve_name.tar or archieve_name.tar.gz
• File Compression:
• $ unzip test.zip
Miscellaneous
• Edit files:
• $ vi file_name.txt
• $ vim file_name.txt
• tail command:
• Print last 10 lines of the file by default
– $ tail file_name.txt
• Print last L number of lines from a file
– $ tail –n L file_name.txt
• View the contents of file in real time.
– $ tail –f log_file.log
Grep Command
https://www.geeksforgeeks.org/grep-command-in-unixlinux/

More Related Content

Similar to 232623113-Basic-Linux-Commands.docx linux unix (20)

PPT
linux-lecture4.ppt
LuigysToro
 
PPT
linux-commands.ppt
saubhagya ranjan
 
PPT
linux-commands.ppt
AbhishekKumarSrivast36
 
PPT
linux-commands.ppt
ArliPutraPratama1
 
PPT
linux-commands.ppt
MeghrajPatil11
 
PPT
linux-commands.ppt
ArliPutraPratama
 
PPT
Linux commands
VenkatakrishnaAdari1
 
PPT
linux-commands.ppt
hazhamina
 
PPT
Unix tutorial-08
Tushar Jain
 
PPTX
LINUX_admin_commands.pptx
GuhanSenthil2
 
PPT
8.1.intro unix
southees
 
PDF
Unix and Linux - The simple introduction
Amity University Noida
 
PPT
Bootcamp linux commands
NexThoughts Technologies
 
PPTX
Suman bhatt
Tapas Bayen
 
PPT
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
PDF
Basics of Linux Commands, Git and Github
Devang Garach
 
PPTX
Red hat linux essentials
Haitham Raik
 
PPT
Linux commands and file structure
Sreenatha Reddy K R
 
PPT
Linux ppt
Sanmuga Nathan
 
DOC
58518522 study-aix
homeworkping3
 
linux-lecture4.ppt
LuigysToro
 
linux-commands.ppt
saubhagya ranjan
 
linux-commands.ppt
AbhishekKumarSrivast36
 
linux-commands.ppt
ArliPutraPratama1
 
linux-commands.ppt
MeghrajPatil11
 
linux-commands.ppt
ArliPutraPratama
 
Linux commands
VenkatakrishnaAdari1
 
linux-commands.ppt
hazhamina
 
Unix tutorial-08
Tushar Jain
 
LINUX_admin_commands.pptx
GuhanSenthil2
 
8.1.intro unix
southees
 
Unix and Linux - The simple introduction
Amity University Noida
 
Bootcamp linux commands
NexThoughts Technologies
 
Suman bhatt
Tapas Bayen
 
BITS: Introduction to Linux - Text manipulation tools for bioinformatics
BITS
 
Basics of Linux Commands, Git and Github
Devang Garach
 
Red hat linux essentials
Haitham Raik
 
Linux commands and file structure
Sreenatha Reddy K R
 
Linux ppt
Sanmuga Nathan
 
58518522 study-aix
homeworkping3
 

Recently uploaded (20)

PDF
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PPTX
Introduction to Indian Writing in English
Trushali Dodiya
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
PDF
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PDF
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
PDF
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
PDF
Workbook de Inglés Completo - English Path.pdf
shityouenglishpath
 
PDF
Horarios de distribución de agua en julio
pegazohn1978
 
PDF
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
PPTX
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
PPTX
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
PDF
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
PPTX
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
PDF
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
PPTX
Controller Request and Response in Odoo18
Celine George
 
Biological Bilingual Glossary Hindi and English Medium
World of Wisdom
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
How to Create Odoo JS Dialog_Popup in Odoo 18
Celine George
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
Introduction to Indian Writing in English
Trushali Dodiya
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
ENGlish 8 lesson presentation PowerPoint.pptx
marawehsvinetshe
 
Is Assignment Help Legal in Australia_.pdf
thomas19williams83
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
Vani - The Voice of Excellence - Jul 2025 issue
Savipriya Raghavendra
 
Exploring the Different Types of Experimental Research
Thelma Villaflores
 
Workbook de Inglés Completo - English Path.pdf
shityouenglishpath
 
Horarios de distribución de agua en julio
pegazohn1978
 
Governor Josh Stein letter to NC delegation of U.S. House
Mebane Rash
 
Introduction to Biochemistry & Cellular Foundations.pptx
marvinnbustamante1
 
EDUCATIONAL MEDIA/ TEACHING AUDIO VISUAL AIDS
Sonali Gupta
 
STATEMENT-BY-THE-HON.-MINISTER-FOR-HEALTH-ON-THE-COVID-19-OUTBREAK-AT-UG_revi...
nservice241
 
DIGITAL CITIZENSHIP TOPIC TLE 8 MATATAG CURRICULUM
ROBERTAUGUSTINEFRANC
 
Week 2 - Irish Natural Heritage Powerpoint.pdf
swainealan
 
Controller Request and Response in Odoo18
Celine George
 
Ad

232623113-Basic-Linux-Commands.docx linux unix

  • 2. What is Linux • Linux is a Unix system • Free • Open Source • Developed by Linus Torvalds in 1991 • There are several Linux distributions: – Red hat – Fedora – Ubantu
  • 3. What is Linux Shell? • Accepts your instruction or command • If it is valid command, it is passed to the kernel (part of the OS). • Several shells available with Linux. – BASH • To find current shell type: – $ echo $SHELL • To know about command: – Ex: man ls
  • 4. Files and rights • List your file – $ ls – $ ls –l – $ ls –a • Display entire file – $ cat filename • Copy – $ cp filename1 filename2 • Move or change name – $ mv filename1 filename2
  • 5. Files and rights • Remove file – $ rm file_name – $ rm -i – $ rm –r – $ rm -rf • Display entire file – $ cat file_name • Copy – $ cp file_name1 file_name2 • Change permissions – $ chmod [options] file_name
  • 6. Files and rights • To change the rights, 2 methods with chmod: • $ chmod o+r myfile, chmod g-rw myfile, chmod u=rw,go=r myfile • $ chmod 777 myfile, chmod 555 myfile • Note: to change the rights on an entire directory: • $ chmod –R 777 mydirectory, chmod -R g+rw. • To change the owner: chown – $ chown sumedh myfile
  • 7. Directories and paths • Make a new directory: • $ mkdir dir_name • “. “ is your current directory • “..” is your upper level directory • To Paths can be absolute or relative: – /home/sumedh/bill/foo.txt is an absolute path. – ../bill/foo.txt is a relative path.
  • 8. Directories and paths • Change directory: • $ cd dir_name • $ cd .. • $ cd or cd ~ • $ cd ~/bill = cd /home/sumedh/bill • Current directory • $ pwd • Disk usage • $ du file_name • $ du -h
  • 9. Job Control • List your prcesses: • $ top • $ ps –ef • $ ps –ef | grep jboss • $ cd ~/bill = cd /home/sumedh/bill • Kill a process • $ kill [options] PID • Ex: $ kill -9 624535 • Launch a job in background • $ ./run.sh &
  • 10. Miscellaneous • Which user you have logged in: • $ whoami • Change the user: • $ su – Sumdh_Kakde • Date • $ date • Achieving : tar • $ tar –cvzf archieve_name.tar dir_name/ • $ tar –xzvf archieve_name.tar or archieve_name.tar.gz • File Compression: • $ unzip test.zip
  • 11. Miscellaneous • Edit files: • $ vi file_name.txt • $ vim file_name.txt • tail command: • Print last 10 lines of the file by default – $ tail file_name.txt • Print last L number of lines from a file – $ tail –n L file_name.txt • View the contents of file in real time. – $ tail –f log_file.log