General:Introduction |Explanations |Why Unix-like
Platforms:Linux |BSD
Quick Reference:Commands |Environment Variables |Files |License
uptime tells you how long the computer has been running since its last reboot or power-off.
Example:
$uptime22:27:49 up 10:14, 2 users, load average: 0.03, 0.32, 0.28
Links:
uname displays the system information such as hardware platform,system name and processor, Operating System type.
Example:
$uname -aLinux DarkBox 2.4.27-1-k6 #1 Wed Apr 14 19:00:29 UTC 2004 i586 GNU/Linux
Links:
dmesg display the messages from the kernel, since boot.
Example:
$dmesg
Tips:
While a UNIX system is booting, usually a lot of messages flash on the console screen in rapid succession; to view those messages after the system is booted, use the following command:
$dmesg | less
Using a command option,dmesg can filter the kernel messages, based on priority. The '-n 1' arguments will display only the panic messages:
$dmesg -n 1
Links:
free display used and free memory
Example:
$free total used free shared buffers cachedMem: 123260 119540 3720 0 8752 58096-/+ buffers/cache: 52692 70568Swap: 369452 63212 306240
Display in human readable form using MegaByte block sizes:
$free -m total used free shared buffers cachedMem: 120 116 3 0 8 56-/+ buffers/cache: 51 68Swap: 360 61 299
Tips:Display system memory usage every 5 seconds, use Ctl+c to exit:
$free -m -s 5 total used free shared buffers cachedMem: 120 116 3 0 8 56-/+ buffers/cache: 51 68Swap: 360 61 299
total used free shared buffers cachedMem: 120 116 3 0 8 55-/+ buffers/cache: 52 68Swap: 360 61 299
Links:
vmstat displays a compact summary of overall system activity (processes, memory, and cpu information).
Example:
$vmstatprocs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 2 0 63108 4484 7432 56480 8 11 93 45 1110 622 41 11 48 0
Tips:Print out vmstat summaries every two seconds, for five iterations.
$vmstat -n 2 5procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 1 0 63100 5172 7440 55892 8 10 90 44 1110 622 41 10 49 0 2 0 63100 5168 7440 55892 0 0 0 0 1120 559 32 3 65 0 1 0 63100 5160 7440 55892 0 0 0 0 1111 499 8 6 86 0 1 0 63100 5160 7440 55892 0 0 0 0 1113 505 12 3 85 0 1 0 63100 5168 7440 55892 0 0 0 0 1121 532 20 3 77 0
Links:
top displays system process in real time
Example:
$topTasks: 50 total, 2 running, 45 sleeping, 2 stopped, 1 zombieCpu(s): 40.9% user, 10.5% system, 0.0% nice, 48.7% idleMem: 123260k total, 119508k used, 3752k free, 7420k buffersSwap: 369452k total, 63036k used, 306416k free, 57212k cached
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 5340 arky 15 0 968 968 780 R 13.8 0.8 0:00.22 top 1408 root 6 -10 23712 6692 3252 S 1.5 5.4 3:39.58 [XFree86] 1 root 8 0 500 472 448 S 0.0 0.4 0:00.31 init [2] 2 root 9 0 0 0 0 S 0.0 0.0 0:01.60 [keventd] 3 root 19 19 0 0 0 S 0.0 0.0 0:00.02 [ksoftirqd_CPU0] 4 root 9 0 0 0 0 S 0.0 0.0 0:07.03 [kswapd] 5 root 9 0 0 0 0 S 0.0 0.0 0:00.00 [bdflush] 6 root 9 0 0 0 0 S 0.0 0.0 0:00.44 [kupdated] 154 root 9 0 0 0 0 S 0.0 0.0 0:00.00 [khubd] 562 root 9 0 604 588 508 S 0.0 0.5 0:05.09 /sbin/syslogd 565 root 9 0 1152 492 448 S 0.0 0.4 0:01.24 /sbin/klogd -c 3 .........
Links:
df reports the amount of free disk space available on each partition.
$dfFilesystem 1K-blocks Used Available Use% Mounted on/dev/md0 5763508 207380 5263352 4% //dev/md1 78819376 13722288 61093296 19% /home/dev/md4 23070564 4309572 17589056 20% /usr/dev/md2 5763508 1757404 3713328 33% /var/dev/md3 2877756 334740 2396832 13% /tmp
To report the number of free i-nodes
$df -iFilesystem Inodes IUsed IFree IUse% Mounted on/dev/hda3 321952 32558 289394 11% //dev/hda2 67320 67 67253 1% /boot/dev/mapper/vg00-home 372352 34227 338125 10% /home/dev/mapper/vg00-tmp 242784 11649 231135 5% /tmp/dev/mapper/vg00-usr 1821568 208669 1612899 12% /usr/dev/mapper/vg00-var 1282560 75704 1206856 6% /var
Reports disk usage in human readable format with block-sizes in Kilo,Mega,Gigabytes. This option is specific forWikipedia:GNU version ofdf.
$df -hFilesystem Size Used Avail Use% Mounted on/dev/hda1 2.3G 2.1G 133M 95% /tmpfs 61M 8.0K 61M 1% /dev/shm/dev/hda2 2.0G 1.8G 113M 94% /usr
In some of Unix systems (SYS V family i.e. HP-UX)df displays the information in a different way:
$df/home (/dev/vg01/lvol2 ): 262478 blocks 2647709 i-nodes/tmp (/dev/vg00/lvol5 ): 952696 blocks 125941 i-nodes/usr (/dev/vg00/lvol6 ): 132842 blocks 17633 i-nodes/var (/dev/vg00/lvol7 ): 131704 blocks 17288 i-nodes/stand (/dev/vg00/lvol1 ): 47548 blocks 13390 i-nodes/ (/dev/vg00/lvol3 ): 160772 blocks 21215 i-nodes
In such cases try to use bdf command.
Links:
hostname displays and set system host name
Example:
Display the host name:
$hostnameDarkstar
Display the IP address of the system:
$hostname -i61.95.196.52
Set the host name of the system to 'DarkHorse':
$hostname DarkHorseDarkHorse
Links: