You can also see a list of most intensive (time/memory) processes
by using top .
For example, right now on my machine top gives:
01:32:53 up 121 days, 15:32, 6 users, load average: 0.37, 0.13, 0.04
74 processes: 72 sleeping, 2 running, 0 zombie, 0 stopped
CPU0 states: 5.3% user 2.4% system 0.0% nice 0.0% iowait 91.3% idle
CPU1 states: 0.4% user 0.0% system 0.0% nice 0.0% iowait 99.1% idle
Mem: 1546840k av, 1530892k used, 15948k free, 0k shrd, 197516k buff
1089720k actv, 0k in_d, 30704k in_c
Swap: 2040212k av, 331624k used, 1708588k free 999456k cached
13119 root 15 0 113M 80M 1256 R 6.7 5.3 1132m 1 X
13220 onufriev 15 0 10992 7200 2896 S 0.7 0.4 63:27 1 gnome-panel
13238 onufriev 15 0 18864 10M 2996 S 0.7 0.6 76:59 0 gnome-termina
15995 onufriev 15 0 4720 4104 2148 S 0.1 0.2 181:42 0 metacity
31447 onufriev 15 0 1132 1132 804 R 0.1 0.0 0:00 1 top
1 root 15 0 480 452 424 S 0.0 0.0 1:19 0 init
2 root RT 0 0 0 0 SW 0.0 0.0 0:00 0 migration/0
3 root RT 0 0 0 0 SW 0.0 0.0 0:00 1 migration/1
4 root 15 0 0 0 0 SW 0.0 0.0 0:41 1 keventd
5 root 34 19 0 0 0 SWN 0.0 0.0 0:00 0 ksoftirqd_CPU
6 root 34 19 0 0
Job Scheduling
Precise scheduling of jobs can be done using the
- at (schedules a job at a particular time).
For example,
at now + 1 min
at> ls -l ./ > files.txt
at> ^D
will schedule ls -l ./ to be output into files.txt exactly one minute from now. To show jobs "in queue", do
atq
- cron (schedules repeated and monotonous jobs) commands.
Use crontab -l to list what is currently scheduled.
crontab -e to edit the contents. The last command opens the
the system ``crontab'' file (located in the ``/etc/'' directory)
for editing. The system uses your default editor, typically vim.
So, all you need to do is to put the scheduling information into this file, using the following format:
minute hour day month day of the week command
You can specify each time component as an integer number (eg. 1 through 12 for the months January through December), or specify one or more components as ``*'' characters which will be treated as wildcards (eg. * in the month component means the command will run at the given day and time in every month. Here are some examples:
# Mail the system logs at 4:30pm every June 15th.
30 16 15 06 * for x in /var/log/*; do cat ${x} | mail postmaster; done
# Inform the administrator, at midnight, of the changing seasons.
00 00 20 04 * echo 'Woohoo, spring is here!'
00 00 20 06 * echo 'Yeah, summer has arrived, time to hit the beach!'
00 00 20 10 * echo 'Fall has arrived. Get those jackets out. :-('
00 00 20 12 * echo 'Time for 4 months of misery. ;-('
Note that commands which produce output to standard out (i.e. a terminal) such as the examples above using ``echo'' will have their output mailed to the ``root'' account. This is default (and you don't need to invoke "mail" in this case). If you want to avoid this, simply pipe the output to the null device as follows:
00 06 * * * echo 'I bug the system administrator daily at 6:00am!' >/dev/null
Caveate: depending on your system's settings, regular users may not
have the permissions to edit the crontab file. If that's the case, you
can try to talk to your sys. admin to see if he is willing to change this
for you.