Advanced Title for Linux Terminals with Meminfo, Loadavg and more

A lot of Linux Users script the PS1 variable to see different kinds of info in their Linux Prompt. However I like to keep my prompt very simple. Instead I prefer to view all that information as part of the Terminal Title. The title of my terminal can be see in the below image.

It shows the loadavg – 1.59, number of processes running currently – 208, memfree – 78208kb. Paste the following code in your .bashrc file (towards the end) to get a similar title for your terminals.

PROMPT_COMMAND='echo -ne "\033]0;`id -un`:`id -gn`@`hostname||uname -n|sed 1q` `tty | tr -d "dev/"` [`uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g"` / `ps aux|wc -l` / `cat /proc/meminfo  | /bin/grep MemFree | tr -d "MemFreekB: "`]\007"'

Infact you can script it any way you want by adding your code in between 'echo -ne "\033]0; and \007"'.