![]() These various syntaxes also produce differing output. In this guide, we’ll go over the most useful ps commands that Linux users should know.Ĭommand syntax for ps can be confusing because it accepts UNIX, BSD, and GNU formatted options. But do you know how to use it effectively? ps comes with a small learning curve, thanks to its varying syntax and plethora of (overlapping) options. Let me know your suggestions by commenting.The ps command in Linux is our best asset for listing running processes on a system. WCHAN Memory address of the event the process is waiting for %MEM How much memory the process is using %CPU How much of the CPU the process is using TIME the amount of CPU time accumulated by the current processĬMD the command used to invoke the process TTY the controlling terminal for the current process STIME the start time for the current process PPID the parent process id, the process that spawned the current process PID the process id, a unique identifier assigned to each process ::Field description:: UID the user who owns the process # -y Do not show flags show rss in place of addr. See the c option, the format keyword args, and the format keyword comm. When used with -L, the NLWP (number of threads) and LWP (thread ID) columns will be added. It also causes the command arguments to be printed. This option can be combined with many other UNIX-style options to add additional columns. # ps -AlLm : To See Threads After Processes. # ps -AlFH : To See Threads ( LWP and NLWP). # ps -AlF : To turn on extra full mode (it will show command line arguments passed to process). ::Additional informations:: # ps -Al : Show Long Format Output. PS command to displays the process name having a particular PID # ps -p PID -o comm= So the syntax to find out the PID of that processes are, # ps -C Firefox -o pid= OR pgrep Firefox OR pgrep -u arun FirefoxĨ. Here i am choosing one of the process Firefox that running under the system. # pgrep -u user-name PROCESS (running under the user) Examples, Display only the process ID of a particular process under the system(server) # ps -C PROCESS -o pid= Find out every process running under a user. Find out top 10 CPU consuming process # ps -auxf | sort -nr -k 3 | head -10Ħ. Find out the top 10 memory consuming process on system(server) # ps -auxf | sort -nr -k 4 | head -10ĥ. This switch combination displays fue features like terminal, process ID, commands, time etc. ![]() Print processes like a tree format # ps -ejHģ. aux displays more details like user, cpu, memory etc. These commands will print all process running on the system(server). Some useful ps commands switch combinations and examples are explained below, This is actually the static out put of the top command. We can simply sort out the process with its resource usages like memory, CPU etc with ps command along with different switches. The PS command under Unix/Linux displays the screen shots of current process. That means, you can find-out the process information simply from “ps” without running “TOP” in high load situation. The knowledge of using the command “ps” will helpful, if your server is facing a high load issue. We can list or find-out a lot of information regarding the processes running under our server by simply using the command ps and its proper switches. A lot of switches are available with the command “ps” to trace out processes with their metadata. This will be a very useful discussions if you are managing Linux servers with many processes. Commonly using “ps command” switches with example – Unix/Linux
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |