background preloader

Process management (Unix & Linux)

Facebook Twitter

Process Subsitution

Kill & Killall (bourne shell) Pidof (bash/sh command) Run Process Independently of Parent Process. Introspection (Process Managment) Wait (command) Wait normally returns the exit status of the last job which terminated.

wait (command)

It may also return 127 in the event that n specifies a non-existent job or zero if there were no jobs to wait for. Because wait needs to be aware of the job table of the current shell execution environment, it is usually implemented as a shell builtin. This command can be useful where part of a script can execute in parallel to implement a barrier where an upcoming section depends on the successful completion of the preceding sections.

The following example will fetch the src/ directory from a machine named iona using rsync and simultaneously update the libraries on which this program depends, before building the combination. #! Wait for specified job control id number: $ ls -R / > /dev/null 2>&1 & # start any long running background process[2] 1986 $ wait %2 # waits for background job number 2 to terminate, then returns GNU bash reference manual. Time (Unix) This article is about the Unix command.

time (Unix)

For Unix's means of representing points in time, see Unix time. For the Unix function call, see time.h. To use the command, simply precede any command by the word time, such as: When the command completes, time will report how long it took to execute the ls command in terms of user CPU time, system CPU time, and real time. The output format varies between different versions of the command, and some give additional statistics, as in this example: $ time host has address 0.000u 0.000s 0:00.17 0.0% 0+0k 0+0io 0pf+0w $ time(1) can exist as a standalone program (such as GNU time) or as a shell builtin (e.g. in tcsh or in zsh). The term "real time" in this context refers to elapsed "wall clock" time, like using a stop watch.

According to the source code of the GNU implementation of time, most information shown by time is derived from the wait3 system call.

Process Priority (e.g. nice)

Kill (command) Unix provides security mechanisms to prevent unauthorized users from killing other processes.

kill (command)

Essentially, for a process to send a signal to another, the owner of the signaling process must be the same as the owner of the receiving process or be the superuser. The available signals all have different names, and are mapped to certain numbers. It is important to note that the specific mapping between numbers and signals can vary between Unix implementations. SIGTERM is often numbered 15 while SIGKILL is often numbered 9. A process can be sent a SIGTERM signal in four ways (the process ID is '1234' in this case): kill 1234kill -s TERM 1234kill -TERM 1234kill -15 1234 The process can be sent a SIGKILL signal in three ways: kill -s KILL 1234kill -KILL 1234kill -9 1234 Microsoft Windows XP, Vista and 7 include the command taskkill[1] to terminate processes. Find all processes beginning with the letter "p" that were developed by Microsoft and use more than 10 MB of memory and kill them:

Fuser (Unix) $ fuser -m -u /mnt/usb1 /mnt/usb1: 1347c(root) 1348c(guido) 1349c(guido) fuser displays the PIDs of processes using the specified files or file systems.

fuser (Unix)

In the default display mode, each file name is followed by a letter denoting the type of access: c current directory. e executable being run. f open file. open file for writing. r root directory. m mmap'ed file or shared library. Fg (Unix) Fg: run jobs in the foreground – Commands & Utilities Reference, The Single UNIX® Specification, Issue 7 from The Open Group.

fg (Unix)

Bg (Unix) At (Unix) More precisely, it reads a series of commands from standard input and collects them into one "at-job" which is carried out at a later date.

at (Unix)

The at-job inherits the current environment, so that it is executed in the same working directory and with the same environment variables set as when it was scheduled. It differs from cron, which is used for recurring executions (e.g. once an hour, every Tuesday, January 1 every year). As with cron, many Unix systems allow the administrator to restrict access to the at command. At (Unix) Process Management (Linux Kernal) Running programms. Process (special variables) Programming (Bourne Shell) Basic Commands (Bourne shell compatible) Linux/unix (Bourne shell compatible)

Shells (Unix & Linux)