old-www/LDP/GNU-Linux-Tools-Summary/html/x5368.htm

1594 lines
20 KiB
HTML

<HTML
><HEAD
><TITLE
>Controlling Processes</TITLE
><META
NAME="GENERATOR"
CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK
REL="HOME"
TITLE="GNU/Linux Command-Line Tools Summary"
HREF="book1.htm"><LINK
REL="UP"
TITLE="Controlling the system"
HREF="c4975.htm"><LINK
REL="PREVIOUS"
TITLE="Shutting Down/Rebooting the System"
HREF="x5152.htm"><LINK
REL="NEXT"
TITLE="Controlling services"
HREF="x6066.htm"></HEAD
><BODY
CLASS="SECT1"
BGCOLOR="#FFFFFF"
TEXT="#000000"
LINK="#0000FF"
VLINK="#840084"
ALINK="#0000FF"
><DIV
CLASS="NAVHEADER"
><TABLE
SUMMARY="Header navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>GNU/Linux Command-Line Tools Summary</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
HREF="x5152.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
>Chapter 9. Controlling the system</TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="x6066.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="SECT1"
><H1
CLASS="SECT1"
><A
NAME="CONTROLLING-PROCESSES"
></A
>Controlling Processes</H1
><P
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>ps</DT
><DD
><P
><A
NAME="AEN5376"
></A
>Will give you a list <A
NAME="AEN5378"
></A
>of the processes <A
NAME="AEN5380"
></A
>running on your system. With no options, <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>ps</I
></SPAN
> will list processes <A
NAME="AEN5383"
></A
>that belong to the current user and have a controlling<A
NAME="AEN5385"
></A
> terminal.</P
><P
>Example options include:</P
><P
></P
><UL
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-aux</I
></SPAN
> --- list all running <A
NAME="AEN5392"
></A
>processes <A
NAME="AEN5394"
></A
>(by all users with some information).</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-a<A
NAME="AEN5399"
></A
></I
></SPAN
> --- list all processes from all users.</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u<A
NAME="AEN5404"
></A
></I
></SPAN
> --- list more information <A
NAME="AEN5406"
></A
>including user names, %cpu <A
NAME="AEN5408"
></A
>usage, and %mem <A
NAME="AEN5410"
></A
>usage et cetera.</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-x<A
NAME="AEN5415"
></A
></I
></SPAN
> --- list processes <A
NAME="AEN5417"
></A
>without controlling <A
NAME="AEN5419"
></A
>terminals.</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-l<A
NAME="AEN5424"
></A
></I
></SPAN
> --- display different information including UID <A
NAME="AEN5426"
></A
>and nice <A
NAME="AEN5428"
></A
>value.<A
NAME="AEN5430"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>--forest<A
NAME="AEN5435"
></A
></I
></SPAN
> --- this makes it easier to see the process <A
NAME="AEN5437"
></A
>hierarchy, which <A
NAME="AEN5439"
></A
>will give you an indication <A
NAME="AEN5441"
></A
>of how the various processes <A
NAME="AEN5443"
></A
>on your system interrelate<A
NAME="AEN5445"
></A
> (although you should also try <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pstree</I
></SPAN
>).</P
></LI
></UL
><P
>For example to list all running <A
NAME="AEN5449"
></A
>processes <A
NAME="AEN5451"
></A
>with additional <A
NAME="AEN5453"
></A
>information, simply type:</P
><PRE
CLASS="SCREEN"
>ps -aux</PRE
></DD
><DT
>pstree</DT
><DD
><P
><A
NAME="AEN5460"
></A
>Displays the processes <A
NAME="AEN5462"
></A
>in the form <A
NAME="AEN5464"
></A
>of a tree <A
NAME="AEN5466"
></A
>structure (similar to how <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>tree</I
></SPAN
> does it for directories). </P
><P
>Use the<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -p <A
NAME="AEN5471"
></A
></I
></SPAN
> option <A
NAME="AEN5473"
></A
>to show <A
NAME="AEN5475"
></A
>process id's.<A
NAME="AEN5477"
></A
></P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>pstree -p</PRE
><P
>This would list all processes <A
NAME="AEN5482"
></A
>and their id's.<A
NAME="AEN5484"
></A
></P
></DD
><DT
>pgrep</DT
><DD
><P
><A
NAME="AEN5490"
></A
>This command is useful for finding <A
NAME="AEN5492"
></A
>the process id <A
NAME="AEN5494"
></A
>of a particular<A
NAME="AEN5496"
></A
> process when you know part <A
NAME="AEN5498"
></A
>of its name. </P
><P
>Use the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-l<A
NAME="AEN5502"
></A
></I
></SPAN
> option to list the name of the process as well and the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u<A
NAME="AEN5505"
></A
></I
></SPAN
> option to search <A
NAME="AEN5507"
></A
>via a particular user(s).</P
><P
>Normally <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pgrep</I
></SPAN
> will only return <A
NAME="AEN5511"
></A
>the pid <A
NAME="AEN5513"
></A
>number; this way you can use it with other commands.</P
><P
>Examples:</P
><PRE
CLASS="SCREEN"
>kill $(pgrep mozilla)</PRE
><P
>This would kill <A
NAME="AEN5518"
></A
>any process name that starts <A
NAME="AEN5520"
></A
>with mozilla.<A
NAME="AEN5522"
></A
> Note that this is the same as using <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pkill</I
></SPAN
> (see below).</P
><P
>If you are unfamiliar <A
NAME="AEN5526"
></A
>with the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>$(&nbsp;)</I
></SPAN
> part <A
NAME="AEN5529"
></A
>of this command, please refer <A
NAME="AEN5531"
></A
>to <A
HREF="x2622.htm"
>the Section called <I
>Performing more than one command</I
> in Chapter 6</A
>.</P
><P
>To list processes id's and names type:</P
><PRE
CLASS="SCREEN"
>pgrep -l process_name</PRE
></DD
><DT
>top</DT
><DD
><P
><A
NAME="AEN5540"
></A
>Displays the 'top' (as in <SPAN
CLASS="ACRONYM"
>CPU</SPAN
> <A
NAME="AEN5543"
></A
>usage) processes,<A
NAME="AEN5545"
></A
> provides <A
NAME="AEN5547"
></A
>more detail<A
NAME="AEN5549"
></A
> than <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>ps</I
></SPAN
>. </P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>top</I
></SPAN
> also provides <A
NAME="AEN5554"
></A
>an updated <A
NAME="AEN5556"
></A
>display, it has many options <A
NAME="AEN5558"
></A
>that make it fully customisable,<A
NAME="AEN5560"
></A
> refer <A
NAME="AEN5562"
></A
>to the manual or info <A
NAME="AEN5564"
></A
>page <A
NAME="AEN5566"
></A
>for details. </P
></DD
><DT
>kill</DT
><DD
><P
>To kill processes <A
NAME="AEN5572"
></A
>on your system, you will need their pid's <A
NAME="AEN5574"
></A
>or id's<A
NAME="AEN5576"
></A
> . Use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>ps</I
></SPAN
> or <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pstree</I
></SPAN
> to find <A
NAME="AEN5580"
></A
>out the process id's <A
NAME="AEN5582"
></A
>(pid's), or use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>jobs</I
></SPAN
> to find out id's.<A
NAME="AEN5585"
></A
></P
><DIV
CLASS="TIP"
><BLOCKQUOTE
CLASS="TIP"
><P
><B
>killall and pkill - kill a process by name: </B
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pkill</I
></SPAN
> and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall </I
></SPAN
>can be a lot easier to use than <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>kill</I
></SPAN
>. <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pkill</I
></SPAN
> allows you to type part of the name of a process to kill it, while <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall</I
></SPAN
> requires the full process name. See below for more information.</P
></BLOCKQUOTE
></DIV
><P
>Examples:</P
><PRE
CLASS="SCREEN"
>kill pid</PRE
><P
>Simply kill a process (allow it time <A
NAME="AEN5598"
></A
>to save <A
NAME="AEN5600"
></A
>it's files and exit)</P
><PRE
CLASS="SCREEN"
>kill %id</PRE
><P
>Same as above, except it uses an id <A
NAME="AEN5604"
></A
>instead of a pid,<A
NAME="AEN5606"
></A
> you need to use a % (percent) when using an id <A
NAME="AEN5608"
></A
>to kill.</P
><PRE
CLASS="SCREEN"
>kill -kill pid<A
NAME="AEN5611"
></A
></PRE
><P
>Force <A
NAME="AEN5614"
></A
>a process to be killed <A
NAME="AEN5616"
></A
>(won't allow <A
NAME="AEN5618"
></A
>files to be saved <A
NAME="AEN5620"
></A
>or updated); only use when necessary because all data <A
NAME="AEN5622"
></A
>that the program <A
NAME="AEN5624"
></A
>had will be lost.<A
NAME="AEN5626"
></A
></P
><P
>There are also many other kill options such as kill -HUP<A
NAME="AEN5629"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> </I
></SPAN
>(hangup)<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>...</I
></SPAN
> refer <A
NAME="AEN5633"
></A
>to the manual/info pages <A
NAME="AEN5635"
></A
>for more <A
NAME="AEN5637"
></A
>information.</P
></DD
></DL
></DIV
><P
></P
><P
></P
><DIV
CLASS="VARIABLELIST"
><DL
><DT
>killall</DT
><DD
><P
><A
NAME="AEN5645"
></A
>Kill a process by it's name, uses names instead of process <A
NAME="AEN5647"
></A
>id's<A
NAME="AEN5649"
></A
> (pid's). Use<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -v <A
NAME="AEN5652"
></A
></I
></SPAN
>to have <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall</I
></SPAN
> report <A
NAME="AEN5655"
></A
>whether the kill <A
NAME="AEN5657"
></A
>was successful <A
NAME="AEN5659"
></A
>or not and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> -i <A
NAME="AEN5662"
></A
></I
></SPAN
>for interactive <A
NAME="AEN5664"
></A
>mode (will prompt <A
NAME="AEN5666"
></A
>you before attempting <A
NAME="AEN5668"
></A
>to kill).</P
><DIV
CLASS="TIP"
><BLOCKQUOTE
CLASS="TIP"
><P
><B
>pkill - a little like a killall with regular expressions: </B
>pkill is another command that allows processes to be killed but does so using regular expressions. See below for more information.</P
></BLOCKQUOTE
></DIV
><P
>For example:</P
><PRE
CLASS="SCREEN"
>killall -iv mozilla</PRE
><P
>Would kill anything named <A
NAME="AEN5676"
></A
>&ldquo;mozilla&rdquo; and prompt <A
NAME="AEN5678"
></A
>you before each kill and report <A
NAME="AEN5680"
></A
>whether the kill was successful<A
NAME="AEN5682"
></A
> or not. Unfortunately <A
NAME="AEN5684"
></A
>you need to get the name exactly <A
NAME="AEN5686"
></A
>right for <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall</I
></SPAN
> to work, you would need to use &ldquo;mozilla-bin&rdquo; to kill the mozilla <A
NAME="AEN5689"
></A
>browser. If you want something where you don't need to know the exact <A
NAME="AEN5691"
></A
>name try <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> pkill </I
></SPAN
>(below).</P
></DD
><DT
>pkill</DT
><DD
><P
><A
NAME="AEN5698"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pkill</I
></SPAN
> is used to kill processes <A
NAME="AEN5701"
></A
>according to an extended <A
NAME="AEN5703"
></A
>regular expression.<A
NAME="AEN5705"
></A
> Use the <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u<A
NAME="AEN5708"
></A
></I
></SPAN
> option to kill using a user name(s) and process name (for example to only kill a process of a certain user). <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>pkill</I
></SPAN
> can also send <A
NAME="AEN5711"
></A
>specific signals <A
NAME="AEN5713"
></A
>to processes.<A
NAME="AEN5715"
></A
></P
><P
>For normal <A
NAME="AEN5718"
></A
>usage simply type:</P
><PRE
CLASS="SCREEN"
>pkill process_name</PRE
><P
>Note that the &ldquo;process_name&rdquo; doesn't have to be an exact match...</P
><P
>Or to kill the &ldquo;process_name&rdquo; of only the users &ldquo;fred&rdquo; and &ldquo;anon&rdquo; type:</P
><PRE
CLASS="SCREEN"
>pkill -u fred anon process_name</PRE
></DD
><DT
>skill</DT
><DD
><P
><A
NAME="AEN5728"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>skill</I
></SPAN
> is used to send <A
NAME="AEN5731"
></A
>a command/username/tty a particular <A
NAME="AEN5733"
></A
>signal.<A
NAME="AEN5735"
></A
></P
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>skill</I
></SPAN
> has a number <A
NAME="AEN5739"
></A
>of options <A
NAME="AEN5741"
></A
>available <A
NAME="AEN5743"
></A
>to ensure correct <A
NAME="AEN5745"
></A
>interpretation (otherwise it just guesses what it is), simply type<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> skill <A
NAME="AEN5748"
></A
>-option(s)</I
></SPAN
></P
><P
></P
><UL
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-L<A
NAME="AEN5754"
></A
></I
></SPAN
> --- list <A
NAME="AEN5756"
></A
>the various signals <A
NAME="AEN5758"
></A
>that can be sent</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u<A
NAME="AEN5763"
></A
></I
></SPAN
> --- specify <A
NAME="AEN5765"
></A
>a username; this is obviously followed <A
NAME="AEN5767"
></A
>by the user name or a space-seperated <A
NAME="AEN5769"
></A
>list of usernames.<A
NAME="AEN5771"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-p<A
NAME="AEN5776"
></A
></I
></SPAN
> --- process id <A
NAME="AEN5778"
></A
>(followed by the process id)</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-c<A
NAME="AEN5783"
></A
></I
></SPAN
> --- command name (this is the same as <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall</I
></SPAN
>)</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-t<A
NAME="AEN5789"
></A
></I
></SPAN
> --- (tty number)</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-v<A
NAME="AEN5794"
></A
></I
></SPAN
> --- verbose <A
NAME="AEN5796"
></A
>mode <A
NAME="AEN5798"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-i<A
NAME="AEN5803"
></A
></I
></SPAN
> --- interactive <A
NAME="AEN5805"
></A
>mode.</P
></LI
></UL
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>skill</I
></SPAN
> can be used to stop,<A
NAME="AEN5809"
></A
> continue, or kill processes <A
NAME="AEN5811"
></A
>using the username,<A
NAME="AEN5813"
></A
> command name or process id (or send <A
NAME="AEN5815"
></A
>them any variety <A
NAME="AEN5817"
></A
>of signals <A
NAME="AEN5819"
></A
>you like). </P
><P
>Useful example:</P
><PRE
CLASS="SCREEN"
>skill -STOP<A
NAME="AEN5823"
></A
> abusive_user_name</PRE
><P
>The above command will stop <A
NAME="AEN5826"
></A
>all of that users processes,<A
NAME="AEN5828"
></A
> this will cause<A
NAME="AEN5830"
></A
> his screen <A
NAME="AEN5832"
></A
>to freeze <A
NAME="AEN5834"
></A
>until you type:</P
><PRE
CLASS="SCREEN"
>skill -CONT<A
NAME="AEN5837"
></A
> abusive_user_name</PRE
><P
>This would tell <A
NAME="AEN5840"
></A
>that all processes <A
NAME="AEN5842"
></A
>may continue as before. Note that this would only work if you are root.<A
NAME="AEN5844"
></A
> Also note you can list more than one user name with the command so it will apply <A
NAME="AEN5846"
></A
>to multiple <A
NAME="AEN5848"
></A
>users.</P
></DD
><DT
><B
CLASS="KEYCAP"
>CTRL</B
>-<B
CLASS="KEYCAP"
>C</B
>
<A
NAME="AEN5855"
></A
></DT
><DD
><P
>The break key,<A
NAME="AEN5859"
></A
> will kill (break, stop) something that's running<A
NAME="AEN5861"
></A
> on your terminal.<A
NAME="AEN5863"
></A
></P
></DD
><DT
>jobs</DT
><DD
><P
><A
NAME="AEN5869"
></A
>Prints <A
NAME="AEN5871"
></A
>currently running <A
NAME="AEN5873"
></A
>jobs, as in processes <A
NAME="AEN5875"
></A
>you have executed within the shell.<A
NAME="AEN5877"
></A
></P
></DD
><DT
>bg</DT
><DD
><P
><A
NAME="AEN5883"
></A
>Backgrounds <A
NAME="AEN5885"
></A
>a process. To start <A
NAME="AEN5887"
></A
>a program in the background <A
NAME="AEN5889"
></A
>(so it doesn't take over the terminal) use an &ldquo;&amp;&rdquo; (ampersand) sign <A
NAME="AEN5891"
></A
>at the end of the command. You usually use
<B
CLASS="KEYCAP"
>CTRL</B
>-<B
CLASS="KEYCAP"
>Z</B
>
<A
NAME="AEN5896"
></A
>
to suspend <A
NAME="AEN5898"
></A
>something you are currently using. You can simply use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>bg</I
></SPAN
> to resume in the background the last job suspended...</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>bg job_number</PRE
><P
>or</P
><PRE
CLASS="SCREEN"
>bg job_name</PRE
></DD
><DT
>fg</DT
><DD
><P
><A
NAME="AEN5909"
></A
>Bring a process to the foreground,<A
NAME="AEN5911"
></A
> so you can interact <A
NAME="AEN5913"
></A
>with it. The process will use your current terminal.<A
NAME="AEN5915"
></A
> Note simply use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>fg</I
></SPAN
> to foreground the last job number suspended... </P
><P
>You can bring jobs <A
NAME="AEN5919"
></A
>to the foreground <A
NAME="AEN5921"
></A
>by name or by number (use <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>jobs</I
></SPAN
> to find the number).</P
><P
>Command syntax:</P
><PRE
CLASS="SCREEN"
>fg job_number</PRE
><P
>or </P
><PRE
CLASS="SCREEN"
>fg job_name</PRE
></DD
><DT
>nice</DT
><DD
><P
><A
NAME="AEN5932"
></A
>Sets <A
NAME="AEN5934"
></A
>the priority <A
NAME="AEN5936"
></A
>for a process.<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> nice -20</I
></SPAN
> is the maximum <A
NAME="AEN5939"
></A
>priority <A
NAME="AEN5941"
></A
>(only administrative <A
NAME="AEN5943"
></A
>users can assign <A
NAME="AEN5945"
></A
>negative priorities),<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> nice 20</I
></SPAN
> is the minimum <A
NAME="AEN5948"
></A
>priority. You must <A
NAME="AEN5950"
></A
>be root to give a process a higher <A
NAME="AEN5952"
></A
>priority, but you can always lower the priority of your own processes... </P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>nice -20 make</PRE
><P
>Would execute <A
NAME="AEN5957"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>make</I
></SPAN
> and it would run <A
NAME="AEN5960"
></A
>at maximum priority.<A
NAME="AEN5962"
></A
></P
></DD
><DT
>renice</DT
><DD
><P
><A
NAME="AEN5968"
></A
>Changes the priority of an existing <A
NAME="AEN5970"
></A
>command. You may use the options <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u<A
NAME="AEN5973"
></A
></I
></SPAN
> to change <A
NAME="AEN5975"
></A
>the priorities <A
NAME="AEN5977"
></A
>of all processes <A
NAME="AEN5979"
></A
>for a particular user name and <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-g<A
NAME="AEN5982"
></A
></I
></SPAN
> to change <A
NAME="AEN5984"
></A
>priorities for all processes <A
NAME="AEN5986"
></A
>of a particular group.<A
NAME="AEN5988"
></A
> The default <A
NAME="AEN5990"
></A
>is to change <A
NAME="AEN5992"
></A
>via the process id number.</P
><P
>Example:</P
><PRE
CLASS="SCREEN"
>renice +20 2222</PRE
><P
>This would change <A
NAME="AEN5997"
></A
>the priority <A
NAME="AEN5999"
></A
>of process 2222 to +20 (minimum priority).</P
></DD
><DT
>snice</DT
><DD
><P
><A
NAME="AEN6005"
></A
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>snice</I
></SPAN
> works very similarly to <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>skill</I
></SPAN
>, only it changes the priority <A
NAME="AEN6009"
></A
>of the process(es). Its function <A
NAME="AEN6011"
></A
>is similar to that of <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>renice</I
></SPAN
>.</P
><P
>To use options (to ensure correct <A
NAME="AEN6015"
></A
>interpretation) you simply type<SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
> snice -option(s):</I
></SPAN
></P
><P
></P
><UL
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-u</I
></SPAN
> --- specify <A
NAME="AEN6022"
></A
>a username; this is obviously followed <A
NAME="AEN6024"
></A
>by the user name or a space-seperated <A
NAME="AEN6026"
></A
>list of usernames.<A
NAME="AEN6028"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-p</I
></SPAN
> --- process id <A
NAME="AEN6033"
></A
>(followed by the process id)</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-c</I
></SPAN
> --- command name (this is the same as <SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>killall</I
></SPAN
>)</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-t</I
></SPAN
> --- tty number</P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-v</I
></SPAN
> --- verbose <A
NAME="AEN6045"
></A
>mode <A
NAME="AEN6047"
></A
></P
></LI
><LI
><P
><SPAN
CLASS="emphasis"
><I
CLASS="EMPHASIS"
>-i<A
NAME="AEN6052"
></A
></I
></SPAN
> --- interactive <A
NAME="AEN6054"
></A
>mode.</P
></LI
></UL
><P
>Example:</P
><PRE
CLASS="SCREEN"
>snice -10 -u root</PRE
><P
>This would increase <A
NAME="AEN6059"
></A
>the priority <A
NAME="AEN6061"
></A
>of all root's processes.<A
NAME="AEN6063"
></A
></P
><P
></P
></DD
></DL
></DIV
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
SUMMARY="Footer navigation table"
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="x5152.htm"
ACCESSKEY="P"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="book1.htm"
ACCESSKEY="H"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="x6066.htm"
ACCESSKEY="N"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>Shutting Down/Rebooting the System</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="c4975.htm"
ACCESSKEY="U"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Controlling services</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>