Category Archives: Misc

Change window name while ssh’ing in GNU screen

When using GNU Screen everyday, it can be useful to have some automated title window renaming. I like it when I ssh a remote host. Here is how I do it with a shell function:

ssh() {
    if [[ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" =~ ^tmux ]]; then
        tmux rename-window "$(echo $* | cut -d . -f 1)"
        command ssh "$@"
        tmux set-window-option automatic-rename "on" 1>/dev/null
    elif [[ "$(ps -p $(ps -p $$ -o ppid=) -o comm=)" =~ ^screen ]]; then
        host=$(echo $* | cut -d . -f 1)
        echo -ne "\ek${host}\e\\"
        command ssh "$@"
        echo -ne "\ekzsh\e\\"
        command ssh "$@"

The trick is to send echo -ne "\ek${host}\e\\". That also works for tmux.

Inittab respawn remplacement for systemd

When upgrading to Debian Jessie and welcoming systemd at your home sweet home, it can be disturbing to not have working inittab respwaning services.

As usual, the inittab config line was looking like this:


So you will need to put in file /etc/systemd/system/mydaemon.service that code example:

Description=My Respawning Daemon



Then to do a “systemctl enable mydaemon.service” for systemd to symlink what it needs.

If you don’t want to reboot for it to work now, use:

systemctl daemon-reload
systemctl start mydaemon.service

How did you get here ?

This blog is almost about Linux system administration, Cisco networking administration, PERL and C development.

Have you ever felt that it was happened only to you ? So many forums and web pages but any of them relating your problem ? Googled hours for nothing ?

It happened to me a lot of times, so I decided to share here all situations and solutions I didn’t find on the Net with the hope it will help you now :-)