Debug School

rakesh kumar
rakesh kumar

Posted on

Display different type processes using linux command

display all unique user processes using linux command

Find all user proesss using linux command

display all use of particular user processes

list all the system processes on the system

display all unique system processes using linux

display all use of particular system processes

display all unique Interactive processes using linux command

Find all Interactive processes using linux command

list all the Batch processes using linux command

display all unique Batch processes using linux command

display use of particular Batch processes using linux command

display all unique Network processes using linux command

Find all Network processes using linux command

display use of particular Network processes

list all the Interrupt processes on the system

display all unique Interrupt processes using linux

display use of particular Interrupt processes

display all unique user processes using linux command

Image description

Alternatively, you can use the following command to display a list of all the unique process names that are running on the system, along with the username of the process owner:

Image description

ps -eo user= | sort | uniq
Enter fullscreen mode Exit fullscreen mode

output

Image description

Find all user proesss using linux command

Image description

Image description

Image description

$ ps -U username
Enter fullscreen mode Exit fullscreen mode

Image description

display all use of particular user processes

To display all uses of a particular user process, you can use the ps command with the -U option to list processes for a specific user, and then pipe the output to grep to filter for the process you are interested in. Here is an example:

ps -U <username> | grep <process_name>
Enter fullscreen mode Exit fullscreen mode

Replace with the name of the user you want to check, and with the name of the process you want to filter for. This command will show all processes running for the specified user that match the process name you provided.

You can also use the lsof command to list all open files (including process files) for a particular user. Here is an example:

sudo lsof -u <username> | grep <process_name>
Enter fullscreen mode Exit fullscreen mode

Image description
Replace with the name of the user you want to check, and with the name of the process you want to filter for. This command will show all files (including process files) opened by the user that match the process name you provided.

Image description

Image description

list all the system processes on the system, use the following command

Image description

Image description

Image description

$ ps -e
Enter fullscreen mode Exit fullscreen mode

Image description

display all unique system processes using linux command

Image description

Image description

ps -e -o user= | sort | uniq -c | awk '$1==1 {print $2}'
Enter fullscreen mode Exit fullscreen mode

output
Image description

display all use of particular system processes

Here are some examples of how lsof can help improve system performance:

In Linux, you can use the "ps" command to display information about running processes, and you can use pipes to filter the output of the "ps" command to display information about specific processes. Here are some examples:

Display information about a specific process by its name:

To display information about a specific process by its name, you can use the "ps" command with the "grep" command. For example, to display information about the Apache web server process, you can use the following command:

ps aux | grep apache
Enter fullscreen mode Exit fullscreen mode

This will display all processes that contain the string "apache" in their command line.

Display information about a specific process by its process ID (PID):

To display information about a specific process by its PID, you can use the "ps" command with the "grep" command and the "awk" command. For example, to display information about the process with PID 1234, you can use the following command:

ps aux | grep 1234 | awk '{print $11}'
Enter fullscreen mode Exit fullscreen mode

Image description

ps aux --sort=-%cpu | head -n 11
Enter fullscreen mode Exit fullscreen mode

display all unique Interactive processes using linux command

You can display all unique interactive processes using the following Linux command:

ps -eo pid,tty,cmd | grep "pts/" | sort -u
Enter fullscreen mode Exit fullscreen mode

Image description

Find all Interactive processes using linux command

You can find all interactive processes using the following Linux command:

ps -eo pid,tty,cmd | grep "pts/"
Enter fullscreen mode Exit fullscreen mode

Image description

list all the Batch processes using linux command

ps -ef | grep batch
Enter fullscreen mode Exit fullscreen mode

Image description

top -b -n 1 | grep batch
Enter fullscreen mode Exit fullscreen mode

Image description

display all unique Batch processes using linux command

ps -ef | grep batch | awk '{print $2}' | sort | uniq
Enter fullscreen mode Exit fullscreen mode

Image description

pgrep -f batch | sort | uniq
Enter fullscreen mode Exit fullscreen mode

Image description

display use of particular Batch processes using linux command

ps -p <PID> -o %cpu,%mem,cmd
Enter fullscreen mode Exit fullscreen mode

Image description

top -p <PID>
Enter fullscreen mode Exit fullscreen mode

Image description

ps -ef | grep batch_process | grep -v grep | awk '{print $2}' | xargs ps -p -o %cpu,%mem,cmd
Enter fullscreen mode Exit fullscreen mode

Image description

display all unique network processes using the following Linux command

:

lsof -i | awk '{print $1}' | sort | uniq
Enter fullscreen mode Exit fullscreen mode

Image description

netstat -tulnp | awk '{print $7}' | sed 's/\/.*//' | sort | uniq
Enter fullscreen mode Exit fullscreen mode

Image description

Find all Network processes using linux command

sudo lsof -i
Enter fullscreen mode Exit fullscreen mode

Image description

sudo nethogs
Enter fullscreen mode Exit fullscreen mode

Image description

sudo netstat -tulnp

Image description

display use of particular Network processes

sudo lsof -p <PID> -i
Enter fullscreen mode Exit fullscreen mode

Image description

sudo iftop -P -i <INTERFACE> -f "<FILTER>"
Enter fullscreen mode Exit fullscreen mode

Image description

list all the Interrupt processes on the system

cat /proc/interrupts
Enter fullscreen mode Exit fullscreen mode

Image description

display all unique Interrupt processes using linux

There are no "interrupt processes" in the traditional sense, as interrupts are typically handled by the kernel itself or by kernel drivers, rather than by user-space processes. However, you can display all unique interrupt sources using the following Linux command:

cat /proc/interrupts | awk '{print $1}' | uniq
Enter fullscreen mode Exit fullscreen mode

Image description

display use of particular Interrupt processes

Interrupts are typically handled by the kernel itself or by kernel drivers, rather than by user-space processes, so there is no straightforward way to display the usage of a particular interrupt process using a Linux command.

However, you can monitor interrupt usage in real-time using the watch command in combination with the /proc/interrupts file. For example, you can use the following command to display the usage of interrupt 17 in real-time:

watch -n 1 "grep '^\s*17:' /proc/interrupts"
Enter fullscreen mode Exit fullscreen mode

Image description

Top comments (0)