next up previous contents index
Next: Basic Shell Scripts Up: Linux Shell Environment Previous: Finding Files   Contents   Index

Information About the System

Sometimes it is important to know about your system and the environment in which you are working. Seeing the environment is quite easy. You can just type:

bash$ env

This of course is a little bit long and hard to read. For specific information there are often simple commands. To know which user you are logged in as you can type:

bash$ whoami
bob

That is nice, but what machine am I logged into?

bash$ hostname
bob.bobnet.com

Well, what about my processor and other things like that? You can see a lot of information in your /proc/ directory. /proc/ is not a normal directory and is sometimes very strange. Files are constantly updated there. This is really, in a way, a shell interface with the kernel. Let's look at some statistics listed inside of the /proc/cpuinfo file:

bash$ cat /proc/cpuinfo
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 8
model name	: Pentium III (Coppermine)
stepping	: 1
cpu MHz		: 598.632
cache size	: 256 KB
fdiv_bug	: no
hlt_bug		: no
f00f_bug	: no
coma_bug	: no
fpu		: yes
fpu_exception	: yes
cpuid level	: 2
wp		: yes
flags		: fpu vme de pse tsc msr pae mce cx8 sep mtrr pge mca cmov
pat pse36 mmx fxsr sse
bogomips	: 1196.03

This tells you a lot of information about the first processor named processor 0. If you had a second processor it would be marked as processor 1 and would have all of the same information. You can also look at your memory information by typing:

bash$ cat /proc/meminfo

Information in /proc/meminfo is about as long as the cpuinfo file and it lists information that may seem a little bit more complex. With this information you can know a lot about your hardware and how it is being used.

You can also know about the file partitions and the space that they are using with the df command:

bash$ df
Filesystem       1k-blocks      Used Available Use% Mounted on
/dev/hda5         38978244   5017232  31981004  14% /
/dev/hda1            46636      3858     40370   9% /boot
/dev/hda2          5036316     87012   4693472   2% /var
/dev/fd0              1423      1405        18  99% /mnt/floppy

This information is useful when you are wondering how much of the system you have used and how much harddisk is left.


next up previous contents index
Next: Basic Shell Scripts Up: Linux Shell Environment Previous: Finding Files   Contents   Index
Joseph Colton 2002-09-24