Using tmux to remotely work on Raspberry Pi

After having bought the device, I’m finding it to be quite cool. Considering the fact that it takes a very less power (around 3.5W) makes it good to okay it running all the time πŸ™‚

And, being able to run node.js from Raspberry Pi is quite useful. In order to keep the node.js running, even after I quit the ssh session, I wanted something, like ‘screen’ unix command. Finally, I ended up choosing tmux than screen, as tmux appears to be a modern equivalent with active development going on..

Btw, I used the ArchLinux Arm, instead of raspbian, as I liked the fact it is a rolling release distro, which also I wanted to experiment with. (Having used Debian/Ubuntu for a long time now)

Anyway, coming to the point, the process is quite easy for using tmux from cherrypy.
ssh server was already installed with Archlinux ARM. So, this step is taken care. (If not, just install an ssh server, like openssh)

The next step is to install tmux.
Use pacman to install tmux..

sudo pacman -S tmux

Now, from my other machine (I typically use ConnectBot in my Android Phone/tablet, with Hacker’s keyboard for better keyboard experience), connect to the Raspberry Pi device, and just type

tmux

This creates a new tmux session in Raspberry Pi. Here we need to run the necessary commands, say, run the node.js app.
Once we are done, just execute the following keyboard combination, to detach the tmux session.
Ctrl + B D (i.e., Press Ctrl + B and then press key D)

Please note, the tmux session still continues to run in the Raspberry Pi device πŸ™‚

Now, if we need to login back after some time and attach to the tmux session..

tmux attach

That’s it. Now, our shell will be connected to the old tmux session, as if we were still continuing to operate. Isn’t it cool πŸ™‚
I’m loving it. Especially, now I can use my Pi for downloading stuff, without having my main pc switched on all the time..

References:
http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course
http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s