SlideShare a Scribd company logo
2
Most read
6
Most read
7
Most read
LINUX BASIC
COMMANDS
PREPARED BY: - SAGAR KUMAR
Introduction to Linux
■ Open Source Operating System: -The Linux is free to use and everyone has freedom
to contribute to its development.The code used to create Linux is free and available to
the public to view, edit, and for users with the appropriate skills to contribute to.
■ Link to view Linux Kernel source code: - https://www.kernel.org/
■ Linux Kernel source code is written primarily in C andAssembly language
■ Developed by LinusTorvalds on September 17, 1991.
Architecture of Linux Operating System
Linux Basic Commands Categories
Basic commands of Linux can be categorizes into following categories: -
o SYSTEM & HARDWARE INFORMATION
o USER INFORMATION AND MANAGEMENT
o FILE AND DIRECTORY COMMANDS
o PROCESS MANAGEMENT
o FILE PERMISSIONS
o NETWORKING
o ARCHIVES (TAR FILES)
o SEARCH
o FILETRANSFERS
o FILE EDITING AND NAVIGATION INSIDE FILES
System and Hardware Information
o uname –a #Display Linux system information
Linux aa34faf8af0b 3.10.0514.26.2.el7.x86_64 #1 SMPTue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
o uname –r #Dispaly kernel release information
3.10.0-514.26.2.el7.x86_64
o uptime #for how long system has been running
11:56:15 up 14 days, 21:18, 0 users, load average: 23.14, 24.23, 24.68
o hostname #gives hostname of the system
root@ubuntu:~# hostname ubuntu
o hostname –I #gives IP address of the Host
78.31.70.238
o last reboot #to check when the system has been last rebooted
wtmp begins Sat Sep 9 10:24:23 2017
o date #display the date and time
Mon Jan 01 2018 17:17:33 GMT+0530 (India StandardTime)
o cal #display current month calendar
o free #Display the free and used memory (-h for human readable, -m for MB, -g for GB)
total used free shared buff/cache available
Mem: 263861664 11205028 205258364 1867876 47398272 233338992
Swap: 4194300 1756284 2438016
User Information and management
o w #show who is logged in and what they are doing.
12:07:00 up 14 days, 21:29, 0 users, load average: 21.66, 24.14, 24.30
USER TTY LOGIN@ IDLE JCPU PCPU WHAT
o who #who is logged into the system
sagar tty7 2018-02-02 21:34
sagar pts/0 2018-02-02 21:35 (:0)
o whoami #who are you logged in as
[2018-01-01 17:41.43] ~
[SAGAR.workgroup] ➤ whoami
SAGAR
o id #display the current user id and group id
[2018-01-01 17:41.49] ~
[SAGAR.workgroup] ➤ id
uid=1001(SAGAR) gid=513(UsersGrp) groups=1002(HomeUsers),1004(ORA_DBA),559(Performance Log Users),545(Users)
o last #who logged in last
wtmp begins Fri Feb 2 21:53:58 2018
File and directory commands: -
o ls –al #lists all file in long listed format
o ll #actually aliased to `ls -l'
o pwd #shows present working directory
o mkdir directory_name #creates a new directory
o rmdir directory_name #deletes an empty directory
o rm –r directory_name #deletes the directory and its contents
o rm filename #deletes a file
o cp file1 file2 #copy one file to another
o mv file1 file2 #move a file/ rename a file
o touch filename #create a new file
o cat filename #displays the file contents
File permission: -
• There are 3 types of users
1. User(u) 2. Group(g) 3. Others/ World(o)
• Below are the permissions types
• Read= r
• Write= w
• Execute = x
• No access = -
• Commands to change the permissions of the file:- chmod
example:- chmod 755 filename
1/0 1/0 1/0
r = - - -
w = - - -
x = - - -
Example: rwx rwx rwx chmod 777 filename
Archives (Tar files): -
o tar -cf archive.tar directory name # Create tar named archive.tar containing directory.
o tar -xf archive_name.tar # Extract the contents from archive.tar.
o tar -czf archive.tar.gz directory name # Create a gzip compressed tar file name archive.tar.gz.
o tar -xzf archive_name.tar.gz # Extract a gzip compressed tar file.
Directory Navigation: -
o cd .. # To go up one level of the directory tree. (Change into the parent directory.)
o cd # Go to the $HOME directory
o cd /etc # Change to the /etc directory
o cd - # go back to previous directory (last accessed directory)
Process management: -
o ps #your currently running processes
o ps –ef #all the currently running processes on the system
o ps- -ef |grep processname #process information for process name
o kill pid #kill a process
o top #display and manage the top processes
o killall processname #kill all processes named there
o program & #start program in the background
o bg #display stopped or background processes
o fg #bring the most recent background job to foreground
Networking: -
o ifconfig #Displays network interface and ip address
o ping #to check given address is alive or not
o dig domain_name #display DNS information for domain
o dig –x IP_Address #Reverse lookup of IP_Address
o host domain #display DNS IP address for domain
o hostname #display the hostname
[2018-01-01 19:06.49] ~
[SAGAR.workgroup] ➤ hostname
workgroup
o netstat #Display listening tcp and udp ports and corresponding programs
– [SAGAR.workgroup] ➤ netstat
– Active Connections
– Proto Local Address Foreign Address State
– TCP 10.10.156.9:4280 hk2sch130022025:https ESTABLISHED
– TCP 10.10.156.9:4294 sb-in-f188:5228 ESTABLISHED
– TCP 10.10.156.9:6010 static:https ESTABLISHED
– TCP 10.10.156.9:9327 static:https ESTABLISHED
– TCP 10.10.156.9:9635 13.75.42.223:https TIME_WAIT
FileTransfers: -
o scp file.txt server:/tmp # Secure copy file.txt to the /tmp folder on server
o scp server:/var/www/*.html /tmp # Copy *.html files from server to the local /tmp folder.
o scp -r server:/var/www /tmp # Copy all files and directories recursively from server
to the current system's /tmp folder.
Search: -
o grep “pattern” file # Search for pattern in file
o grep -r “pattern” directory # Search recursively for pattern in directory
o locate name # Find files and directories by name
o find /home/Sagar -name 'prefix*’ # Find files in /home/Sagar that start with "prefix".
o find /home -size +250M # Find files larger than 250MB in /home
Movement within a file: -
o h, j, k ,l #left, down, up
o $ #to end of a line
o ^ #to the beginning of a line
o G #end of a file
o :1 #to the beginning of a file
o :47 #to the given line (here on 47th line)
File Editing: -
o Most common editor in Linux  vi editor
o Commands for editing files in vi editor
o vi filename # to open file in editor (Command mode)
o Press “i” # to go in INSERT mode
o double esc # moving to command mode
o :w #to save changes
o :q #to exit
o :q! #force exit
o :wq #save changes and exit
File Editing (contd…): -
o dd #remove a line
o 5dd #remove 5 lines
o u #undo last action
o :s/string #searching a string in file
o :s/string/replace #search and replace a string in current line
o :%s/string/replace #search and replace a string in whole file
o :%s/string/replace/i #search and replace a string in whole file(Case Insensitive)
Disk usages: -
o df –h # Show free and used space on mounted filesystems
o df –I # Show free and used inodes on mounted filesystems
o fdisk –l # Display disks partitions sizes and types
o du –ah # Display disk usage for all files and directories in human readable format
o du –sh # Display total disk usage off the current directory
THANK
YOU

More Related Content

PPTX
Linux basics
Shagun Rathore
 
PPTX
Linux fundamentals
Raghu nath
 
PDF
Lesson 2 Understanding Linux File System
Sadia Bashir
 
PPT
Linux
Kevin James
 
PPTX
Introduction to Linux
Harish R
 
PPTX
Introduction to linux
Stephen Ahiante
 
PPTX
Linux basics part 1
Lilesh Pathe
 
PPTX
Introduction 2 linux
Papu Kumar
 
Linux basics
Shagun Rathore
 
Linux fundamentals
Raghu nath
 
Lesson 2 Understanding Linux File System
Sadia Bashir
 
Linux
Kevin James
 
Introduction to Linux
Harish R
 
Introduction to linux
Stephen Ahiante
 
Linux basics part 1
Lilesh Pathe
 
Introduction 2 linux
Papu Kumar
 

What's hot (20)

PDF
Linux Presentation
nishantsri
 
PPT
Linux presentation
Nikhil Jain
 
PPT
Linux Commands
Ramasubbu .P
 
PDF
Linux introduction
Md. Zahid Hossain Shoeb
 
PPT
Basic command ppt
Rohit Kumar
 
DOCX
Linux admin interview questions
Kavya Sri
 
PPT
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
PPTX
Basic commands of linux
shravan saini
 
PPT
Linux file system
Midaga Mengistu
 
PDF
Linux Basic Commands
Hanan Nmr
 
PPT
Unix/Linux Basic Commands and Shell Script
sbmguys
 
PDF
Linux basic commands with examples
abclearnn
 
PPTX
Linux
RittikaBaksi
 
PDF
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Edureka!
 
PDF
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
PPT
Linux command ppt
kalyanineve
 
PDF
Linux kernel
Mahmoud Shiri Varamini
 
PPTX
Users and groups
Varnnit Jain
 
PPT
Linux - Introductions to Linux Operating System
Vibrant Technologies & Computers
 
PPTX
Automating with Ansible
Ricardo Schmidt
 
Linux Presentation
nishantsri
 
Linux presentation
Nikhil Jain
 
Linux Commands
Ramasubbu .P
 
Linux introduction
Md. Zahid Hossain Shoeb
 
Basic command ppt
Rohit Kumar
 
Linux admin interview questions
Kavya Sri
 
Basic 50 linus command
MAGNA COLLEGE OF ENGINEERING
 
Basic commands of linux
shravan saini
 
Linux file system
Midaga Mengistu
 
Linux Basic Commands
Hanan Nmr
 
Unix/Linux Basic Commands and Shell Script
sbmguys
 
Linux basic commands with examples
abclearnn
 
Linux Tutorial For Beginners | Linux Administration Tutorial | Linux Commands...
Edureka!
 
Linux systems - Linux Commands and Shell Scripting
Emertxe Information Technologies Pvt Ltd
 
Linux command ppt
kalyanineve
 
Users and groups
Varnnit Jain
 
Linux - Introductions to Linux Operating System
Vibrant Technologies & Computers
 
Automating with Ansible
Ricardo Schmidt
 
Ad

Similar to Linux basic commands (20)

PDF
Get Started with Linux Management Command line Basic Knowledge
David Clark
 
PDF
The Linux Command Cheat Sheet
Tola LENG
 
PPTX
Linux Presentation
Muhammad Qazi
 
PPTX
Basic Linux Administration - 3.pptxon server
RekeshPatel
 
PPT
Rhel1
Yash Gulati
 
PDF
3.1.a linux commands reference
Acácio Oliveira
 
PDF
Linux commands cheat sheet by linoxide.com
Stavros Skamagkis
 
PDF
Unix _linux_fundamentals_for_hpc-_b
Mohammad Reza Beygi
 
PDF
Rhel 6.2 complete ebook
Yash Gulati
 
PPTX
Linux commands
shekhar70
 
DOCX
Rhel 6.2 complete ebook
Yash Gulati
 
PDF
Linux Getting Started
Angus Li
 
PPT
Linux
Rathan Raj
 
PPTX
Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012
Jose L. Quiñones-Borrero
 
PPT
Linux commands
Ajaigururaj R
 
PPT
Linux commands
Hemakumar.S
 
PPT
Linux commands
Hemakumar.S
 
PPT
Linux
sravan kumar
 
PDF
Basics of Linux Commands, Git and Github
Devang Garach
 
PDF
Linux command line
fernando valenzuela hernández
 
Get Started with Linux Management Command line Basic Knowledge
David Clark
 
The Linux Command Cheat Sheet
Tola LENG
 
Linux Presentation
Muhammad Qazi
 
Basic Linux Administration - 3.pptxon server
RekeshPatel
 
3.1.a linux commands reference
Acácio Oliveira
 
Linux commands cheat sheet by linoxide.com
Stavros Skamagkis
 
Unix _linux_fundamentals_for_hpc-_b
Mohammad Reza Beygi
 
Rhel 6.2 complete ebook
Yash Gulati
 
Linux commands
shekhar70
 
Rhel 6.2 complete ebook
Yash Gulati
 
Linux Getting Started
Angus Li
 
Linux
Rathan Raj
 
Linux for Security Professionals (Tips and Tricks) - Init 6 10/2012
Jose L. Quiñones-Borrero
 
Linux commands
Ajaigururaj R
 
Linux commands
Hemakumar.S
 
Linux commands
Hemakumar.S
 
Basics of Linux Commands, Git and Github
Devang Garach
 
Linux command line
fernando valenzuela hernández
 
Ad

Recently uploaded (20)

PDF
Doc9.....................................
SofiaCollazos
 
PDF
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
PDF
Brief History of Internet - Early Days of Internet
sutharharshit158
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
PPTX
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
PDF
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PDF
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Doc9.....................................
SofiaCollazos
 
Using Anchore and DefectDojo to Stand Up Your DevSecOps Function
Anchore
 
Brief History of Internet - Early Days of Internet
sutharharshit158
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Software Development Methodologies in 2025
KodekX
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
The-Ethical-Hackers-Imperative-Safeguarding-the-Digital-Frontier.pptx
sujalchauhan1305
 
Agile Chennai 18-19 July 2025 | Emerging patterns in Agentic AI by Bharani Su...
AgileNetwork
 
NewMind AI Weekly Chronicles - July'25 - Week IV
NewMind AI
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
AI Unleashed - Shaping the Future -Starting Today - AIOUG Yatra 2025 - For Co...
Sandesh Rao
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
Get More from Fiori Automation - What’s New, What Works, and What’s Next.pdf
Precisely
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 

Linux basic commands

  • 2. Introduction to Linux ■ Open Source Operating System: -The Linux is free to use and everyone has freedom to contribute to its development.The code used to create Linux is free and available to the public to view, edit, and for users with the appropriate skills to contribute to. ■ Link to view Linux Kernel source code: - https://www.kernel.org/ ■ Linux Kernel source code is written primarily in C andAssembly language ■ Developed by LinusTorvalds on September 17, 1991.
  • 3. Architecture of Linux Operating System
  • 4. Linux Basic Commands Categories Basic commands of Linux can be categorizes into following categories: - o SYSTEM & HARDWARE INFORMATION o USER INFORMATION AND MANAGEMENT o FILE AND DIRECTORY COMMANDS o PROCESS MANAGEMENT o FILE PERMISSIONS o NETWORKING o ARCHIVES (TAR FILES) o SEARCH o FILETRANSFERS o FILE EDITING AND NAVIGATION INSIDE FILES
  • 5. System and Hardware Information o uname –a #Display Linux system information Linux aa34faf8af0b 3.10.0514.26.2.el7.x86_64 #1 SMPTue Jul 4 15:04:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux o uname –r #Dispaly kernel release information 3.10.0-514.26.2.el7.x86_64 o uptime #for how long system has been running 11:56:15 up 14 days, 21:18, 0 users, load average: 23.14, 24.23, 24.68 o hostname #gives hostname of the system root@ubuntu:~# hostname ubuntu o hostname –I #gives IP address of the Host 78.31.70.238 o last reboot #to check when the system has been last rebooted wtmp begins Sat Sep 9 10:24:23 2017 o date #display the date and time Mon Jan 01 2018 17:17:33 GMT+0530 (India StandardTime) o cal #display current month calendar o free #Display the free and used memory (-h for human readable, -m for MB, -g for GB) total used free shared buff/cache available Mem: 263861664 11205028 205258364 1867876 47398272 233338992 Swap: 4194300 1756284 2438016
  • 6. User Information and management o w #show who is logged in and what they are doing. 12:07:00 up 14 days, 21:29, 0 users, load average: 21.66, 24.14, 24.30 USER TTY LOGIN@ IDLE JCPU PCPU WHAT o who #who is logged into the system sagar tty7 2018-02-02 21:34 sagar pts/0 2018-02-02 21:35 (:0) o whoami #who are you logged in as [2018-01-01 17:41.43] ~ [SAGAR.workgroup] ➤ whoami SAGAR o id #display the current user id and group id [2018-01-01 17:41.49] ~ [SAGAR.workgroup] ➤ id uid=1001(SAGAR) gid=513(UsersGrp) groups=1002(HomeUsers),1004(ORA_DBA),559(Performance Log Users),545(Users) o last #who logged in last wtmp begins Fri Feb 2 21:53:58 2018
  • 7. File and directory commands: - o ls –al #lists all file in long listed format o ll #actually aliased to `ls -l' o pwd #shows present working directory o mkdir directory_name #creates a new directory o rmdir directory_name #deletes an empty directory o rm –r directory_name #deletes the directory and its contents o rm filename #deletes a file o cp file1 file2 #copy one file to another o mv file1 file2 #move a file/ rename a file o touch filename #create a new file o cat filename #displays the file contents
  • 8. File permission: - • There are 3 types of users 1. User(u) 2. Group(g) 3. Others/ World(o) • Below are the permissions types • Read= r • Write= w • Execute = x • No access = - • Commands to change the permissions of the file:- chmod example:- chmod 755 filename 1/0 1/0 1/0 r = - - - w = - - - x = - - - Example: rwx rwx rwx chmod 777 filename
  • 9. Archives (Tar files): - o tar -cf archive.tar directory name # Create tar named archive.tar containing directory. o tar -xf archive_name.tar # Extract the contents from archive.tar. o tar -czf archive.tar.gz directory name # Create a gzip compressed tar file name archive.tar.gz. o tar -xzf archive_name.tar.gz # Extract a gzip compressed tar file.
  • 10. Directory Navigation: - o cd .. # To go up one level of the directory tree. (Change into the parent directory.) o cd # Go to the $HOME directory o cd /etc # Change to the /etc directory o cd - # go back to previous directory (last accessed directory)
  • 11. Process management: - o ps #your currently running processes o ps –ef #all the currently running processes on the system o ps- -ef |grep processname #process information for process name o kill pid #kill a process o top #display and manage the top processes o killall processname #kill all processes named there o program & #start program in the background o bg #display stopped or background processes o fg #bring the most recent background job to foreground
  • 12. Networking: - o ifconfig #Displays network interface and ip address o ping #to check given address is alive or not o dig domain_name #display DNS information for domain o dig –x IP_Address #Reverse lookup of IP_Address o host domain #display DNS IP address for domain o hostname #display the hostname [2018-01-01 19:06.49] ~ [SAGAR.workgroup] ➤ hostname workgroup o netstat #Display listening tcp and udp ports and corresponding programs – [SAGAR.workgroup] ➤ netstat – Active Connections – Proto Local Address Foreign Address State – TCP 10.10.156.9:4280 hk2sch130022025:https ESTABLISHED – TCP 10.10.156.9:4294 sb-in-f188:5228 ESTABLISHED – TCP 10.10.156.9:6010 static:https ESTABLISHED – TCP 10.10.156.9:9327 static:https ESTABLISHED – TCP 10.10.156.9:9635 13.75.42.223:https TIME_WAIT
  • 13. FileTransfers: - o scp file.txt server:/tmp # Secure copy file.txt to the /tmp folder on server o scp server:/var/www/*.html /tmp # Copy *.html files from server to the local /tmp folder. o scp -r server:/var/www /tmp # Copy all files and directories recursively from server to the current system's /tmp folder.
  • 14. Search: - o grep “pattern” file # Search for pattern in file o grep -r “pattern” directory # Search recursively for pattern in directory o locate name # Find files and directories by name o find /home/Sagar -name 'prefix*’ # Find files in /home/Sagar that start with "prefix". o find /home -size +250M # Find files larger than 250MB in /home
  • 15. Movement within a file: - o h, j, k ,l #left, down, up o $ #to end of a line o ^ #to the beginning of a line o G #end of a file o :1 #to the beginning of a file o :47 #to the given line (here on 47th line)
  • 16. File Editing: - o Most common editor in Linux  vi editor o Commands for editing files in vi editor o vi filename # to open file in editor (Command mode) o Press “i” # to go in INSERT mode o double esc # moving to command mode o :w #to save changes o :q #to exit o :q! #force exit o :wq #save changes and exit
  • 17. File Editing (contd…): - o dd #remove a line o 5dd #remove 5 lines o u #undo last action o :s/string #searching a string in file o :s/string/replace #search and replace a string in current line o :%s/string/replace #search and replace a string in whole file o :%s/string/replace/i #search and replace a string in whole file(Case Insensitive)
  • 18. Disk usages: - o df –h # Show free and used space on mounted filesystems o df –I # Show free and used inodes on mounted filesystems o fdisk –l # Display disks partitions sizes and types o du –ah # Display disk usage for all files and directories in human readable format o du –sh # Display total disk usage off the current directory