Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| elearning:workbooks:redhat:rh124en:l109 [2024/11/12 09:57] – created admin | elearning:workbooks:redhat:rh124en:l109 [2024/11/27 08:50] (Version actuelle) – admin | ||
|---|---|---|---|
| Ligne 9: | Ligne 9: | ||
| =====Contents===== | =====Contents===== | ||
| - | * RH12410 - Process Management** | + | * **RH12410 - Process Management** |
| * Contents | * Contents | ||
| * Presentation | * Presentation | ||
| * Process Types | * Process Types | ||
| - | * Process commands | + | * Lab #1 - Process commands |
| - | * The ps command | + | * 1.1 - The ps command |
| - | * The pgrep command | + | * 1.2 - The pgrep command |
| - | * The pstree command | + | * 1.3 - The pstree command |
| - | * The top command | + | * 1.4 - The top command |
| - | * The fg, bg and jobs commands | + | * 1.5 - The fg, bg and jobs commands |
| - | * The wait command | + | * 1.6 - The wait command |
| - | * The nice command | + | * 1.7 - The nice command |
| - | * The renice command | + | * 1.8 - The renice command |
| - | * The nohup command | + | * 1.9 - The nohup command |
| - | * The kill command | + | * 1.10 - The kill command |
| - | * The pkill command | + | * 1.11 - The pkill command |
| =====Présentation===== | =====Présentation===== | ||
| Ligne 39: | Ligne 39: | ||
| * A list of open files.. | * A list of open files.. | ||
| - | This information is stored in the **/proc** directory. The /proc directory contains virtual files and directories. The contents of these files are created dynamically during consultation. Only root can view all the information in the /proc directory. | + | This information is stored in the **/proc** directory: |
| - | + | ||
| - | Enter the following command: | + | |
| < | < | ||
| Ligne 115: | Ligne 113: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** - Note that the content of the files is of little or of no direct use to a System Administrator. | **Important** - Note that the content of the files is of little or of no direct use to a System Administrator. | ||
| </ | </ | ||
| Ligne 127: | Ligne 125: | ||
| * **daemon** - processes that do not have a parent terminal. | * **daemon** - processes that do not have a parent terminal. | ||
| - | A process can be in one of nine states or //process states// : | + | A process can be in one of nine //process states// : |
| * //user mode// - the process is executing in user mode, | * //user mode// - the process is executing in user mode, | ||
| Ligne 143: | Ligne 141: | ||
| ====1.1 - The ps command==== | ====1.1 - The ps command==== | ||
| - | This command | + | The output from this command |
| < | < | ||
| Ligne 155: | Ligne 153: | ||
| </ | </ | ||
| - | For more details, use the **-l** | + | You can get more details |
| < | < | ||
| Ligne 167: | Ligne 165: | ||
| Note in this output : | Note in this output : | ||
| - | ^ F | Process | + | ^ F | Process |
| - | ^ S | Process | + | ^ S | The process |
| - | ^ UID | User ID | + | ^ UID | User ID of the user who has stated |
| - | ^ PID | Unique | + | ^ PID | Process |
| - | ^ PPID | PID of parent process | + | ^ PPID | Parent |
| - | ^ C | Process priority | + | ^ C | Prority |
| ^ PRI | Process priority | | ^ PRI | Process priority | | ||
| - | ^ NI | The value of nice | | + | ^ NI | Process |
| - | ^ ADDR | Process memory | + | ^ ADDR | Memory |
| ^ SZ | Virtual memory usage | | ^ SZ | Virtual memory usage | | ||
| ^ WCHAN | Name of the kernel function in which the process is asleep | | ^ WCHAN | Name of the kernel function in which the process is asleep | | ||
| - | ^ TTY | Name of the terminal | + | ^ TTY | Name of the terminal |
| - | ^ TIME | Runtime of the process | + | ^ TIME | Processing time | |
| - | ^ CMD | Command executed | + | ^ CMD | The command that generated the process |
| - | To view the process table, use the ps command with the l and x options - the command displays all the processes with a long display | + | |
| + | To view the process table, use the ps command with the l and x switches: | ||
| < | < | ||
| Ligne 247: | Ligne 246: | ||
| This output contains some additional information: | This output contains some additional information: | ||
| - | ^ VSZ | The same as SZ in the example | + | ^ VSZ | The same thing as SZ in the previous |
| - | ^ RSS | The memory | + | ^ RSS | Memory in KB used by the process | |
| - | ^ STAT | The same as S in the example | + | ^ STAT | The same thing as S in the previous |
| - | + | Using the a, u and x switches you obtain | |
| - | With options | + | |
| < | < | ||
| Ligne 317: | Ligne 315: | ||
| This output contains some additional information: | This output contains some additional information: | ||
| - | ^ USER | The user of the process | | + | ^ USER | The user associated with the process | |
| - | ^ %CPU | Microprocessor resources | + | ^ %CPU | % of the processor ressources |
| - | ^ %MEM | RAM resources | + | ^ %MEM | % of the memory ressources |
| The command line switches for this command are : | The command line switches for this command are : | ||
| Ligne 527: | Ligne 525: | ||
| ====1.3 - The pstree command==== | ====1.3 - The pstree command==== | ||
| - | This command displays processes in a tree structure, showing parent processes as children: | + | This command displays processes in a tree structure: |
| < | < | ||
| Ligne 645: | Ligne 643: | ||
| ====1.4 - The top command==== | ====1.4 - The top command==== | ||
| - | This command | + | **top** |
| < | < | ||
| Ligne 708: | Ligne 706: | ||
| ... | ... | ||
| </ | </ | ||
| + | |||
| To display the **top** command help, press **h** : | To display the **top** command help, press **h** : | ||
| Ligne 737: | Ligne 736: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - To return to the previous display, press **q** or **echap**. | + | **Important** - To return to the previous display, press **q** or **escape**. |
| </ | </ | ||
| - | At launch, the list refresh | + | When launched top' |
| < | < | ||
| Ligne 816: | Ligne 815: | ||
| </ | </ | ||
| - | If you do not want to see zombie | + | To see the zombie |
| < | < | ||
| Ligne 844: | Ligne 843: | ||
| ====1.5 - The fg, bg and jobs commands==== | ====1.5 - The fg, bg and jobs commands==== | ||
| - | Normally | + | Normally commands |
| < | < | ||
| Ligne 850: | Ligne 849: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - Note that a background process is said to be **asynchronous** because it continues independently of its parent, which is the shell. | + | **Important** - Note that a background process is said to be **asynchronous** because it continues independently of its parent, which is the shell. |
| </ | </ | ||
| - | Linux numbers all processes | + | Linux identifies |
| - | The **jobs** command | + | The **jobs** command |
| < | < | ||
| Ligne 866: | Ligne 865: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - Note that the job number is enclosed in [square brackets] whereas | + | **Important** - The job number is between |
| </ | </ | ||
| If you wish to send a process into the background to free up the shell for other commands, you must first suspend the process in question. Normally we suspend a process using the key combination < | If you wish to send a process into the background to free up the shell for other commands, you must first suspend the process in question. Normally we suspend a process using the key combination < | ||
| - | For example, press : | + | For example: |
| < | < | ||
| Ligne 880: | Ligne 879: | ||
| </ | </ | ||
| - | Once suspended, use the command | + | Once suspended, use the **bg** (background) |
| < | < | ||
| Ligne 891: | Ligne 890: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - Note that when the process | + | **Important** - Note that when the process |
| </ | </ | ||
| - | To bring the process | + | To bring the job back to the foreground |
| < | < | ||
| Ligne 911: | Ligne 910: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - Note the use of < | + | **Important** - Note that we have used the < |
| </ | </ | ||
| Ligne 944: | Ligne 943: | ||
| ====1.6 - The wait command==== | ====1.6 - The wait command==== | ||
| - | This command | + | The **wait** |
| < | < | ||
| Ligne 957: | Ligne 956: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| **Important** - Note that using < | **Important** - Note that using < | ||
| </ | </ | ||
| Ligne 963: | Ligne 962: | ||
| ====1.7 - The nice command==== | ====1.7 - The nice command==== | ||
| - | This command | + | This command |
| < | < | ||
| Ligne 986: | Ligne 985: | ||
| </ | </ | ||
| - | As you can see, the 6th column contains the nice value which applies | + | As you can see the 6th column contains the nice value that is applied |
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** - Note that only root can start processes with a negative | + | **Important** - Note that only root can give a process |
| </ | </ | ||
| Ligne 1017: | Ligne 1016: | ||
| ====1.8 - The renice command==== | ====1.8 - The renice command==== | ||
| - | This command | + | This command |
| < | < | ||
| Ligne 1049: | Ligne 1048: | ||
| </ | </ | ||
| - | <WRAP center round important> | + | <WRAP center round important |
| - | **Important** -Note that only root can decrement | + | **Important** -Note that only root can decrease |
| </ | </ | ||
| Ligne 1079: | Ligne 1078: | ||
| ====1.9 - The nohup command==== | ====1.9 - The nohup command==== | ||
| - | This command allows a process to continue | + | This command allows a process to continue after closing the terminal in which is was launched. A child process dies when the parent process dies or terminates. As a connection is a process, when you disconnect, your processes terminate. To avoid remaining connected after launching a long process, use the nohup command: |
| < | < | ||
| Ligne 1111: | Ligne 1110: | ||
| </ | </ | ||
| - | ====.10 - The kill==== | + | ====1.10 - The kill command==== |
| The kill command sends signals to processes. The list of possible signals can be displayed using the **-l** option: | The kill command sends signals to processes. The list of possible signals can be displayed using the **-l** option: | ||
| Ligne 1132: | Ligne 1131: | ||
| </ | </ | ||
| - | < | + | < |
| **Important** - You will notice that each signal has a number. These signal numbers are used instead of options. For example, **-19** instead of the **-stop** option. | **Important** - You will notice that each signal has a number. These signal numbers are used instead of options. For example, **-19** instead of the **-stop** option. | ||
| </ | </ | ||
| - | Some of the most useful signal numbers | + | The most usefull signals |
| - | ^ Number | + | ^ Numéro |
| - | | -1 | The Hang Up signal | + | | -1 | A Hang Up is sent to all the child processus |
| - | | -2 | Process interrupt - equivalent | + | | -2 | Equivalent |
| - | | -3 | The same as -2 but with the generation of a debug file | | + | | -3 | The same signal |
| - | | -9 | The signal that kills a process | + | | -9 | A brutal way of killing |
| - | | -15 | The signal sent by default by the **kill** command. Process terminates normally | + | | -15 | The correct way of killing a process |
| The command line switches for this command are : | The command line switches for this command are : | ||