Posted by & filed under Linux.

I’m a big fan of running Debian Linux on the server. To do a lot of administration it requires one to SSH into the machine. The default message displayed to the user contains a bunch of copyright information, which isn’t all that useful. Here’s an example of the default SSH MOTD on my server:

$ ssh tlhunter@nodebox
tlhunter@nodebox's password:
Linux 3.6.5-x86_64 #1 SMP Sun Nov 4 12:40:43 EST 2012 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Sat Dec 22 13:38:52 2012 from crazy-hostname

Eww! The only useful information in this is the Kernel info, and the last login message. Surely we can do better.

First of all, to edit that message, you’ll want to edit the following file. Personally, I like the kernel information so I leave that in and delete all of the other lines.

sudo vim /etc/motd

Once that is done, we’ll want to add some commands to be executed once logging in. To do that, edit the following file:

vim ~/.bash_profile

Personally, I like to see who is logged in (to remind me if I have multiple sessions going), the uptime, the system CPU usage, and some statistics on my hard drives so I know if they’re full. To do all that, you just need to execute the following two commands (I throw in an echo for spacing):

w # uptime information and who is logged in
echo "" # for spacing
df -h -x tmpfs -x udev # disk usage, minus def and swap

Once that’s done, your next welcome message should be much prettier:

$ ssh tlhunter@nodebox
tlhunter@nodebox's password: 
Linux li234-205 3.6.5-x86_64-linode28 #1 SMP Sun Nov 4 12:40:43 EST 2012 x86_64
Last login: Sat Dec 22 13:38:52 2012 from crazy-hostname

 16:07:17 up  2:36,  1 user,  load average: 0.00, 0.01, 0.05
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
tlhunter pts/0    97-85-36-82.dhcp 16:07    0.00s  0.16s  0.00s w

Filesystem            Size  Used Avail Use% Mounted on
/dev/hda1              24G  1.1G   22G   5% /

Thomas Hunter II

Thomas is passionate about technology and building products. A web design business created while attending college slowly evolved into a brick and mortar on Main St. of his small Midwestern hometown. His desire for fame and fortune led to the co-founding of a Y Combinator startup and a life in California.


Hey there! I'm currently writing a book on Microservices which I expect to release in early 2017. If you're interested in getting updates please signup here. More info about the Book
  • chessplayer

    Thanks for this post. I used it to really spice up the terminal a bit. If you would like to check that out: see here.