Linux Tutorials

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

SEOClerks

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

One can use the Ubuntu Linux command line or terminal app to show a operating course of, change their priorities degree, delete course of and extra. This web page reveals how you can use numerous instructions to checklist, kill and handle course of on Ubuntu Linux.

Verify operating course of in Ubuntu Linux

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

Open the terminal window on Ubuntu LinuxFor distant Ubuntu Linux server use the ssh command for log in purposeType the ps aux command to see all operating course of in Ubuntu LinuxAlternatively, you’ll be able to situation the highest command/htop command to view operating course of in Ubuntu Linux

Allow us to see some instance and utilization for Ubuntu Linux in particulars.

NOTE: Please notice that $ is my shell immediate. It’s essential sort instructions after the $ immediate.

Easy methods to handle processes from the Ubuntu Linux terminal

The ps command is a standard Ubuntu Linux command to lists operating processes. The next command reveals all processes operating in your system:
$ ps -aux
$ sudo ps -a
$ sudo ps -U vivek
$ ps -U tom
How to Manage Processes from the Ubuntu Linux Terminal
The method ID (PID) is important to kill or management course of on Ubuntu Linux. For instance think about the next outputs:

vivek 30992 zero.zero zero.three 40092 3492 pts/zero R+ 06:31 zero:00 ps -U vivek -au

The place,

vivek – Consumer identify30992 – PID (Ubuntu Linux course of ID)06:31 – Course of begin timeps -U vivek -au – Precise course of or command with command line arguments

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:
$ ps -aux | extra
$ sudo ps -aux | much less
Press q to exit from above Ubuntu Linux pagers. You possibly can seek for a selected Ubuntu Linux course of utilizing grep command/egrep command:
$ ps aux | grep nginx
$ sudo ps aux | grep vim
$ sudo ps aux | grep chromium-browser
$ sudo ps -aux | egrep ‘sshd|openvpn’

Ubuntu Linux pgrep command

Many variants of Ubuntu Linux comes with the pgrep command to go looking/discover course of. The syntax is:
$ pgrep course of
$ sudo pgrep sshd
$ pgrep vim
$ pgrep chromium-browser
$ pgrep -l nginx
Given a search term, Ubuntu Linux pgrep command shows the process IDs that match it
The -l possibility handed to the pgrep command to show lengthy format and course of identify too.

Ubuntu Linux high and htop instructions

The high command is one other extremely advisable methodology to see your Ubuntu Linux servers useful resource utilization. One can see an inventory of high course of that utilizing essentially the most reminiscence or CPU or disk.
$ high
$ sudo high
$ sudo high [options]
Check running process in Ubuntu Linux using top command
The htop is straightforward to make use of course of viewer from the CLI on Ubuntu Linux. Strive it as follows:
$ htop
$ sudo htop
$ sudo htop [options]
How to view running process in Linux using htop
Press q to exit from above high/htop Ubuntu Linux instructions.

Ubuntu Linux kill command

Wish to kill a course of? Strive kill command. The syntax is:
$ kill pid
$ kill -signal pid
Discover PID utilizing ps, pgrep or high command. Say you need to kill a PID # 3932, run:
$ kill 3932
For some purpose if the method cannot be killed, attempt forceful killing:
$ kill -9 3932
OR
$ kill -KILL 3932
Ubuntu Linux kill command to kill a process, given its process ID

Ubuntu Linux pkill command

Should you want to kill a course of by identify, attempt pkill command. The syntax is:
$ pkill processName
$ pkill vim
$ pkill firefox
$ pkill -9 emacs
$ sudo pkill -KILL php7-fpm

Ubuntu Linux killall command

The killall command kills processes by identify, versus the choice by PID as performed by kill command:
$ killall vim
$ killall -9 emacs
Unix kill a process given its name

Ubuntu Linux good and renice command

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

good –10 wall <

To vary the precedence of a operating course of, sort the next:
$ renice Precedence -p PID
$ renice Precedence PID
$ pgrep vim
renice 10 69947
$ sudo renice -10 $(pgrep vim)
Ubuntu Linux change the priority of a running process

Conclusion

This web page reveals how you can handle the method on the Ubuntu Linux terminal. For additional data see man pages or our instance pages:

Posted by: Vivek Gite

The creator 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 e mail publication.

Source link

Related Articles

Back to top button