Processes
ps
Try These:
psps -fps -Fps -u <username>ps -g <groupname>ps <PID>ps -C <CMD>ps -ef | head -3ps aux | head -3ps aux --sort=-pcpu | head -3ps aux --sort=-pmem | head -3ps -o pid,uname,comm,pcpu,pmem -C <CMD>ps -eo pid,ppid,ni,pri,cmd,%cpu,%mem --sort=-%cpu | head -3ps -eHps -u --forestpstree (technically a different command)
pgrep
pgrep -lu <username> <CMD>pgrep -lg <username> <CMD>
kill
sleep 100 &pgrep sleepkill -v <sleep's PID>
sleep 100 &pkill -v pkill sleep
-kill -L (List signal names)
| Signal | Signal # | Meaning |
|---|
| TERM | 15 | Stonger than INT |
| KILL | 9 | Is unblockable |
| INT | 2 | Same as <Ctl-C> keyboard shortcut. Can be caught and ignored. |
| QUIT | 3 | Like TERM with default coredump. |
nice/renice
| Command | PRI | NI | CMD |
|---|
nice -1 vim dog | 18 | 1 | vim dog |
nice -5 vim dog | 14 | 5 | vim dog |
nice -10 vim dog | 9 | 10 | vim dog |
nice -19 vim dog | 0 | 19 | vim dog |
renice -13 -p 3564 (by PID)
renice 14 -u ubuntu,daniel -g custom (all in two users and 1 group)
top
Top bar field meanings
Top Line Meaning (5 fields)
| 1 | 2 | 3 | 4 | 5 |
|---|
| Uptime | # of users logged in | one minute | five minutes | 15 minutes |
Second Line is obvious to look at...
Third line is CPU time spent on: (7 fields)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 |
|---|
| “user space” | Kernel "system" | "nice" processes | "idle" | "waiting" for I/O | "hardware interrupts" | "software interrupts" |
Fourth and fifth lines are obvious.
White Bar Meaning (12 fields)
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|---|
| Process ID | Username | Priority | Nice Value | Virtual Memory Used | Resident Memory Used | Shared Memory Used | Status | CPU Used | Memory Used | CPU Time Used | Command |
Status Initial Meaning
| Status Initial | Meaning |
|---|
| D | Uninterruptible sleep |
| R | Running |
| S | Sleeping |
| T | Traced (stopped) |
| Z | Zombie |
Interactive commands
| Key | Sort by: |
|---|
| q | quit |
| P | List by %CPU |
| M | List by %MEM |
| N | List by PID |
| T | List by TIME+ |
| u | Filter for a users process |
| c | Toggle COMMAND display |
| 1 | Display individual CPU statistics |
| I | Only active tasks |
| n | Number of lines |
| r | Renice a process |
| k | Kill a process (enter sigterm) |
| A | Display four areas in the process list |
| a | Move from area to area |
| W | Save settings as default |
| d | Set refresh rate |
| Space | Force refresh |
fg
top<Ctrl. Z> (suspend)fg (bring jobs to forground)
Edit this page on GitHub