SlideShare ist ein Scribd-Unternehmen logo
1 von 31
Welco
me to
TechGurukul
Learn Linux Series:
dwivedishashwat@gmai
Administrating Linux : Admin Commands
1. Curl: :
We can test this command to test any application endpoint connectivity. This is very
useful for determining if our application can reach any another services, such as a
database, Webserver, or checking if our service is healthy
Examples:
curl -I –s application:8800
output shows 200 it means application/web able to connect and it healthy and
running
There are many command line parameters for various option you can get
those details using “curl –help”
Curl Command
1. Grep:
Grep command is very useful in searching string pattern from files, we can use this
command to get errors/exceptions etc. from file.
Example:
grep error /var/log/message
cat /var/log/*.log|grep –Ei “Error|fatal”
Grep : search string from files
1. Ps:
This command is used to fetch information related various process runnin, we can use
this command to check status, process id, user etc related to process. Suppose if we
need to check if a process is running or not we can use this command. It basically
report a snapshot of the current processes running.
Example:
ps –ef : see every process on the system
ps –ejH --or-- ps axjf : print process tree with parent and child process
ps –eLf –or-- ps axms : get info about threads
for more info please use “man ps” or “info ps” or “ps –help”
Ps
1. Top:
This command is just like ps command but more like windows task manager which display Linux
processes in tabular format as displayed in above image. It basically displays and updates sorted
process information.
This can be used to determine which processes are running and how much memory and CPU they
consume.
Examples:
 execute top command and press M and then T to sort processes by process ID
 execute top command and press M and then T to sort processes by memory and cpu
 execute top command and press M and then T to sort processes running by time
 top –u Shashwat : will display process by user Shashwat
 Press c in top to see the absolute path of the processes
 Press r in top to change scheduling priority of a process
2. free –h: it displays total, used, and free system memory
3. cat /proc/meminfo : every information about mermoyr intalled
4. cat /proc/cpuinfo: every information about cpu installed
top
 Press 1 in top to see all the cpu cores and uses
 top –n 1 –b > topoutput.txt : this will write output of top command to a file
Press Shift+P to see the output by cup utilization
Press i to see list or idle processes
 top –n 10 : this will open top and quit after 10 repeatation(it refreses at a
interval)
Press h inside top to get other helps
top
1. Env:
env allows us to set or print the environment variables. During troubleshooting, we
may find it useful for checking if the wrong environment variable prevents our
application from starting.
Examples:
unset variable_name : this will unset or remove a environment variable
env : this will display list of environment variable currently assigned for current
users.
Export variable_name=value: using this command you can add an entry to
environment variable
env
1. Netstat: Network statistics
This command shows the network status. This command shows network ports in use and their
incoming connections. This is very useful in troubleshooting issues related to port already
being used, number of connection to a ip/port.
Example:
netstat –a : this will display all connections
netstat –at : this will display all only tcp connections
netstat –ut : this will display udp connections
netstat –l : this will show all listening connections, application is up running and
listening on a port
netstat –lx : this will show all linux based process listning on a port
netstat –ap: list all connection with process id
netstat –ntlp: display all service name with pid and uid
netstat –s : displays by protocol statistics for the UDP, TCP, ICMP, and IP protocols.
netstat –i : display network adapter status
netstat –r : will display routing table use –ie for extended info
netstat
1. Dig (DNS lookup utility) / nslookup(query Internet name servers interactively):
this is very useful in troubleshooting dns mapping which meand if ip<->dns name is
mapped correctly or not. It is used for verifying and troubleshooting DNS problems
and to perform DNS lookups. Dig command replaces older tools such as nslookup
and the host.
Example:
dig www.google.com
nslookup www.google.com
nslookup -type=ns www.google.com : shows name server records
nslookup -query=mx google.com :mx records for mail server
nslookup –debug: run in debug mode with lot of details
2. Dig is a big advance version of nslookup and host so these three commands dig,
nslookup and host can be used inter-changably
dig / nslookup
1. lsof:
This command is list of open files. An open file may be a regular file, a directory, a block
special file, a character special file, an executing text reference, a library, a stream or a
network file (Internet socket, NFS file or UNIX domain socket.) it shows all open files and the
process name opened it or using it.
Examples:
lsof : this will list down all the open files.
lsof –u Shashwat : this will display all files open by user Shashwat
lsof –i TCP:22 : this will display running on specific port
lsof –I TCP:1-1100: this will display process using port between 1 and 1100
lsof –I –u Shashwat : this will show user Shashwat is looking on which file or
which command
lsof –I : this will list all network connections
lsof –p <pid> : list all open files by process belonging to <pid>
kill -9 `lsof –t –u Shashwat` : this will kill all process of user Shashwat
lsof
1. There are many options to find out information about the linux distribution you are
working on here are some of them.
1. cat /etc/os-release
2. Hostnamectl
3. uname -a
Finding out Linux distro from command line
1. df:
This command display free disk space. This is very useful command to troubleshoot
disk related issues.
Example:
df –h : display disk inform in human readable form
df –a : Include in the listing dummy, duplicate, or inaccessible file systems,
which are omitted by default
df –I : List inode usage information instead of block usage, data structure in a
Unix-style file system that describes a file-system object such as a file or a
directory.
df --si : Append an SI-style abbreviation to each size like GB, MB, KB
df -T or df --print-type : this will pring type of file system for each partitions.
df
1. du:
This means disk utilization, this display file size in the current directory if no path has
specified. This displays detailed information about which files use the disk space in a
directory.
Example:
du –h: this will display disk uses by files and directories in human readable
format
du –s: this displays summery of dises all file and directory on path provided
du --time : this will display uses and last modified time
du --one-file-system /var or du -x /var : Skip directories on different filesystems*
du -ahx --max-depth=1 /var : this will display maximum to 1 level up
du -ahx --max-depth=1 /var | sort -k1 –rh : get file size sorted by uses
du
1. id:
print real and effective user and group IDs, this can be useful in checking which user
we are what groups we belongs to and if we thing from group we are part of can not
perform some command then we can switch required user using su(switch user)
id: this will display userid, groupid and the groups current user belongs to.
id
1. chmod:
this can be used to correct the permission of a file or directory, define
accessibility(readability, writability and executability) of a file or a directory. Basically,
permission based on user:group:others, basically it changes the access permissions
of the named files.
Note: never changes the permissions of symbolic links
Example:
chmod -c --or-- chmod --changes: this will display what chanes were made to a
file.
chmod --reference=REF_FILE : this will change permission of file same as
REF_FILE
chmod –R or chmod –recursive : this will change the permission recursively
chmod
1. chown:
change file owner and group.
Example:
chown [OPTION]... [OWNER][:[GROUP]] FILE...
chown [OPTION]... --reference=RFILE FILE...
chown Shashwat:Shashwat test: this will change the test file owner and group
to Shashwat
chown –v : changes the ownership and display in verbose mode
chmod --from=CURRENT_OWNER:CURRENT_GROUP : this will matches the
provided owner referenced and only change ownership if it matches.
chown --reference=RFILE : change the ownership as referenced file
chown –R : change the permission recursively
chown
1. touch:
change file timestamps. Update the access and modification times of each FILE to the
current time
Example:
touch -a(change access time) –m(change modification time) –t(use time stamp
instead of current time)
2. Type touch –help : for more options
touch
1. stat:
This display file or file system status.
Example:
stats <filename> : this will display very detailed information about a file as following:
stat
1. history:
show the history of all command executed.
Example:
history: will display all the command executed by current user over the time
history 10: this will display last 10 command from history.
!#: hash represent number, this will execute number given from history entries
!4 : run entry number 4 from history
sudo !! : run the most recent command which ran, last command from history
!sudo su : this will run most recent command containing sudo su
history|grep text: search text from history entries
newcommand !$ : this will run a new command with parameter in last command
from history
history –c: clearup the history
history
1. uptime:
show the system uptime starting from a specific time. It displays the current time, how
long the system has been running, how many users are currently logged on, and the
system load averages for the past.
Example:
uptime –p: show uptime in pretty format
uptime –s : system up since, in yyyy-mm-dd HH:MM:SS format
uptime
1. users:
print the usernames of users currently logged in to the current host.
2. w:
Show who is logged on and what they are doing
3. who:
show who is logged on
1. tar:
use to archive file to a compressed format. This can be used to compress file and
save space.
Example:
tar –cvzf compressedfilename.tar.gz <list of files> : create compressed file out or list
of files specified.
tar –xvzf compressedfilename.tar.gz : uncompress the file to normal files out or
archive
tar
1. Ssh:
using this we can connect remotely to other
ssh enabled system and work as if we are
on that system itself.
Ssh user@hostname
2. rsync:
a fast, versatile, remote (and local) file-
copying tool
Example:
Pull: rsync [OPTION...]
[USER@]HOST:SRC... [DEST]
Push: rsync [OPTION...] SRC...
[USER@]HOST:DEST
3. scp:
OpenSSH secure file copy, secure remote
file copy
scp [OPTION] [user@]SRC_HOST:]file1
[user@]DEST_HOST:]file2
4. ftp:
connect to remote ftp system
5. sftp:
OpenSSH secure file transfer, its like secure
ftp file copy
6. telnet: used to connect to telnet to remote
server on specific port, great to check
connectivity
7. Nc: Netcat is a utility that reads and writes
data across network connections, using the
TCP or UDP protocol also can be used to
check connectivity.
8. Note: Unlike SCP , which supports only file
transfers, the SFTP allows you to perform a
range of operations on remote files and
resume file transfers.a
1. ss:
This command is used to dump socket statistics, similar to the legacy netstat utility. To
include both listening and non-listening sockets use -t and -a flags
2. netstat:
This command like ss but old version which print network connections, routing tables,
interface statistics, masquerade connections, and multicast memberships
3. Ip:
show / manipulate routing, network devices, interfaces and tunnels
1. find:
search for files in a directory hierarchy, this command is very userful in searching any
file on linux box. This Use it to search for files based on filenames, permissions,
userid, groupid, size, file type, besides other criteria.
Example:
find / -iname text : this will search file name text in /
find . -name a.txt : search for a.txt file
find . -type d : this will search all directories
find . -type d : this will search for all files
find . -size +20M : find files larger than 20MB
2. Play with this command there are many options
1. systemctl:
Control the systemd system and service manager. The systemctl command manages
both system and service configurations, enabling administrators to manage the OS
and control the status of services. Further, systemctl is useful for troubleshooting and
basic performance tuning.
Example:
systemctl restart/stop/start/mask/enable/disable {servicename} :
restart/stop/start/stop/enable/disable service from starting systemctl reboot :
reboot system
systemctl list-units --type=service : displays status of all services
systemctl list-units --type=service --state=active : list services which are active
systemctl list-units –failed : list failed services
systemctl is-active/is-enabled servicename : check if a service is active or a
service is enabled
1. crontab:
maintain crontab files for individual users. This can be used to schedule jobs to run
automatically and specified time interval, this is very useful in scheduling jobs or
scripts.
Example:
crontab –e : this will opne crontab in default editor where we can put entry for
scheduling a job/script
crontab –l : this will display all schedule crontab
Play and learn with crontab : https://crontab.guru/
2. at : this command also can be used to schedule scripts/jobs
Example:
at 6pm + 6 days
at 6pm + 6 days –f <script.sh> : this script will run at 6pm 6days week
1. Tracepath/traceroute: traces path to a network host discovering MTU along this path
2. hostname : Query system hostname
3. Hostnamectl Query or change system hostname
4. Route: to check routing table
1. Tracepath/traceroute: traces path to a network host discovering MTU along this path
2. hostname : Query system hostname
3. Hostnamectl Query or change system hostname
4. Route: to check routing table
Thanks For Watching
TechGurukul
Please support our
channel by just
liking Subscribing and
pressing bell icon.
dwivedishashwat@gmail.
com

Weitere ähnliche Inhalte

Ähnlich wie Learning Linux Series Administrator Commands.pptx (20)

Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals  Lesson 1 Linux System Fundamentals
Lesson 1 Linux System Fundamentals
 
Nithi
NithiNithi
Nithi
 
58518522 study-aix
58518522 study-aix58518522 study-aix
58518522 study-aix
 
Linux Cheat Sheet.pdf
Linux Cheat Sheet.pdfLinux Cheat Sheet.pdf
Linux Cheat Sheet.pdf
 
Linux ppt
Linux pptLinux ppt
Linux ppt
 
Linux
LinuxLinux
Linux
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
Using Unix Commands.pptx
Using Unix Commands.pptxUsing Unix Commands.pptx
Using Unix Commands.pptx
 
50 Most Frequently Used UNIX Linux Commands -hmftj
50 Most Frequently Used UNIX  Linux Commands -hmftj50 Most Frequently Used UNIX  Linux Commands -hmftj
50 Most Frequently Used UNIX Linux Commands -hmftj
 
Linux
LinuxLinux
Linux
 
An Introduction to Linux
An Introduction to LinuxAn Introduction to Linux
An Introduction to Linux
 
Unix
UnixUnix
Unix
 
Chapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix ConceptsChapter 2 Introduction to Unix Concepts
Chapter 2 Introduction to Unix Concepts
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Unix_QT.ppsx
Unix_QT.ppsxUnix_QT.ppsx
Unix_QT.ppsx
 
Basic unix commands_1
Basic unix commands_1Basic unix commands_1
Basic unix commands_1
 
Basic Linux day 2
Basic Linux day 2Basic Linux day 2
Basic Linux day 2
 
QSpiders - Unix Operating Systems and Commands
QSpiders - Unix Operating Systems  and CommandsQSpiders - Unix Operating Systems  and Commands
QSpiders - Unix Operating Systems and Commands
 
Linux
LinuxLinux
Linux
 
40 basic linux command
40 basic linux command40 basic linux command
40 basic linux command
 

Mehr von Shashwat Shriparv (20)

LibreOffice 7.3.pptx
LibreOffice 7.3.pptxLibreOffice 7.3.pptx
LibreOffice 7.3.pptx
 
Kerberos Architecture.pptx
Kerberos Architecture.pptxKerberos Architecture.pptx
Kerberos Architecture.pptx
 
Suspending a Process in Linux.pptx
Suspending a Process in Linux.pptxSuspending a Process in Linux.pptx
Suspending a Process in Linux.pptx
 
Kerberos Architecture.pptx
Kerberos Architecture.pptxKerberos Architecture.pptx
Kerberos Architecture.pptx
 
Command Seperators.pptx
Command Seperators.pptxCommand Seperators.pptx
Command Seperators.pptx
 
Upgrading hadoop
Upgrading hadoopUpgrading hadoop
Upgrading hadoop
 
Hadoop migration and upgradation
Hadoop migration and upgradationHadoop migration and upgradation
Hadoop migration and upgradation
 
R language introduction
R language introductionR language introduction
R language introduction
 
Hive query optimization infinity
Hive query optimization infinityHive query optimization infinity
Hive query optimization infinity
 
H base introduction & development
H base introduction & developmentH base introduction & development
H base introduction & development
 
Hbase interact with shell
Hbase interact with shellHbase interact with shell
Hbase interact with shell
 
H base development
H base developmentH base development
H base development
 
Hbase
HbaseHbase
Hbase
 
H base
H baseH base
H base
 
My sql
My sqlMy sql
My sql
 
Apache tomcat
Apache tomcatApache tomcat
Apache tomcat
 
Linux 4 you
Linux 4 youLinux 4 you
Linux 4 you
 
Introduction to apache hadoop
Introduction to apache hadoopIntroduction to apache hadoop
Introduction to apache hadoop
 
Next generation technology
Next generation technologyNext generation technology
Next generation technology
 
Configure h base hadoop and hbase client
Configure h base hadoop and hbase clientConfigure h base hadoop and hbase client
Configure h base hadoop and hbase client
 

Kürzlich hochgeladen

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfhans926745
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 

Kürzlich hochgeladen (20)

The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 

Learning Linux Series Administrator Commands.pptx

  • 3. 1. Curl: : We can test this command to test any application endpoint connectivity. This is very useful for determining if our application can reach any another services, such as a database, Webserver, or checking if our service is healthy Examples: curl -I –s application:8800 output shows 200 it means application/web able to connect and it healthy and running There are many command line parameters for various option you can get those details using “curl –help” Curl Command
  • 4. 1. Grep: Grep command is very useful in searching string pattern from files, we can use this command to get errors/exceptions etc. from file. Example: grep error /var/log/message cat /var/log/*.log|grep –Ei “Error|fatal” Grep : search string from files
  • 5. 1. Ps: This command is used to fetch information related various process runnin, we can use this command to check status, process id, user etc related to process. Suppose if we need to check if a process is running or not we can use this command. It basically report a snapshot of the current processes running. Example: ps –ef : see every process on the system ps –ejH --or-- ps axjf : print process tree with parent and child process ps –eLf –or-- ps axms : get info about threads for more info please use “man ps” or “info ps” or “ps –help” Ps
  • 6. 1. Top: This command is just like ps command but more like windows task manager which display Linux processes in tabular format as displayed in above image. It basically displays and updates sorted process information. This can be used to determine which processes are running and how much memory and CPU they consume. Examples:  execute top command and press M and then T to sort processes by process ID  execute top command and press M and then T to sort processes by memory and cpu  execute top command and press M and then T to sort processes running by time  top –u Shashwat : will display process by user Shashwat  Press c in top to see the absolute path of the processes  Press r in top to change scheduling priority of a process 2. free –h: it displays total, used, and free system memory 3. cat /proc/meminfo : every information about mermoyr intalled 4. cat /proc/cpuinfo: every information about cpu installed top
  • 7.  Press 1 in top to see all the cpu cores and uses  top –n 1 –b > topoutput.txt : this will write output of top command to a file Press Shift+P to see the output by cup utilization Press i to see list or idle processes  top –n 10 : this will open top and quit after 10 repeatation(it refreses at a interval) Press h inside top to get other helps top
  • 8. 1. Env: env allows us to set or print the environment variables. During troubleshooting, we may find it useful for checking if the wrong environment variable prevents our application from starting. Examples: unset variable_name : this will unset or remove a environment variable env : this will display list of environment variable currently assigned for current users. Export variable_name=value: using this command you can add an entry to environment variable env
  • 9. 1. Netstat: Network statistics This command shows the network status. This command shows network ports in use and their incoming connections. This is very useful in troubleshooting issues related to port already being used, number of connection to a ip/port. Example: netstat –a : this will display all connections netstat –at : this will display all only tcp connections netstat –ut : this will display udp connections netstat –l : this will show all listening connections, application is up running and listening on a port netstat –lx : this will show all linux based process listning on a port netstat –ap: list all connection with process id netstat –ntlp: display all service name with pid and uid netstat –s : displays by protocol statistics for the UDP, TCP, ICMP, and IP protocols. netstat –i : display network adapter status netstat –r : will display routing table use –ie for extended info netstat
  • 10. 1. Dig (DNS lookup utility) / nslookup(query Internet name servers interactively): this is very useful in troubleshooting dns mapping which meand if ip<->dns name is mapped correctly or not. It is used for verifying and troubleshooting DNS problems and to perform DNS lookups. Dig command replaces older tools such as nslookup and the host. Example: dig www.google.com nslookup www.google.com nslookup -type=ns www.google.com : shows name server records nslookup -query=mx google.com :mx records for mail server nslookup –debug: run in debug mode with lot of details 2. Dig is a big advance version of nslookup and host so these three commands dig, nslookup and host can be used inter-changably dig / nslookup
  • 11. 1. lsof: This command is list of open files. An open file may be a regular file, a directory, a block special file, a character special file, an executing text reference, a library, a stream or a network file (Internet socket, NFS file or UNIX domain socket.) it shows all open files and the process name opened it or using it. Examples: lsof : this will list down all the open files. lsof –u Shashwat : this will display all files open by user Shashwat lsof –i TCP:22 : this will display running on specific port lsof –I TCP:1-1100: this will display process using port between 1 and 1100 lsof –I –u Shashwat : this will show user Shashwat is looking on which file or which command lsof –I : this will list all network connections lsof –p <pid> : list all open files by process belonging to <pid> kill -9 `lsof –t –u Shashwat` : this will kill all process of user Shashwat lsof
  • 12. 1. There are many options to find out information about the linux distribution you are working on here are some of them. 1. cat /etc/os-release 2. Hostnamectl 3. uname -a Finding out Linux distro from command line
  • 13. 1. df: This command display free disk space. This is very useful command to troubleshoot disk related issues. Example: df –h : display disk inform in human readable form df –a : Include in the listing dummy, duplicate, or inaccessible file systems, which are omitted by default df –I : List inode usage information instead of block usage, data structure in a Unix-style file system that describes a file-system object such as a file or a directory. df --si : Append an SI-style abbreviation to each size like GB, MB, KB df -T or df --print-type : this will pring type of file system for each partitions. df
  • 14. 1. du: This means disk utilization, this display file size in the current directory if no path has specified. This displays detailed information about which files use the disk space in a directory. Example: du –h: this will display disk uses by files and directories in human readable format du –s: this displays summery of dises all file and directory on path provided du --time : this will display uses and last modified time du --one-file-system /var or du -x /var : Skip directories on different filesystems* du -ahx --max-depth=1 /var : this will display maximum to 1 level up du -ahx --max-depth=1 /var | sort -k1 –rh : get file size sorted by uses du
  • 15. 1. id: print real and effective user and group IDs, this can be useful in checking which user we are what groups we belongs to and if we thing from group we are part of can not perform some command then we can switch required user using su(switch user) id: this will display userid, groupid and the groups current user belongs to. id
  • 16. 1. chmod: this can be used to correct the permission of a file or directory, define accessibility(readability, writability and executability) of a file or a directory. Basically, permission based on user:group:others, basically it changes the access permissions of the named files. Note: never changes the permissions of symbolic links Example: chmod -c --or-- chmod --changes: this will display what chanes were made to a file. chmod --reference=REF_FILE : this will change permission of file same as REF_FILE chmod –R or chmod –recursive : this will change the permission recursively chmod
  • 17. 1. chown: change file owner and group. Example: chown [OPTION]... [OWNER][:[GROUP]] FILE... chown [OPTION]... --reference=RFILE FILE... chown Shashwat:Shashwat test: this will change the test file owner and group to Shashwat chown –v : changes the ownership and display in verbose mode chmod --from=CURRENT_OWNER:CURRENT_GROUP : this will matches the provided owner referenced and only change ownership if it matches. chown --reference=RFILE : change the ownership as referenced file chown –R : change the permission recursively chown
  • 18. 1. touch: change file timestamps. Update the access and modification times of each FILE to the current time Example: touch -a(change access time) –m(change modification time) –t(use time stamp instead of current time) 2. Type touch –help : for more options touch
  • 19. 1. stat: This display file or file system status. Example: stats <filename> : this will display very detailed information about a file as following: stat
  • 20. 1. history: show the history of all command executed. Example: history: will display all the command executed by current user over the time history 10: this will display last 10 command from history. !#: hash represent number, this will execute number given from history entries !4 : run entry number 4 from history sudo !! : run the most recent command which ran, last command from history !sudo su : this will run most recent command containing sudo su history|grep text: search text from history entries newcommand !$ : this will run a new command with parameter in last command from history history –c: clearup the history history
  • 21. 1. uptime: show the system uptime starting from a specific time. It displays the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past. Example: uptime –p: show uptime in pretty format uptime –s : system up since, in yyyy-mm-dd HH:MM:SS format uptime
  • 22. 1. users: print the usernames of users currently logged in to the current host. 2. w: Show who is logged on and what they are doing 3. who: show who is logged on
  • 23. 1. tar: use to archive file to a compressed format. This can be used to compress file and save space. Example: tar –cvzf compressedfilename.tar.gz <list of files> : create compressed file out or list of files specified. tar –xvzf compressedfilename.tar.gz : uncompress the file to normal files out or archive tar
  • 24. 1. Ssh: using this we can connect remotely to other ssh enabled system and work as if we are on that system itself. Ssh user@hostname 2. rsync: a fast, versatile, remote (and local) file- copying tool Example: Pull: rsync [OPTION...] [USER@]HOST:SRC... [DEST] Push: rsync [OPTION...] SRC... [USER@]HOST:DEST 3. scp: OpenSSH secure file copy, secure remote file copy scp [OPTION] [user@]SRC_HOST:]file1 [user@]DEST_HOST:]file2 4. ftp: connect to remote ftp system 5. sftp: OpenSSH secure file transfer, its like secure ftp file copy 6. telnet: used to connect to telnet to remote server on specific port, great to check connectivity 7. Nc: Netcat is a utility that reads and writes data across network connections, using the TCP or UDP protocol also can be used to check connectivity. 8. Note: Unlike SCP , which supports only file transfers, the SFTP allows you to perform a range of operations on remote files and resume file transfers.a
  • 25. 1. ss: This command is used to dump socket statistics, similar to the legacy netstat utility. To include both listening and non-listening sockets use -t and -a flags 2. netstat: This command like ss but old version which print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships 3. Ip: show / manipulate routing, network devices, interfaces and tunnels
  • 26. 1. find: search for files in a directory hierarchy, this command is very userful in searching any file on linux box. This Use it to search for files based on filenames, permissions, userid, groupid, size, file type, besides other criteria. Example: find / -iname text : this will search file name text in / find . -name a.txt : search for a.txt file find . -type d : this will search all directories find . -type d : this will search for all files find . -size +20M : find files larger than 20MB 2. Play with this command there are many options
  • 27. 1. systemctl: Control the systemd system and service manager. The systemctl command manages both system and service configurations, enabling administrators to manage the OS and control the status of services. Further, systemctl is useful for troubleshooting and basic performance tuning. Example: systemctl restart/stop/start/mask/enable/disable {servicename} : restart/stop/start/stop/enable/disable service from starting systemctl reboot : reboot system systemctl list-units --type=service : displays status of all services systemctl list-units --type=service --state=active : list services which are active systemctl list-units –failed : list failed services systemctl is-active/is-enabled servicename : check if a service is active or a service is enabled
  • 28. 1. crontab: maintain crontab files for individual users. This can be used to schedule jobs to run automatically and specified time interval, this is very useful in scheduling jobs or scripts. Example: crontab –e : this will opne crontab in default editor where we can put entry for scheduling a job/script crontab –l : this will display all schedule crontab Play and learn with crontab : https://crontab.guru/ 2. at : this command also can be used to schedule scripts/jobs Example: at 6pm + 6 days at 6pm + 6 days –f <script.sh> : this script will run at 6pm 6days week
  • 29. 1. Tracepath/traceroute: traces path to a network host discovering MTU along this path 2. hostname : Query system hostname 3. Hostnamectl Query or change system hostname 4. Route: to check routing table
  • 30. 1. Tracepath/traceroute: traces path to a network host discovering MTU along this path 2. hostname : Query system hostname 3. Hostnamectl Query or change system hostname 4. Route: to check routing table
  • 31. Thanks For Watching TechGurukul Please support our channel by just liking Subscribing and pressing bell icon. dwivedishashwat@gmail. com