Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Command What it does

id user_name To check the user id and group id of a user, useful to check if a user is created or not
who Users who are logged into the system and their terminals
tty The tty command writes the name of your terminal to standard output

last All details of users (with ip address also) who have logged into the system from the created date
w Logged in users details with processes run
write username To write a message to a specific logged in user of the system. Hit enter and then write your message, enter to send. Ctrl +d to
exit
wall To write a message to everybody logged in. hit enter to write message and to send a message ctrl+d

System utility commands


uptime Shows the total running time.
Current linux time Total running time Current no users The average CPU load for 1, 5 and 15 min ??
hostname
uname The version of
which command_name The location of the command
bc Will open the binary calculator
systemctl System control command to control a service
systemctl To start or stop or see the status of a service
start/stop/status
servicename.service
systemctl restart/reload To reload after any change to the service
servicename.service
systemctl enable/disable To enable starting of the service at the time of system bootup
servicename.service
systemctl poweroff
systemctl halt
systemctl reboot
systemctl list-units --all All the units that are available (enabled or not)
Unit Load Active Sub Description
Name of the service Whether More detail of unit Of unit
configuration file is
loaded or not
rd
To add a new service (3 party )we need to create the unit file in /etc/system/system/servicename.service
ps Process system and displays all the current running system in the linux system
PID tty TIME CMD
The unique ID of the process Terminal type the user Amount of CPU in minutes Name of the command
logged into and seconds that the
process has been running
ps -e All running processes
ps -ef All running process in full format listing (mostly used)
ps -u user_name To show all process being run by user_name user
top Show linux processes and provides real time view of the running
Zombie process: whose parent process is dead
It refreshes by default every 3 seconds
top Then press k to select whose process to kill
top Shift m and then press Shift p to sort all the running process in descending memory % usage
kill PID We use systemctl to stop/kill a service but sometimes it might have processes which will not be killed along with the service.
For that we need kill command to manually kill a process. Only root can do
kill option PID option is signal name or number
kill -l To get a list of signal names
Kill -1 Restart the process
Kill -2 Interrupt like Ctrl+C
Kill -9 Forcefully kill the process
Kill -15 Kill a process gracefully
killall process_id To kill a process and its related child processes
pkill process_name To kill a process by its name

You might also like