Check These Out
Uses the dumb terminal option in gnuplot to plot a graph of frequencies. In this case, we are looking at a frequency analysis of words in all of the .c files.
I usually have 5 or more ssh connections to various servers, and putting this command in my .bash_profile file makes my putty window or x terminal window title change to this easily recognizable and descriptive text. Includes the username, group, server hostname, where I am connecting from (for SSH tunneling), which device pts, current server load, and how many processes are running.
You can also use this for your PROMPT_COMMAND variable, which updates the window title to the current values each time you exec a command.
I prefix running this in my .bash_profile with
$ [[ ! -z "$SSH_TTY" ]] &&
which makes sure it only does this when connecting via SSH with a TTY.
Here's some rougher examples from http://www.askapache.com/linux-unix/bash_profile-functions-advanced-shell.html
$ # If set, the value is executed as a command prior to issuing each primary prompt.
$ #H=$((hostname || uname -n) 2>/dev/null | sed 1q);W=$(whoami)
$ #export PROMPT_COMMAND='echo -ne "\033]0;${W}@${H}:${PWD/#$HOME/~} ${SSH_TTY/\/dev\//} [`uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g"`]\007"'
$ #PROMPT_COMMAND='echo -ne "\033]0;`id -un`:`id -gn`@`hostname||uname -n 2>/dev/null|sed 1q` `command who -m|sed -e "s%^.* \(pts/[0-9]*\).*(\(.*\))%[\1] (\2)%g"` [`uptime|sed -e "s/.*: \([^,]*\).*/\1/" -e "s/ //g"` / `command ps aux|wc -l`]\007"'
$ #[[ -z "$SSH_TTY" ]] || export PROMPT_COMMAND
$ #[[ -z "$SSH_TTY" ]] && [[ -f /dev/stdout ]] && SSH_TTY=/dev/stdout
And here's a simple function example for setting the title:
$ function set_window_title(){ echo -e "\033]0; ${1:-$USER@$HOST - $SHLVL} \007"; }
An entirely shell-based solution (should work on any bourne-style shell), more portable on relying on the rename command, the exact nature of which varies from distro to distro.
This way, you can specify how many hours in which you want your machine to shut down.
Converts any number of seconds into days, hours, minutes and seconds.
sec2dhms() {
declare -i SS="$1"
D=$(( SS / 86400 ))
H=$(( SS % 86400 / 3600 ))
M=$(( SS % 3600 / 60 ))
S=$(( SS % 60 ))
[ "$D" -gt 0 ] && echo -n "${D}:"
[ "$H" -gt 0 ] && printf "%02g:" "$H"
printf "%02g:%02g\n" "$M" "$S"
}
adjusting the field "f1" will give you additional information such as
f1 = 98%
f2 = discharging
f3 = 2:02 remaining
This forces X back to its maximum resolution configured. To get a list, type `xrandr'.