LD05: Bash Scripts due Tue 26 Sep 14:45

Preparation for Lab Day

Ubuntu, by default, displays a rather wordy message upon login. This message is generated by a program called motd (message of the day). The message you see on login is created by executing the bash scripts in /etc/update-motd.d (in alphabetical order). So, these scripts are named starting with two-digit numbers to ensure the desired order of execution. You can visit that directory and manually execute the scripts one-by-one to get a sense of which scripts are causing which outputs.

Do the following in /etc/update-motd.d:

  1. Create a subdirectory called archive.
  2. Determine which scripts you want to keep and which you want to remove from your login screen and move those you want to remove into the archive directory.
  3. Create a new script called 60-disk-usage that will display current disk usage of your root partition. The output of the script should look something like this:
    Filesystem      Size  Used Avail Use% Mounted on
    /dev/xvda1      7.7G  2.5G  5.2G  33% /
    NOTE: The command to get disk usage output in this format is: df -h

    However, that command will produce disk stats on a variety of partitions we are not interested in. You need to experiment with ways to show only the header and the line that specifies the root partition. There are a wide variety of ways to show only this line. Play around until you find something you are satisfied with.

  4. Test your new-improved login screen.

Lab Day

Begin working through the instructions given for Homework #5