PS to Linux

Anonim

PS to Linux

Output without options

PS (process state) - a standard tool of all Linux distributions used in the console. Its main purpose - to display information about all running processes. The amount and detail of information displayed depends on the installed options, which are selected with the direct activation of the command itself. About the options we will discuss a little later, but for now let's just type ps in the "Terminal" and press Enter.

Using PS command in Linux without using the options

As seen in the screenshot below, you will see the entire line, including the shell is bash and the process considered the team.

The result of using the command PS in Linux without using additional options

Of course, there may be a few more points, depending on the number of running user programs, but in most cases people are not satisfied with such a conclusion, so we suggest to go to the study of additional options.

To list all processes

PS Utility without special options do not provide useful information that can be useful when studying the list of active processes, and therefore it is important to apply the arguments. The first of them is responsible for the display of absolutely all the current problems, and the line takes the form ps -A.

Using PS command in Linux for the withdrawal of all processes

As a result, a huge number of rows displayed, which must be sorted out. Divide the information into multiple columns. PID represents the process ID number and can be used, for example, for the rapid completion of the program, or check the task tree. TTY - terminal name that is running the current process. TIME - time work, and CMD - the name of the task team.

The result of using the command PS in Linux for the withdrawal of all processes

Additionally, you can use the ps -e command to display a list of all processes, if a previous version does not suit you.

Alternative PS command in Linux for the withdrawal of all processes

As can be seen, after the issuance of the activation of the -e option it has turned out exactly the same as for entering the -A argument.

The result of the use of PS in the Linux alternative options for the withdrawal of all processes

There BSD output format that is responsible for displaying a user-related processes, and displays more detailed information about the objectives of their load on the processor and the exact location. To obtain such information, use ps au.

The use of additional PS command in Linux options for output format BSD

On the following picture you can see that the number of columns is significantly increased. As a result, for the inspection will be available a full list of processes with reference to the account and display location.

The result of using additional PS options in Linux to output BSD

Fully Format Listing

Examples discussed above allowed to display almost all the necessary information that can be useful to novice users. However, it is sometimes necessary to obtain a more detailed listing, for example, to determine the process call source. Then the line will come to the rescue: PS -EF.

Using additional options for full-length listing PS in Linux

Almost the same columns will be displayed about which we have already spoken earlier, but you will additionally appear a detailed layout of the location and the first item will be responsible for the source of the task call.

Result of using options for full-length Listing PS in Linux

Display user processes

The -x option is responsible for displaying the processes that were disconnected from the terminal, that is, manifested personally by the user. If you want to know exactly what tasks were open on behalf of the current account, it is enough to enter the PS -X string and click on ENTER.

Using the PS command options in Linux to output user processes

The output will be as informative as possible, but without additional information. However, it will not prevent anything to use and additional options, for example, -EM to display the security context.

The result of the output of user processes through the PS command in Linux

If you want to get information about other user data, change the line on PS -FU Lumpics, where Lumpics replace the necessary name.

Using the PS command options in Linux to display the processes of a specific user

In the output results, pay attention to the first column. You will not find there other owners except the specified in the team before it is activated.

The result of the output of the processes of a specific user PS in Linux

Filter by root.

Each Linux session has a separate list of tasks performed with ROOT rights. If you want to display only such processes, you should set the PS -U ROOT -U ROOT command and activate it by pressing the ENTER key.

Using Advanced PS command options in Linux to output root processes

When using the command exactly repeating the one that above, the output will not contain rows with a start-up source, since it is known in advance that it is root, and all information is shown as compressed as possible. Here we offer to use the above arguments to expand the information.

The result of the output of the PS command in Linux with the options for the root of processes

Displaying group tasks

Experienced users know that some processes belong to a specific group, that is, there is a main task and its dependencies forming a common tree. If you need to display only rows falling under this criterion, use the PS -FG 48 command, where 48 is the identifier of the group (it can be replaced by the name of the parent process).

Using the PS command in Linux to output tree process identifier

Display by PID

From the above information you already know that each process has its own PID, that is, the identifier defining it. If there is a desire to search for a specific PID, the PS -FP 1178 command should be activated, replacing the number to the desired one. There is a PPID criterion. When determining this format, the string acquires the PS -F -F -FPPID 1154 view, with the corresponding change in the identifier to the desired one.

Using the PS command in Linux to output the processes by identifier

These were all the main examples of the PS team in Linux, which we wanted to talk within the framework of today's article. Unfortunately, the volume of one manual is not enough to describe in detail the interaction with all available options and their combinations. Instead, we offer to explore the official team documentation by performing PS --HELP to get those prompts that you did not find above. Additionally, on our site there are detailed descriptions of the main commands of the considered operating system. We recommend novice users to learn them in order to quickly get used in the management of the Linux console.

See also:

Frequently used commands in "Terminal" Linux

LN / FIND / LS / GREP / PWD command in Linux

Read more