June 2017
Beginner
502 pages
11h 26m
English
So, we have a new tiny script named disk.sh:
gzarrelli:~$ cat disk.sh#!/bin/bash echo "The total disk allocation for this system is: " echo -e "\n" df -h echo -e "\n df -h | grep /$ | awk '{print "Space left on root partition: " $4}'
Nothing special, a shebang, a couple of echoes on a new line just to have some vertical spacing, the output of df -h and the same command but parsed by awk to give us a meaningful message. Let's run it:
zarrelli:~$ ./disk.sh
The total disk allocation for this system is:
Filesystem Size Used Avail Use% Mounted on/dev/dm-0 19G 15G 3.0G 84% /udev 10M 0 10M 0% /devtmpfs 99M 9.1M 90M 10% /runtmpfs 248M 80K 248M 1% /dev/shmtmpfs 5.0M 4.0K 5.0M 1% /run/locktmpfs 248M 0 248M 0% ...
Read now
Unlock full access