1) jobs = lists the jobs that you are running in the background and in the foreground
Syntax
jobs [-p | -l] [-n] [-p] [-x] [job id]
If the prompt is returned with no information no jobs are present
jobs -p : list only the PID of process group leader
jobs -l : list only jobs that have change status since last notified by their status
jobs -r : resrict output to running jobs
jobs – s : restrict output to stopped jobs
.
2) bg = place a job in background
Normally user can run a job in background, by adding & at end of the
command (ex: sleep 10 &).
bg is a shell command. It is used to move a job from foreground to the
background, as if it had been started with `&’. If JOB is not present,
the shell’s notion of the current job is used.
Examples (follow all the steps below)
a) $ sleep 100 — Start a dummy job in foreground. (sleep = waits a x amount of second)
Press Ctrl+z to stop the current job.
b) $ bg — Move the last stopped job to background.
c) $ sleep 150 — Dummy job 1
Press Ctrl+z to stop the current job.
d) $ sleep 140 — Dummy job 2
Press Ctrl+z to stop the current job.
e) $ sleep 130 — Dummy job 3
Press Ctrl+z to stop the current job.
f) $ jobs — List all active jobs.
g) $ bg 2 — Move the 2nd active job to background.
.
.3) fg = continues a stopped job by running it in the foreground
Examples
fg – Typing fg alone will resume the first job were it was left off.
fg 1 – specifying the job (in this case 1) will resume that particular job. The job id can be determined by running bg
.
4) nice = run a command with modified priority
nice command is used to run the given command with its scheduling
priority adjusted. Priority range goes from -20 (highest priority)
to 19 (lowest priority).
Examples:
$ nice — Prints the current priority value.
$ nice ls — Increment the priority value of the ls command
by 10 (Default value) and run.
$ nice -n 5 ls — Increment the priority value of the ls command
by 5 and run.
# nice -n -2 ls — Decrement the priority value of the ls command by
-2 and run.
NOTE: Incrementing the priority value will reduce the priority level
and vice versa. Priority range is -20 (high) to 19 (low).
.
5) renice = renice is used to alters the scheduling priority of one or more
running processes, priority range goes from -20 (highest priority)
to 19 (lowest priority).
Examples:
$ renice +1 123 — Increment the priority value of a process, which
process ID is 123.
# renice +1 123 — Decrement the priority value of a process, which
process ID is 123. (Root only can decrement ).
$ renice +1 -p 123 -p 200 — Same as above. Here no. of process is 2.
$ renice +1 -u sbharathi — Increment the priority value of all
processes, which is owned by a user (sbharathi).
$ renice +1 -g backup — Increment the priority value of all
processes, which is owned by a group (backup).
NOTE: Incrementing the priority value will reduce the priority level
and vice versa. Priority range is -20 (high) to 19 (low).
.
6) at = schedules a command to be ran at a particular time, such as a print job late at night
Syntax
at – executes commands at a specified time.
atq – lists the user’s pending jobs, unless the user is the superuser; in that case, everybody’s jobs are listed. The format of the output lines (one for each job) is: Job number, date, hour, job class.
atrm – deletes jobs, identified by their job number.
batch – executes commands when system load levels permit; in other words, when the load average drops below 1.5, or the value specified in the invocation of atrun.
at -m 01:35 < atjob = Run the commands listed in the ‘atjob’ file at 1:35AM, in addition all output that is generated from job mail to the user running the task. When this command has been successfully enter you should receive a prompt similar to the below example.
commands will be executed using /bin/csh
job 1072250520.a at Wed Dec 24 00:22:00 2003
at -l = This command will list each of the scheduled jobs as seen below.
1072250520.a Wed Dec 24 00:22:00 2003
at -r 1072250520.a = Deletes the job just created.
or
atrm 23 = Deletes job 23.
If you wish to create a job that is repeated you could modify the file that executes the commands with another command that recreates the job or better yet use the crontab command.
Note: Performing just the at command at the prompt will give you an error “Garbled Time”, this is a standard error message if no switch or time setting is given.
.
7) top = provide information (frequently refreshed) about the most CPU-intensive processes currently running
Description of the fields
- a: PID — Process Id
- The task’s unique process ID, which periodically wraps, though never restarting at zero.
- b: PPID — Parent Process Pid
- The process ID of a task’s parent.
- c: RUSER — Real User Name
- The real user name of the task’s owner.
VIRT = SWAP + RES.
RES = CODE + DATA.
‘D’ = uninterruptible sleep
‘R’ = running
‘S’ = sleeping
‘T’ = traced or stopped
‘Z’ = zombieTasks shown as running should be more properly thought of as ‘ready to run’ — their task_struct is simply represented on the Linux run-queue. Even without a true SMP machine, you may see numerous tasks in this state depending on top’s delay interval and nice value.
Either form of display is subject to potential truncation if it’s too long to fit in this field’s current width. That width depends upon other fields selected, their order and the current screen width.
Note: The ‘Command’ field/column is unique, in that it is not fixed-width. When displayed, this column will be allocated all remaining screen width (up to the maximum 512 characters) to provide for the potential growth of program names into command lines.
increased by over 700Kb. Your only means of reducing that overhead
will be to stop and restart top.
.
Interactive commands
While top is running you may issue some options that will interact immediately with top these options are:
- h
- Help, displays a summary of command that will modify the behavior of top
- k
- Kills a process, you will be able to kill only your own processes, unless you are running top as root
- n
- Once this command is entered top will ask you how many lines you want on your screen, if you enter 0 top will display as much as it can
- q
- Exits top
- r
- Change the priority of a process, as well as with k you will only be able to act on your own processes unless you are root
- W
- Writes the current configuration to your personal configuration file, which is $HOME/.toprc

Leave a Reply