Chapter 9 System Info

In this chapter, we will explore commands that will allow us to

  • display information about the system
  • display memory usage information
  • display file system disk space usage
  • exit the terminal
  • run commands a superuser
  • shutdown the system
Command Description
uname Display important information about the system
free Display free, used, swap memory in the system
df Display file system disk space usage
exit Exit the terminal
sudo Run command as super user
shutdown Shutdown the system

9.1 uname

The uname command is used to view important information about the system. Using additional options, we can

  • print details about operating system
  • hardware & software related information
Command Description
uname Print details about the current machine and the operating system running on it
uname -mp Hardware related information; machine & processor
uname -srv Software related information; operating system, release number and version
uname -n Nodename of the system
uname -a Print all available information system

9.1.2 Display free, used, swap memory in the system

##               total        used        free      shared  buff/cache   available
## Mem:        3621900     3028692      363856       17720      229352      459476
## Swap:      11010048      431892    10578156

9.1.3 Display file system disk space usage

## Filesystem     1K-blocks      Used Available Use% Mounted on
## rootfs         188482144 133682612  54799532  71% /
## none           188482144 133682612  54799532  71% /dev
## none           188482144 133682612  54799532  71% /run
## none           188482144 133682612  54799532  71% /run/lock
## none           188482144 133682612  54799532  71% /run/shm
## none           188482144 133682612  54799532  71% /run/user
## cgroup         188482144 133682612  54799532  71% /sys/fs/cgroup
## C:\            188482144 133682612  54799532  71% /mnt/c
## D:\             18660348  17154376   1505972  92% /mnt/d
## F:\              3196924    231760   2965164   8% /mnt/f
## G:\             86383612  29503152  56880460  35% /mnt/g
## H:\             86383612  14755908  71627704  18% /mnt/h
## J:\             83185660  16603352  66582308  20% /mnt/j

9.2 Others

In this section, let us look at a few other useful commands that will allow us to

  • see how long a command takes to execute
  • delay activity
  • display and clear command history list
Command Description
time See how long a command takes to execute
sleep Delay activity in seconds
sleep 1m Delay activity in minutes
sleep 1h Delay activity in hours
history Display command history list with line numbers
history -c Clear the command history list

9.3 Funny Commands

Below are a few funny commands for you to try out. Use sudo apt-get install to install fortune and banner before trying them.

Command Description
fortune Poignant, inspirational & silly phrases
yes Output a string repeatedly until killed
banner ASCII banner
rev Reverse each character

9.4 R Functions

In R, we can use Sys.sleep() to delay activity and history() to view command history.

Command R
sleep Sys.sleep()
history history()