Linux Tutorials

Easy methods to test operating course of in Ubuntu utilizing command line

SEOClerks

I am a brand new sysadmin for the Ubuntu working system. How do I test operating course of in Ubuntu utilizing the command line possibility?

One can use the Ubuntu command line or terminal app to show a operating course of, change their priorities degree, delete course of and extra. This web page exhibits find out how to use varied instructions to listing, kill and handle course of on Ubuntu.

Adblock detected 😱

My web site is made attainable by displaying on-line commercials to my guests. I get it! Advertisements are annoying however they assist preserve this web site operating. It’s arduous to maintain the positioning operating and producing new content material when so many individuals block adverts. Please take into account donating cash to the nixCraft through PayPal/Bitcoin, or develop into a supporter utilizing Patreon.

Verify operating course of in Ubuntu

The process to watch the operating course of in Ubuntu utilizing the command line is as follows:

Open the terminal window on UbuntuFor distant Ubuntu server use the ssh command for log in purposeType the ps aux command to see all operating course of in UbuntuAlternatively, you may subject the highest command to view operating course of in Ubuntu

Please be aware that [vivek@ubuntuLTS:~]$ is my shell immediate. It’s worthwhile to kind all instructions after that immediate.

Easy methods to handle processes from the Ubuntu terminal

The ps command is a standard Ubuntu Linux command to lists operating processes. The next command exhibits all processes operating in your Ubuntu based mostly system:
[vivek@ubuntuLTS:~]$ ps -aux
[vivek@ubuntuLTS:~]$ sudo ps -a
How to Manage Processes from the Ubuntu Terminal
The method ID (PID) is important to kill or management course of on Ubuntu. For instance take into account the next outputs:

esha 42421 zero.zero zero.zero 13160 8452 – S 22:18 zero:00.03 firefox

The place,

esha – Consumer title42421 – PID (Ubuntu Linux course of ID)22:18 – Course of begin timefirefox – Precise course of or command

There could also be too many processes. Therefore, it makes use of the next much less command/extra command as pipe to show course of one display screen at a time:
[vivek@ubuntuLTS:~]$ ps -aux | extra
[vivek@ubuntuLTS:~]$ sudo ps -aux | much less
Press q to exit from above Ubuntu Linux pagers. You possibly can seek for a selected Ubuntu course of utilizing grep command/egrep command:
[vivek@ubuntuLTS:~]$ ps aux | grep nginx
[vivek@ubuntuLTS:~]$ sudo ps aux | grep vim
[vivek@ubuntuLTS:~]$ sudo ps -aux | egrep ‘sshd|openvpn’

pgrep command

Ubuntu comes with the pgrep command to go looking/discover course of. The syntax is:
[vivek@ubuntuLTS:~]$ pgrep course of
[vivek@ubuntuLTS:~]$ sudo pgrep sshd
[vivek@ubuntuLTS:~]$ pgrep vim
[vivek@ubuntuLTS:~]$ pgrep -l take a look at.sh
Given a search term, Ubuntu pgrep command shows the process IDs that match it
The -l possibility handed to the pgrep command to show lengthy format and course of title too.

high command

The high command is one other extremely beneficial technique to see your Ubuntu servers useful resource utilization. One can see an inventory of high course of that utilizing essentially the most reminiscence or CPU or disk. Run:
[vivek@ubuntuLTS:~]$ high
[vivek@ubuntuLTS:~]$ sudo high
[vivek@ubuntuLTS:~]$ sudo high [options]
Check running process in Ubuntu Linux using top command

Ubuntu kill command

Need to kill a course of on Ubuntu? Strive kill command. The syntax is:
[vivek@ubuntuLTS:~]$ kill pid
[vivek@ubuntuLTS:~]$ kill -signal pid
Discover PID utilizing ps, pgrep or high command. Say you wish to kill a PID # 25123, run:
[vivek@ubuntuLTS:~]$ kill 25123
For some motive if the method cannot be killed, attempt forceful killing:
[vivek@ubuntuLTS:~]$ kill -9 25123
OR
[vivek@ubuntuLTS:~]$ kill -KILL 25123
Ubuntu kill command to kill a process, given its process ID

pkill command

In the event you want to kill a course of by title, attempt pkill command on Ubuntu. The syntax is:
[vivek@ubuntuLTS:~]$ pkill processName
[vivek@ubuntuLTS:~]$ pkill vim
[vivek@ubuntuLTS:~]$ pkill firefox
[vivek@ubuntuLTS:~]$ pkill -9 emacs
[vivek@ubuntuLTS:~]$ sudo pkill -KILL php7-fpm

killall command

The killall command kills processes by title, versus the choice by PID as achieved by kill command:
[vivek@ubuntuLTS:~]$ killall vim
[vivek@ubuntuLTS:~]$ killall -9 emacs
Ubuntu kill a process given its name

good and renice command

The first objective of the good command is to run a course of/command at a decrease or larger precedence. Use the renice command to change the good worth of a number of operating Ubuntu processes. The great worth can vary from -20 to 19, with 19 being the bottom precedence. Say, you wish to compile software program on a busy Ubuntu Linux 18.04 LTS server. You possibly can set a really low precedence, enter:
[vivek@ubuntuLTS:~]$ good -n 13 cc -c *.c &
Set a really excessive precedence for a kernel replace. Earlier than rebooting Ubuntu server, run:

[vivek@ubuntuLTS:~]$ good –10 wall <<finish
System reboots in 5 minutes for Ubuntu Linux kernel replace!
Save all of your work!!!
 
— Sysadmin
finish

[vivek@ubuntuLTS:~]$ good –10 wall <<finish
System reboots in 5 minutes for Ubuntu Linux kernel replace!
Save all of your work!!! — Sysadmin
finish

To alter the precedence of a operating course of, kind the next:
[vivek@ubuntuLTS:~]$ renice Precedence -p
[vivek@ubuntuLTS:~]$ renice Precedence
[vivek@ubuntuLTS:~]$ pgrep vim
[vivek@ubuntuLTS:~]$ renice 10 69947
[vivek@ubuntuLTS:~]$ sudo renice -10 $(pgrep vim)
Ubuntu change the priority of a running process

Conclusion

This web page exhibits find out how to handle the method on the Ubuntu terminal. For additional data see man pages or our instance pages:

Posted by: Vivek Gite

The writer is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a coach for the Linux working system/Unix shell scripting. Get the newest tutorials on SysAdmin, Linux/Unix and open supply subjects through RSS/XML feed or weekly electronic mail e-newsletter.

Source link

Related Articles

Leave a Reply

Back to top button