Open main menu

CDOT Wiki β

Changes

Tutorial8: Links / Process Management

713 bytes added, 13:00, 5 February 2020
no edit summary
<table cellpadding="5" width="80%"><tr valign="top"><th width="25%" style="border-bottom: 1px solid black;text-align:left;">Linux Command / Key Combination</th><th style="border-bottom: 1px solid black;text-align:left;">Purpose</th></tr><tr valign="top"><td>'''ps'''</td><td>The '''ps''' (''process status'') command displays snapshot information about processes. By default, the ps command displays information only about the current terminal ('''ps -l''' provides a detailed listing, '''ps -U''' username shows all)<br><br>''Examples: ''<span style="font-family:courier;font-weight:bold">ps , ps -l , ps -ef , ps -u , ps aux</span><br></td></tr><tr valign="top"><td>'''top'''</td><td>The '''top''' command provides a continuous update including resource usage<br>'''NOTE:''' You can press '''ctrl-c''' to exit<br></td></tr><tr valign="top"><td>'''fg'''</td><td>The '''fg''' (foreground) command moves a background job from the current environment into the foreground. The fg command issued without arguments will place the most recent process in the background to the foreground. ''Example: ''<span style="font-family:courier;font-weight:bold">fg %job-number</span></td></tr><tr valign="top"><td><span style="font-family:courier;">'''&lt;ctrl&gt;&lt;c&gt;'''</span></td><td>'''Terminates''' a process running in the foreground</td></tr><tr valign="top"><td><span style="font-family:courier;">'''&lt;ctrl&gt;&lt;z&gt;'''</span></td><td>Sends a process running in the foreground into the '''background'''.</td></tr><tr valign="top"><td>'''bg'''</td><td>The '''bg''' utility shall resume suspended jobs from the current environment. The bg command issued without arguments will run the most recent process that was placed into the background.<br>''Example: ''<span style="font-family:courier;font-weight:bold">bg %job-number</span></td></tr><tr valign="top"><td>'''jobs'''</td><td>The '''jobs''' utility shall display the status of jobs that were started in the current shell environment<br>''Examples:<br>''<span style="font-family:courier;">jobs<br>[1]+ Stopped vim a <span style="font-size:8pt;">&nbsp; &lt;-- Job #1 (+ means most recent process sent to background)</span><br>[2]&nbsp; Running sleep 200 & <span style="font-size:8pt;">&nbsp;&lt;-- Job #2</span><br>[3] &nbsp;Running sleep 300 & <span style="font-size:8pt;">&nbsp;&lt;-- Job #3</span><br>[4]- Running sleep 400 &<span style="font-size:8pt;">&nbsp; &lt;-- Job #4 (- means second recent process sent to background)</span><br><br></span></td></tr><tr valign="top"><td>'''kill'''</td><td>The kill command sends the specified signal to the specified processes or process groups. If no signal is specified, the TERM signal is sent. The default action for this signal is to terminate the process.<br>''Examples:''<br><span style="font-family:courier;font-weight:bold;">kill PID , kill -9 PID , kill %job-number , <br>kill -9 %job-number</span></td></tr></table>
 
 
===Aliases / Command History===
 
 
alias
assigns a new name to an existing utility
eg. alias
will display all the aliases currently set
eg. alias dir=ls
eg. alias ls='ls -al'
eg. alias clearfile='cat /dev/null >'
can be useful, but can also make your scripts cryptic
your scripts won't be useable by others, unless they use the same aliases
 
 
Command History
.bash_history is used to store recently executed command lines
<Up> or <Down> - move to previous command or next command
fc -l - display last 16 commands
history - display all stored commands
!num - re-execute command number "num"
!xxx - re-execute last command beginning with string "xxx"
 
 
=INVESTIGATION 1: LINKING FILES=
13,420
edits