Jump to content


How to easily customise your MOTD [Debian & Ubuntu] - Posted By SephirothSG

Debian Ubuntu

  • Please log in to reply
No replies to this topic

#1 Cryo Kinesis

Cryo Kinesis

    Haphost Staff

  • Moderators
  • 128 posts
  • LocationGridania, Eorzea

Posted 05 August 2014 - 06:06 PM

How to customise your MOTD

Hey everyone, today I'll be showing you how to customise your MOTD and make it display anything you want rather easily.

Right now your MOTD should look something like this.

Attached File  ss+(2013-10-05+at+03.55.42).png   3.74KB   1 downloads



By the end of the tutorial it will look like this

Attached File  ss+(2013-10-05+at+04.34.23).png   13.42KB   1 downloads



1. First we have to isntall the update-motd package, this can be achieved by running the below command.

apt-get install update-motd

2. Once that's installed you're going to navigate to /etc/update-motd.d/ and you should be met with 3 files. 00-header, 10-help-text and 99-footer.


These are the files we're going to edit to change our motd.

Attached File  ss+(2013-10-05+at+03.52.41).png   969bytes   1 downloads

3. Because we're going to be putting this in one file (00-header) you're going to need to either delete or make every other script in /etc/update-motd.d not executable. (Personally I like to make them non-executable)
This can be achieved by running the following commands while in the directory /etc/update-motd.d

chmod -x *
chmod +x 00-header

4. After that we want to edit the 00-header file and replace the contents with the following. (Edit with your text editor of choice, personally I use nano)


[ -r /etc/lsb-release ] && . /etc/lsb-release

if [ -z "$DISTRIB_DESCRIPTION" ] && [ -x /usr/bin/lsb_release ]; then
 # Fall back to using the very slow lsb_release utility
 DISTRIB_DESCRIPTION=$(lsb_release -s -d)

UPTIME=`uptime | awk '{if ($4 == "day," || $4 == "days,") print $3, $4, $5; else print $3}' | awk -F: '{print $1, "hrs", $2, "mins"}' | sed 's/,//g'`

LOADAVG=`uptime | awk '{if ($4 == "day," || $4 == "days,") print $10, $11, $12; else print $8, $9, $10}'`

PROCCOUNT=`ps -l | wc -l`
IP=`ifconfig  | grep 'inet addr:'| grep -v '127.0.0.*' | cut -d: -f2 | awk '{ print $1}'`

echo "
 ==============: System Info :===================
 Hostname: `hostname`
 Address: $IP
 Kernel: `uname -r`
 Uptime: $UPTIME
 Load Avgs: $LOADAVG
 Processes: $PROCCOUNT
 ==============: Memory Info :===================
 Total: `cat /proc/meminfo | grep MemTotal | awk {'print $2'}` kB
 Free: `cat /proc/meminfo | grep MemFree | awk {'print $2'}` kB
 ===============: Disk Info :===================="
 df -h

If you want to colour any part of this MOTD, read this page

5. You're done!! Your MOTD should now look like the one pictured earlier in this guide smiley-grin.png, at the bottom of this post is another example of what I consider a good MOTD

I'd like to see what everyone else uses for their MOTD's, so feel free to post yours below



Also tagged with one or more of these keywords: Debian, Ubuntu

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users