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

free
##               total        used        free      shared  buff/cache   available
## Mem:        3621900     2669180      723368       17720      229352      818988
## Swap:      11010048      190772    10819276

9.1.3 Display file system disk space usage

df
## Filesystem     1K-blocks      Used Available Use% Mounted on
## rootfs         188482144 122040780  66441364  65% /
## none           188482144 122040780  66441364  65% /dev
## none           188482144 122040780  66441364  65% /run
## none           188482144 122040780  66441364  65% /run/lock
## none           188482144 122040780  66441364  65% /run/shm
## none           188482144 122040780  66441364  65% /run/user
## tmpfs          188482144 122040780  66441364  65% /sys/fs/cgroup
## C:\            188482144 122040780  66441364  65% /mnt/c
## D:\             18660348  17154308   1506040  92% /mnt/d
## F:\              3196924    231756   2965168   8% /mnt/f
## G:\             86383612  24614588  61769024  29% /mnt/g
## H:\             86383612  15598836  70784776  19% /mnt/h
## J:\             83185660  21632636  61553024  27% /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()