SlideShare uma empresa Scribd logo
1 de 15
Baixar para ler offline
Linux Basic Administration Commands
i | P a g e
Table of Contents
Overview.......................................................................................................................................................1
Applies To......................................................................................................................................................1
Init Levels or Run levels.................................................................................................................................1
Init Levels Table.........................................................................................................................................1
chkconfig.......................................................................................................................................................1
chmod ...........................................................................................................................................................2
chown............................................................................................................................................................2
crontab..........................................................................................................................................................3
df ...................................................................................................................................................................3
du ..................................................................................................................................................................3
free................................................................................................................................................................4
fdisk...............................................................................................................................................................4
groupadd.......................................................................................................................................................5
groupdel........................................................................................................................................................5
ifconfig ..........................................................................................................................................................5
ifup................................................................................................................................................................6
grep...............................................................................................................................................................6
find................................................................................................................................................................7
kill..................................................................................................................................................................7
passwd ..........................................................................................................................................................8
pidof..............................................................................................................................................................8
tail .................................................................................................................................................................8
tar..................................................................................................................................................................9
zip..................................................................................................................................................................9
unzip............................................................................................................................................................10
gzip..............................................................................................................................................................10
gunzip..........................................................................................................................................................10
top...............................................................................................................................................................11
touch...........................................................................................................................................................11
useradd .......................................................................................................................................................12
userdel ........................................................................................................................................................12
Linux Basic Administration Commands
ii | P a g e
mount..........................................................................................................................................................12
umount........................................................................................................................................................13
Linux Basic Administration Commands
1 | P a g e
Overview
In this guide you will be able to manage Linux system with basic administration task.
For additional and command usage information on the specific command(s); you can run “man
<command>”.
Note: Not all the parameters are explained in this document.
Applies To
Linux flavours
Init Levels or Run levels
A run level is a state of init (initialization) and the whole system that defines what system services are
operating. Run numbers identifies levels;
There is no consensus of how to use the user defined run levels (2 through 5).
Some system administrators use run levels to define which subsystems are working, e.g., whether X is
running, whether the network is operational, and so on.
Others have all subsystems always running or start and stop them individually, without changing run
levels, since run levels are too coarse for controlling their systems.
Depending on your administration needs, define the run level based on the below.
Init Levels Table
Run Level Operation (Purpose)
0 Halt System
1 Single-user mode (Recovery / special Administration)
2 By Default - Not used (user-definable)
3 By Default - Full (multi-user mode)
4 By Default - Not used (user-definable)
5 Full multi-user mode (with an X-based login screen)
6 Reboot
chkconfig
chkconfig is a basic system utility. It updates and queries run level information for system services,
manages which service(s) will start or stop automatically in a specified run levels.
chkconfig: options
--add Add an new service
--del Delete an existing service
Linux Basic Administration Commands
2 | P a g e
--level numbers, 0- 6: Update init levels
--list List Services that are added
Syntax:
chkconfig --add <service Name>
Example:
chkconfig --add httpd
chkconfig --levels 345 httpd on
chmod
chmod changes the permissions for a file; permissions should include a letter designating who gets
permissions (u for the user, g for the group, o for others, or a for all) followed by a + or - (to give or take
away the permission) followed by the kind of permission (r for read access, w for write access, x for
execute if the file is a program or script).
chmod: options
-f Silent Mode
-R Recursive
4 or “r” Read Privilege(s)
2 or “w” Write Privilege(s)
1 or “x” Execute Privilege(s)
Syntax:
chmod +x <FileName>
chmod -w <FileName>
Example:
chmod +x run.sh
chmod -x run.sh
chown
chown changes the user and/or group ownership of each given file as specified by the first non-option
argument, changes the ownership of one or more files to new owner.
chown: options
-f Silent Mode
-h Including symbolic links
-R Recursive
Syntax:
chown -fhR <UserID>:<GroupID> <FileName>
Linux Basic Administration Commands
3 | P a g e
Example:
chown -fh jboss:jboss run.sh
crontab
A short name for file /var/lib/crontab, which contains a list of Linux commands to be performed at specific
times. A system administrator can use crontab as an automatic timer to trigger the initiation of important
jobs.
To view, install, or uninstall your current crontab file.
crontab: options
-e Edit crontab entry of existing logged in user
-l List crontab entry of existing logged in user
-r Delete all the entries in crontab file
Syntax:
crontab <option>
Example:
crontab -e
crontab -l
df
df reports the amount of disk space used by the specified files, and by each directory in the hierarchies
rooted at the specified files.
df: options
-k block size will be 1K size
-h Human readable
Syntax:
df <option> <Partition>
Example:
df -kh
du
Print disk usage (as the number of 1 KB blocks used by each named directory and its
subdirectories; default is the current directory).
du: options
Linux Basic Administration Commands
4 | P a g e
-k block size will be 1K size
-h Human readable
-b Bytes
-c Calculate or sum
Syntax:
du -<Option> <FileName>
Example:
du -kh
free
Display statistics about memory usage: total free, used, physical, swap, shared, and buffers used
by the kernel.
free: options
-b Memory usage in Bytes
-k Block size will be 1K size
-m Memory usage in Megabytes
-g Memory usage in Gigabytes
Syntax:
free -<option>
Example:
free -km
fdisk
Is a menu driven program for creation and manipulation of partition tables.
fdisk: options
-l Listing of existing drive partitions.
-s Listing of existing drive partitions size.
-v fdisk version number.
Syntax:
fdisk -<option>
Example:
fdisk -l
Linux Basic Administration Commands
5 | P a g e
groupadd
Create new group of accounts for the system.
-g Assign Group ID
-f Add to group forcefully
Syntax:
groupadd -<option> <GroupName>
Example:
groupadd -g 500 oracle
groupdel
Remove group from system account files
Syntax:
groupdel <GroupName>
Example:
groupdel oracle
ifconfig
Assign an address to a network interface and/or configure network interface parameters.
ifconfig: option
-a Display all the interface details
-v Verbose mode interface details
up Activate specified interface
down Shutdown the specified interface
Syntax:
ifconfig -<option> <Network Interface>
Example:
ifconfig -a
ifconfig eth0
ifconfig eth0 up
ifconfig eth0 down
Linux Basic Administration Commands
6 | P a g e
ifup
Enable network interface
ifup: option
-a Bring up all the interfaces that are defined in /etc/network interfaces
-f Force configuration of the interface
--no-scripts Don’t run any scripts under /etc/network/if-*.d/
Syntax:
ifup <Interface Name>
Example:
ifup eth0
ifup -a
ifdown
Disable network interface
ifdown: option
-a Bring down all the interfaces that are defined in /etc/network interfaces
-f Force configuration of the interface
--no-scripts Don’t run any scripts under /etc/network/if-*.d/
Syntax:
ifdown <Interface Name>
Example:
ifdown eth0
ifdown -a
grep
grep searches the named input FILEs (or standard input if no files are named, or the file name -
is given) for lines containing a match to the given PATTERN. By default, grep prints the matching
lines.
grep: option
-c Count matching lines
-r Recursive search
-l Displays count that doesn’t match the search criteria
Linux Basic Administration Commands
7 | P a g e
Syntax:
grep <search string> <File Name>
Example:
grep vcp.muthukrishna /etc/password
grep -r "SearchString" /var/www/
grep -cw "SearchString" SearchFile.txt
grep -cvw "Search" SearchFile.txt
grep -l " SearchString" /www/*
find
Find locates files. Within each directory tree specified by the given paths, it evaluates the given expression
from left to right, according to the rules of precedence.
find: option
-print Prints the results
-name Find string
Syntax:
Find <SearchPath> -<option>
Example:
find . -name "java" -print
find . -name "Java" -H -print
kill
Send a signal to terminate one or more process IDs.
kill: option
-9 Kills process
-l Lists all possible process IDs
Syntax:
kill -<option> <Process ID>
Example:
kill –a gcc
Linux Basic Administration Commands
8 | P a g e
kill -9 13445
kill -l 1234
passwd
Change / update the password of a user or logged in user.
passwd: option
-S Status of the password set
-d Deletes set password, passwordless user
Syntax:
passwd -<option> <UserName>
Example:
passwd vcp.muthukrishna
password -S vcp.muthukrishna
password -d vcp.muthukrishna
pidof
Display the process IDs of the listed program or program.
pidof: option
-s Single shot - this instructs the program to only return one pid
Syntax:
pidof -<option> Process ID
Example:
pidof -s gdm-binary
pidof pickup
tail
Print the last 10 lines of each named file
tail: option
-f Real time file print on console
-n Number of lies to print
Syntax:
Linux Basic Administration Commands
9 | P a g e
tail -<option> <FileName>
Example:
tail -f server.log
tail –n20
tar
Copy files to or restore files from an archive medium
tar: option
-c Create an archive file
-v Verbose mode enable
-x Extract an archive file
-z Extract gunzip, gzip
-t List the files in the archive
Syntax:
tar -<option> <TarFileName>
Example:
tar -cf ArchiveFileName.tar file1 fileN
tar -cf ArchiveFileName.tar Directory/
tar -czf ArchiveFileName.tar Directory/
tar -tvf ArchiveFileName.tar
tar -xvf httpd.tar
tar -zxvf httpd.tar.gz
zip
Create a compression file.
zip: option
-R Recursive
-v Verbose mode enable
-u Update existing compression file
Syntax:
zip -R <ZipFileName> <Include FileNames>
Example:
Linux Basic Administration Commands
10 | P a g e
zip -R ZipFileName.zip *.*
zip -u ZipFileName.zip AddFileName.txt
unzip
Explodes / Extracts a compression file.
zip: option
-d Folder location where the file should be exploded
-t Test archive file
-v Verbose mode enable
Syntax:
unzip -<option> <ZipFileName>
Example:
unzip -d /usr/local/Destination_Directory ZipFileName.zip
gzip
Compress a gzip file (Compression utility like zip).
gzip: option
-v Verbose mode enable
-r Recursive
Syntax:
gzip -<option> <gzipFileName>
Example:
gzip GzipFileName.gz *.*
gzip -f GzipFileName.gz *.*
gzip TarFile.tar
gunzip
Explodes / extracts a compressed gzip file.
guzip: option
-v Verbose mode enable
-r Recursive
Linux Basic Administration Commands
11 | P a g e
Syntax:
guzip -<option> <gzipFileName>
Example:
gunzip GunzipFileName.gz
gunzip -R GunzipFileName.gz
top
Provide information (frequently refreshed) about the most CPU-intensive processes currently
running.
top: option
-u Show top info for a user
-p Show top info for a PID
-d Set delay (refresh)
Syntax:
top -<option>
Example:
top -u jboss
top -p10078
touch
Update the access time and modification time (and dates) to the current time and date.
touch: option
-c No create, if file doesn’t exists
-a Change access time only
Syntax:
top -<option> <FileName>
Example:
touch FileName.txt
touch -c FileName.ear
Linux Basic Administration Commands
12 | P a g e
useradd
Create new user accounts or update default account information.
useradd: option
-g group id of a the user
-d Location of home directory for user
-f Inactive user
-s Set Shell for the user
-k Skeleton directory
Syntax:
useradd -<option> <UserName>
Example:
useradd -g 500 jboss
useradd -s /bin/bash -g 500 jboss
useradd -s /bin/bash -g 500 jboss -d /usr/local/jboss
userdel
Delete all entries for user in system account files
userdel: option
-r Remove home directory and files of the user
-f Force Remove
Syntax:
userdel -<option> <UserName>
Example:
userdel -r jboss
userdel -f jboss
mount
Mounts a device on a location.
mount: option
-t Type of filesystem to be mounted
-a Mount all filesystem listed in /etc/fstab
Linux Basic Administration Commands
13 | P a g e
-l List mounts label
-n unmounts without writing to /etc/fstab
-v Verbose
Syntax:
mount -<option> <Device> <Mount point>
Example:
mount -t ext3 /dev/hdc1 /mnt/Linux2
mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom
mount /dev/cdrom/ /mnt/cdrom
mount -o loop disk1.iso /mnt/isoDisk
Note: /mnt/cdrom and /mnt/Linux2 should be already existing directory. Never mount on
existing file system. You will lose the existing mount locations, you’ve to explicitly reboot to see
the mount points again.
umount
Unmount’s a device that is mounted
mount: option
-n unmounts without writing to /etc/fstab
-v Verbose
-f Force Unmount
Syntax:
umount -<option> <Mount point>
Example:
umount /mnt/Linux2
umount /mnt/cdrom

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

How To Install and Use ABRT CLI on RHEL 7
How To Install and Use ABRT CLI on RHEL 7How To Install and Use ABRT CLI on RHEL 7
How To Install and Use ABRT CLI on RHEL 7
 
How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7How To Protect SSH Access with Fail2Ban on RHEL 7
How To Protect SSH Access with Fail2Ban on RHEL 7
 
How To Install CentOS 7
How To Install CentOS 7How To Install CentOS 7
How To Install CentOS 7
 
How To Audit Server Login and Shutdown or Reboot Activity
How To Audit Server Login and Shutdown or Reboot ActivityHow To Audit Server Login and Shutdown or Reboot Activity
How To Audit Server Login and Shutdown or Reboot Activity
 
Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7Configure Run Levels RHEL 7 or CentOS 7
Configure Run Levels RHEL 7 or CentOS 7
 
How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7How to Manage journalctl Logging System on RHEL 7
How to Manage journalctl Logging System on RHEL 7
 
How To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWSHow To Configure Apache VirtualHost on RHEL 7 on AWS
How To Configure Apache VirtualHost on RHEL 7 on AWS
 
How to installation and configure apache2
How to installation and configure apache2How to installation and configure apache2
How to installation and configure apache2
 
How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7How To Install OpenFire in CentOS 7
How To Install OpenFire in CentOS 7
 
How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7How to Install Configure and Use sysstat utils on RHEL 7
How to Install Configure and Use sysstat utils on RHEL 7
 
How To Manage Linux User on RHEL 7
How To Manage Linux User on RHEL 7How To Manage Linux User on RHEL 7
How To Manage Linux User on RHEL 7
 
How To Install and Configure Chrony on RHEL 7
How To Install and Configure Chrony on RHEL 7How To Install and Configure Chrony on RHEL 7
How To Install and Configure Chrony on RHEL 7
 
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
How To Install and Configure Log Rotation on RHEL 7 or CentOS 7
 
How To Configure VNC Server on CentOS 7
How To Configure VNC Server on CentOS 7How To Configure VNC Server on CentOS 7
How To Configure VNC Server on CentOS 7
 
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
How To Install and Configure VSFTPD on RHEL 7 or CentOS 7
 
How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7How To Install and Configure GNome on CentOS 7
How To Install and Configure GNome on CentOS 7
 
How to Install MariaDB Server or MySQL Server on CentOS 7
How to Install MariaDB Server or MySQL Server on CentOS 7How to Install MariaDB Server or MySQL Server on CentOS 7
How to Install MariaDB Server or MySQL Server on CentOS 7
 
Installation CentOS 6.3
Installation CentOS 6.3Installation CentOS 6.3
Installation CentOS 6.3
 
How To Configure Amazon EC2 Load Balancer
How To Configure Amazon EC2 Load BalancerHow To Configure Amazon EC2 Load Balancer
How To Configure Amazon EC2 Load Balancer
 
How To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on UbuntuHow To Install and Configure Open SSH Server on Ubuntu
How To Install and Configure Open SSH Server on Ubuntu
 

Destaque

Destaque (15)

Batch script for nslookup range of ip address
Batch script for nslookup range of ip addressBatch script for nslookup range of ip address
Batch script for nslookup range of ip address
 
How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7How To Configure FirewallD on RHEL 7 or CentOS 7
How To Configure FirewallD on RHEL 7 or CentOS 7
 
How To Add DVD ISO to YUM Repository in CentOS 6
How To Add DVD ISO to YUM Repository in CentOS 6How To Add DVD ISO to YUM Repository in CentOS 6
How To Add DVD ISO to YUM Repository in CentOS 6
 
How to install and configure firewall on ubuntu os
How to install and configure firewall on ubuntu osHow to install and configure firewall on ubuntu os
How to install and configure firewall on ubuntu os
 
DNF Failed To Open Cache
DNF Failed To Open CacheDNF Failed To Open Cache
DNF Failed To Open Cache
 
File Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell ScriptFile Space Usage Information and EMail Report - Shell Script
File Space Usage Information and EMail Report - Shell Script
 
How To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – LinuxHow To Connect Amazon AWS EC2 with Key Pair – Linux
How To Connect Amazon AWS EC2 with Key Pair – Linux
 
How To Configure Amazon EC2 Security Groups
How To Configure Amazon EC2 Security GroupsHow To Configure Amazon EC2 Security Groups
How To Configure Amazon EC2 Security Groups
 
Connect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux InstanceConnect Amazon EC2 Linux Instance
Connect Amazon EC2 Linux Instance
 
How to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP AddressHow to Configure Amazon AWS EC2 Elastic IP Address
How to Configure Amazon AWS EC2 Elastic IP Address
 
How to Install and Configure AWS CLI on RHEL 7
How to Install and Configure AWS CLI on RHEL 7How to Install and Configure AWS CLI on RHEL 7
How to Install and Configure AWS CLI on RHEL 7
 
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
How To Create EBS Snapshot and Restore EBS Snapshot – Linux InstanceHow To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
 
Bash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMailBash Script Disk Space Utilization Report and EMail
Bash Script Disk Space Utilization Report and EMail
 
How To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive ShellHow To Manage Yum Packages Interactive Shell
How To Manage Yum Packages Interactive Shell
 
Shell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address InformationShell Script to Extract IP Address, MAC Address Information
Shell Script to Extract IP Address, MAC Address Information
 

Semelhante a Linux Basic Administration Commands Guide

Monitoring CPU Utilization on LINUX (Shell Script Project)
Monitoring CPU Utilization on LINUX (Shell Script Project)Monitoring CPU Utilization on LINUX (Shell Script Project)
Monitoring CPU Utilization on LINUX (Shell Script Project)
Dmitry Ponomarenko
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
sprdd
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
sprdd
 

Semelhante a Linux Basic Administration Commands Guide (20)

Monitoring CPU Utilization on LINUX (Shell Script Project)
Monitoring CPU Utilization on LINUX (Shell Script Project)Monitoring CPU Utilization on LINUX (Shell Script Project)
Monitoring CPU Utilization on LINUX (Shell Script Project)
 
101 apend. scripting, crond, atd
101 apend. scripting, crond, atd101 apend. scripting, crond, atd
101 apend. scripting, crond, atd
 
3.1.c apend scripting, crond, atd
3.1.c apend   scripting, crond, atd3.1.c apend   scripting, crond, atd
3.1.c apend scripting, crond, atd
 
Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)Inspection and maintenance tools (Linux / OpenStack)
Inspection and maintenance tools (Linux / OpenStack)
 
Linux
LinuxLinux
Linux
 
Linux
LinuxLinux
Linux
 
Redhat 6 & 7
Redhat 6 & 7Redhat 6 & 7
Redhat 6 & 7
 
Linux
LinuxLinux
Linux
 
Cis 2903 project -202110
Cis 2903 project -202110Cis 2903 project -202110
Cis 2903 project -202110
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
 
Cgroup resource mgmt_v1
Cgroup resource mgmt_v1Cgroup resource mgmt_v1
Cgroup resource mgmt_v1
 
Linux basics
Linux basicsLinux basics
Linux basics
 
linux installation.pdf
linux installation.pdflinux installation.pdf
linux installation.pdf
 
Lab Document on HP ProLiant value add tools on Linux
Lab Document on HP ProLiant value add tools on LinuxLab Document on HP ProLiant value add tools on Linux
Lab Document on HP ProLiant value add tools on Linux
 
101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems101 4.1 create partitions and filesystems
101 4.1 create partitions and filesystems
 
Making Linux do Hard Real-time
Making Linux do Hard Real-timeMaking Linux do Hard Real-time
Making Linux do Hard Real-time
 
55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines55 best linux tips, tricks and command lines
55 best linux tips, tricks and command lines
 
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 Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compactLinux Capabilities - eng - v2.1.5, compact
Linux Capabilities - eng - v2.1.5, compact
 
Linux host review
Linux host reviewLinux host review
Linux host review
 

Mais de VCP Muthukrishna

Mais de VCP Muthukrishna (20)

How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7How to Fix Duplicate Packages in YUM on CentOS 7
How to Fix Duplicate Packages in YUM on CentOS 7
 
How To Connect to Active Directory User Validation
How To Connect to Active Directory User ValidationHow To Connect to Active Directory User Validation
How To Connect to Active Directory User Validation
 
How To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShellHow To Connect To Active Directory PowerShell
How To Connect To Active Directory PowerShell
 
How To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShellHow To List Files on Remote Server - PowerShell
How To List Files on Remote Server - PowerShell
 
How To List Files and Display In HTML Format
How To List Files and Display In HTML FormatHow To List Files and Display In HTML Format
How To List Files and Display In HTML Format
 
How To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShellHow To Check and Delete a File via PowerShell
How To Check and Delete a File via PowerShell
 
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
 
How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7How To Setup SSH Keys on CentOS 7
How To Setup SSH Keys on CentOS 7
 
Windows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive InfoWindows PowerShell Basics - How To List PSDrive Info
Windows PowerShell Basics - How To List PSDrive Info
 
How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7How To List Nginx Modules Installed / Complied on CentOS 7
How To List Nginx Modules Installed / Complied on CentOS 7
 
Windows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loopWindows PowerShell Basics – How To Create powershell for loop
Windows PowerShell Basics – How To Create powershell for loop
 
How To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional StatementsHow To Construct IF and Else Conditional Statements
How To Construct IF and Else Conditional Statements
 
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional ParameterHow To Create PowerShell Function Mandatory Parameter and Optional Parameter
How To Create PowerShell Function Mandatory Parameter and Optional Parameter
 
How To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter ValueHow To Create Power Shell Function Mandatory Parameter Value
How To Create Power Shell Function Mandatory Parameter Value
 
How To Create PowerShell Function
How To Create PowerShell FunctionHow To Create PowerShell Function
How To Create PowerShell Function
 
How To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShellHow To Disable IE Enhanced Security Windows PowerShell
How To Disable IE Enhanced Security Windows PowerShell
 
How To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShellHow To Check IE Enhanced Security Is Enabled Windows PowerShell
How To Check IE Enhanced Security Is Enabled Windows PowerShell
 
How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7How To Configure Nginx Load Balancer on CentOS 7
How To Configure Nginx Load Balancer on CentOS 7
 
Nginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failedNginx bind() to 0.0.0.0:9080 failed
Nginx bind() to 0.0.0.0:9080 failed
 
How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7How To Install and Configure Screen on CentOS 7
How To Install and Configure Screen on CentOS 7
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 

Último (20)

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
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...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 

Linux Basic Administration Commands Guide

  • 1. Linux Basic Administration Commands i | P a g e Table of Contents Overview.......................................................................................................................................................1 Applies To......................................................................................................................................................1 Init Levels or Run levels.................................................................................................................................1 Init Levels Table.........................................................................................................................................1 chkconfig.......................................................................................................................................................1 chmod ...........................................................................................................................................................2 chown............................................................................................................................................................2 crontab..........................................................................................................................................................3 df ...................................................................................................................................................................3 du ..................................................................................................................................................................3 free................................................................................................................................................................4 fdisk...............................................................................................................................................................4 groupadd.......................................................................................................................................................5 groupdel........................................................................................................................................................5 ifconfig ..........................................................................................................................................................5 ifup................................................................................................................................................................6 grep...............................................................................................................................................................6 find................................................................................................................................................................7 kill..................................................................................................................................................................7 passwd ..........................................................................................................................................................8 pidof..............................................................................................................................................................8 tail .................................................................................................................................................................8 tar..................................................................................................................................................................9 zip..................................................................................................................................................................9 unzip............................................................................................................................................................10 gzip..............................................................................................................................................................10 gunzip..........................................................................................................................................................10 top...............................................................................................................................................................11 touch...........................................................................................................................................................11 useradd .......................................................................................................................................................12 userdel ........................................................................................................................................................12
  • 2. Linux Basic Administration Commands ii | P a g e mount..........................................................................................................................................................12 umount........................................................................................................................................................13
  • 3. Linux Basic Administration Commands 1 | P a g e Overview In this guide you will be able to manage Linux system with basic administration task. For additional and command usage information on the specific command(s); you can run “man <command>”. Note: Not all the parameters are explained in this document. Applies To Linux flavours Init Levels or Run levels A run level is a state of init (initialization) and the whole system that defines what system services are operating. Run numbers identifies levels; There is no consensus of how to use the user defined run levels (2 through 5). Some system administrators use run levels to define which subsystems are working, e.g., whether X is running, whether the network is operational, and so on. Others have all subsystems always running or start and stop them individually, without changing run levels, since run levels are too coarse for controlling their systems. Depending on your administration needs, define the run level based on the below. Init Levels Table Run Level Operation (Purpose) 0 Halt System 1 Single-user mode (Recovery / special Administration) 2 By Default - Not used (user-definable) 3 By Default - Full (multi-user mode) 4 By Default - Not used (user-definable) 5 Full multi-user mode (with an X-based login screen) 6 Reboot chkconfig chkconfig is a basic system utility. It updates and queries run level information for system services, manages which service(s) will start or stop automatically in a specified run levels. chkconfig: options --add Add an new service --del Delete an existing service
  • 4. Linux Basic Administration Commands 2 | P a g e --level numbers, 0- 6: Update init levels --list List Services that are added Syntax: chkconfig --add <service Name> Example: chkconfig --add httpd chkconfig --levels 345 httpd on chmod chmod changes the permissions for a file; permissions should include a letter designating who gets permissions (u for the user, g for the group, o for others, or a for all) followed by a + or - (to give or take away the permission) followed by the kind of permission (r for read access, w for write access, x for execute if the file is a program or script). chmod: options -f Silent Mode -R Recursive 4 or “r” Read Privilege(s) 2 or “w” Write Privilege(s) 1 or “x” Execute Privilege(s) Syntax: chmod +x <FileName> chmod -w <FileName> Example: chmod +x run.sh chmod -x run.sh chown chown changes the user and/or group ownership of each given file as specified by the first non-option argument, changes the ownership of one or more files to new owner. chown: options -f Silent Mode -h Including symbolic links -R Recursive Syntax: chown -fhR <UserID>:<GroupID> <FileName>
  • 5. Linux Basic Administration Commands 3 | P a g e Example: chown -fh jboss:jboss run.sh crontab A short name for file /var/lib/crontab, which contains a list of Linux commands to be performed at specific times. A system administrator can use crontab as an automatic timer to trigger the initiation of important jobs. To view, install, or uninstall your current crontab file. crontab: options -e Edit crontab entry of existing logged in user -l List crontab entry of existing logged in user -r Delete all the entries in crontab file Syntax: crontab <option> Example: crontab -e crontab -l df df reports the amount of disk space used by the specified files, and by each directory in the hierarchies rooted at the specified files. df: options -k block size will be 1K size -h Human readable Syntax: df <option> <Partition> Example: df -kh du Print disk usage (as the number of 1 KB blocks used by each named directory and its subdirectories; default is the current directory). du: options
  • 6. Linux Basic Administration Commands 4 | P a g e -k block size will be 1K size -h Human readable -b Bytes -c Calculate or sum Syntax: du -<Option> <FileName> Example: du -kh free Display statistics about memory usage: total free, used, physical, swap, shared, and buffers used by the kernel. free: options -b Memory usage in Bytes -k Block size will be 1K size -m Memory usage in Megabytes -g Memory usage in Gigabytes Syntax: free -<option> Example: free -km fdisk Is a menu driven program for creation and manipulation of partition tables. fdisk: options -l Listing of existing drive partitions. -s Listing of existing drive partitions size. -v fdisk version number. Syntax: fdisk -<option> Example: fdisk -l
  • 7. Linux Basic Administration Commands 5 | P a g e groupadd Create new group of accounts for the system. -g Assign Group ID -f Add to group forcefully Syntax: groupadd -<option> <GroupName> Example: groupadd -g 500 oracle groupdel Remove group from system account files Syntax: groupdel <GroupName> Example: groupdel oracle ifconfig Assign an address to a network interface and/or configure network interface parameters. ifconfig: option -a Display all the interface details -v Verbose mode interface details up Activate specified interface down Shutdown the specified interface Syntax: ifconfig -<option> <Network Interface> Example: ifconfig -a ifconfig eth0 ifconfig eth0 up ifconfig eth0 down
  • 8. Linux Basic Administration Commands 6 | P a g e ifup Enable network interface ifup: option -a Bring up all the interfaces that are defined in /etc/network interfaces -f Force configuration of the interface --no-scripts Don’t run any scripts under /etc/network/if-*.d/ Syntax: ifup <Interface Name> Example: ifup eth0 ifup -a ifdown Disable network interface ifdown: option -a Bring down all the interfaces that are defined in /etc/network interfaces -f Force configuration of the interface --no-scripts Don’t run any scripts under /etc/network/if-*.d/ Syntax: ifdown <Interface Name> Example: ifdown eth0 ifdown -a grep grep searches the named input FILEs (or standard input if no files are named, or the file name - is given) for lines containing a match to the given PATTERN. By default, grep prints the matching lines. grep: option -c Count matching lines -r Recursive search -l Displays count that doesn’t match the search criteria
  • 9. Linux Basic Administration Commands 7 | P a g e Syntax: grep <search string> <File Name> Example: grep vcp.muthukrishna /etc/password grep -r "SearchString" /var/www/ grep -cw "SearchString" SearchFile.txt grep -cvw "Search" SearchFile.txt grep -l " SearchString" /www/* find Find locates files. Within each directory tree specified by the given paths, it evaluates the given expression from left to right, according to the rules of precedence. find: option -print Prints the results -name Find string Syntax: Find <SearchPath> -<option> Example: find . -name "java" -print find . -name "Java" -H -print kill Send a signal to terminate one or more process IDs. kill: option -9 Kills process -l Lists all possible process IDs Syntax: kill -<option> <Process ID> Example: kill –a gcc
  • 10. Linux Basic Administration Commands 8 | P a g e kill -9 13445 kill -l 1234 passwd Change / update the password of a user or logged in user. passwd: option -S Status of the password set -d Deletes set password, passwordless user Syntax: passwd -<option> <UserName> Example: passwd vcp.muthukrishna password -S vcp.muthukrishna password -d vcp.muthukrishna pidof Display the process IDs of the listed program or program. pidof: option -s Single shot - this instructs the program to only return one pid Syntax: pidof -<option> Process ID Example: pidof -s gdm-binary pidof pickup tail Print the last 10 lines of each named file tail: option -f Real time file print on console -n Number of lies to print Syntax:
  • 11. Linux Basic Administration Commands 9 | P a g e tail -<option> <FileName> Example: tail -f server.log tail –n20 tar Copy files to or restore files from an archive medium tar: option -c Create an archive file -v Verbose mode enable -x Extract an archive file -z Extract gunzip, gzip -t List the files in the archive Syntax: tar -<option> <TarFileName> Example: tar -cf ArchiveFileName.tar file1 fileN tar -cf ArchiveFileName.tar Directory/ tar -czf ArchiveFileName.tar Directory/ tar -tvf ArchiveFileName.tar tar -xvf httpd.tar tar -zxvf httpd.tar.gz zip Create a compression file. zip: option -R Recursive -v Verbose mode enable -u Update existing compression file Syntax: zip -R <ZipFileName> <Include FileNames> Example:
  • 12. Linux Basic Administration Commands 10 | P a g e zip -R ZipFileName.zip *.* zip -u ZipFileName.zip AddFileName.txt unzip Explodes / Extracts a compression file. zip: option -d Folder location where the file should be exploded -t Test archive file -v Verbose mode enable Syntax: unzip -<option> <ZipFileName> Example: unzip -d /usr/local/Destination_Directory ZipFileName.zip gzip Compress a gzip file (Compression utility like zip). gzip: option -v Verbose mode enable -r Recursive Syntax: gzip -<option> <gzipFileName> Example: gzip GzipFileName.gz *.* gzip -f GzipFileName.gz *.* gzip TarFile.tar gunzip Explodes / extracts a compressed gzip file. guzip: option -v Verbose mode enable -r Recursive
  • 13. Linux Basic Administration Commands 11 | P a g e Syntax: guzip -<option> <gzipFileName> Example: gunzip GunzipFileName.gz gunzip -R GunzipFileName.gz top Provide information (frequently refreshed) about the most CPU-intensive processes currently running. top: option -u Show top info for a user -p Show top info for a PID -d Set delay (refresh) Syntax: top -<option> Example: top -u jboss top -p10078 touch Update the access time and modification time (and dates) to the current time and date. touch: option -c No create, if file doesn’t exists -a Change access time only Syntax: top -<option> <FileName> Example: touch FileName.txt touch -c FileName.ear
  • 14. Linux Basic Administration Commands 12 | P a g e useradd Create new user accounts or update default account information. useradd: option -g group id of a the user -d Location of home directory for user -f Inactive user -s Set Shell for the user -k Skeleton directory Syntax: useradd -<option> <UserName> Example: useradd -g 500 jboss useradd -s /bin/bash -g 500 jboss useradd -s /bin/bash -g 500 jboss -d /usr/local/jboss userdel Delete all entries for user in system account files userdel: option -r Remove home directory and files of the user -f Force Remove Syntax: userdel -<option> <UserName> Example: userdel -r jboss userdel -f jboss mount Mounts a device on a location. mount: option -t Type of filesystem to be mounted -a Mount all filesystem listed in /etc/fstab
  • 15. Linux Basic Administration Commands 13 | P a g e -l List mounts label -n unmounts without writing to /etc/fstab -v Verbose Syntax: mount -<option> <Device> <Mount point> Example: mount -t ext3 /dev/hdc1 /mnt/Linux2 mount -t iso9660 -o ro /dev/cdrom /mnt/cdrom mount /dev/cdrom/ /mnt/cdrom mount -o loop disk1.iso /mnt/isoDisk Note: /mnt/cdrom and /mnt/Linux2 should be already existing directory. Never mount on existing file system. You will lose the existing mount locations, you’ve to explicitly reboot to see the mount points again. umount Unmount’s a device that is mounted mount: option -n unmounts without writing to /etc/fstab -v Verbose -f Force Unmount Syntax: umount -<option> <Mount point> Example: umount /mnt/Linux2 umount /mnt/cdrom