Resources on your linux system

Getting info on how much disk space you have available, memory usage, programs that uses to much cpu-power etc. is valuable information. Diskusage command du have already been shown to show filesizes but it can also just show much space you use in home directory as:

du -sm ~

Diskspace

Overall diskspace is shown with the command df and it will display human readable values with the -h option, f.ex.:

[martin@odin ~]$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/hda3              73G   34G   36G  49% /
/dev/hda1              99M  7.0M   87M   8% /boot
none                  316M     0  316M   0% /dev/shm
[martin@odin ~]$

Memory

Show memory usage with the command free. Any good OS tries to use all available memory to cache programs so they are ready available.

[martin@odin ~]$ free
             total       used       free     shared    buffers     cached
Mem:        645436     637568       7868          0      30352     267256
-/+ buffers/cache:     339960     305476
Swap:       987988        340     987648
[martin@odin ~]$

Programs listed dynamically with top

The top program may list your running programs dynamically and allow to show only one user by pressing (u) and then type the name. Use it to find processes and kill them or find out what is using all the cpu or memory.

top - 17:27:42 up 11 days,  1:14,  5 users,  load average: 0.38, 0.39, 0.38
Tasks: 122 total,   2 running, 120 sleeping,   0 stopped,   0 zombie
Cpu(s): 10.3% us,  4.0% sy,  0.0% ni, 85.4% id,  0.0% wa,  0.3% hi,  0.0% si
Mem:    645436k total,   638048k used,     7388k free,    30544k buffers
Swap:   987988k total,      340k used,   987648k free,   267316k cached

  PID   USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
  10415 martin    15   0 56756 8320 5352 S  7.3  1.3  29:42.00 xmms
   4609 root      15   0 93080  38m 7704 S  2.6  6.2  68:31.37 X
  10570 martin    15   0 41176  15m 8848 S  2.3  2.4   1:00.68 gnome-terminal
  11934 martin    16   0  1956  984  756 R  1.0  0.2   0:00.11 top
  10467 martin    15   0 20820 8532 7004 S  0.7  1.3   0:54.91 multiload-apple
   3358 root      16   0  2724  544  456 S  0.3  0.1  14:46.74 nifd
  10403 martin    15   0 14876 7728 6188 S  0.3  1.2   0:36.91 metacity
  10465 martin    15   0 21544 8600 6544 S  0.3  1.3   0:29.37 gnome-netstatus
  11383 martin    16   0  181m  66m  44m S  0.3 10.6   3:46.26 soffice.bin
      1 root      16   0  1696  552  476 S  0.0  0.1   0:02.35 init
      2 root      34  19     0    0    0 S  0.0  0.0   0:00.87 ksoftirqd/0
      3 root      10  -5     0    0    0 S  0.0  0.0   0:02.22 events/0
      4 root      10  -5     0    0    0 S  0.0  0.0   0:00.03 khelper
      5 root      14  -5     0    0    0 S  0.0  0.0   0:00.00 kthread
      7 root      10  -5     0    0    0 S  0.0  0.0   0:00.00 kblockd/0
     10 root      15   0     0    0    0 S  0.0  0.0   0:00.02 khubd
     75 root      15   0     0    0    0 S  0.0  0.0   0:02.07 pdflush
     76 root      15   0     0    0    0 S  0.0  0.0   0:00.84 pdflush

So this shows that the system have been up for 11 days. Currently 5 users including local terminals. The load average gives you some indication on how the system is performing at time=1,5, and 10 minutes. If you want a deeper understanding of the load average, then check this extensive pdf out. There are currently 122 process running in various states and the CPU is utilized at 10.3% in userspace, 4.0% for the system and other info. This system have a total of 645436k memory of which most is used, which is perfectly okay. Also there is perhaps to much disk space used for swap-memory 987988k.

Valid XHTML 1.0 Transitional