(="print status" or "process status") Display the list of currently running processes with their process ID (PID) numbers. Use ps axu to see all processes currently running on your system (also those of other users or without a controlling terminal), each with the name of the owner. Use "top" to keep listing the processes currently running.
Run any command in the background (the symbol "&" means "run the preceding command in the background"). The job_number is printed on the screen so you can bring the command in the foreground (see below) if you want. I use "&" often when starting a GUI program from an X-terminal.
List my background or stopped processes and show their job numbers.
Bring a background or stopped process to the foreground.
Place a process in the background, so it is exactly as if it had been started with &. This will restart a stopped background process. The current foreground process can often be stopped with <Ctrl>z. If you have stopped or background jobs, you have to type exit twice in row to log out.
Run any command (usually one that is going to take more time to complete) when the system load is low. I can logout, and the process will keep running. When the command completes, an email will be sent to me with the output. In the example above, the "at>" represents a prompt, the command to run is updatedb, and the <Ctrl><d> terminates my input to batch (I could start many commands to run, separated by <Enter>).
Execute a command at a specified time. You will be prompted for the command(s) to run, until you press <Ctrl>d. The associated commands are atq (display the queue of processes started with at) and atrm (remove a process from the "at queue").
Force a process shutdown. First determine the PID of the process to kill using ps.
Kill program(s) by name. For example, killall pppd will disconnect your dial-up network.
(=no hungup). Run program_name so that it does not terminate when you log out. Output is redirected to the file nohup.out in your home directory. You surely do not want to run an interactive program under nohup.
(in X terminal) Kill a GUI-based program with mouse. (Point with your mouse cursor at the window of the process you want to kill and click.)
(in X terminal) KDE process manager.
(as root) Check and control the printer(s). Type "?" to see the list of available commands.
Show the content of the printer queue. Under KDE (X-Windows), you may use GUI-based "Printer Queue" available from "K"menu-Utilities.
Remove a printing job "job_number" from the queue.
Run program_name adjusting its priority. Since the priority is not specified in this example, it will be increased by 10 (the process will run slower), from the default value (usually 0). The lower the number (of "niceness" to other users on the system), the higher the priority. The priority value may be in the range -20 to 19. Only root may specify negative values. Use top to display the priorities of the running processes.
renice -18 PID
(as root) Change the priority of a running process to minus 18. Normal users can only adjust processes they own, and only up from the current value (make them run slower). One could also renice +10 -u peter to make user peter use fewer cpu clicks so that other user don't suffer when he runs his computing-intensive tasks.
<Ctrl>c, <Ctrl>z, <Ctrl>s, and <Ctrl>q also belong to this chapter but they were described previously. In short they mean: stop the current command, send the current command to the background, stop the data transfer, resume the data transfer.
List the opened files. If I am a root, all files will be listed. I can limit myself to files opened by processes owned by the first console if I use lsof /dev/tty1 . To list only network files (useful for a security audit), I would do lsof -i (as root).
watch -n 60 my_command
Execute my_command repeatedly at 60-second intervals (the default interval is 2 seconds).
|UNIXguide.net||Suggest a Site|