2015년 9월 27일 일요일

Living life in the tty

I have a an old Acer Aspire One D257 with 2GB of RAM which I purchased back in 2011 and have happily run a succession of Linux distro's like Debian, Ubuntu, and Archlinux on it. On purpose, I have only used lightweight Desktop Environments like LXDE and Openbox on this netbook to keep the system resources used to a minimum.

Unfortunately, In the past year or two, everyday browsing on the netbook has become too slow, with modern browsers easily taking up more than 1 GB of RAM with just a few tabs open (Chrome/Chromium is a memory hog). For example, if I have gmail, Trello, Slack, and a Google Drive document open in separate tabs, the Intel Atom processor has a hard time keeping up. This doesn't even take into account non-browser apps I might be running, like QuodLibet music player or daemons for Dropbox and SpiderOakONE. Due to sluggish performance, I decided to say get rid of the overhead for an X11 graphical desktop.

My Acer D257 has found a new lease on life as a tty-only machine which I ssh into from my primary notebook. I was partly inspired by reading K. Mandla's blog which chronicles his adventures testing command line apps on obsolete hardware. After connecting over ssh, I launch a GNU Screen session with the following script:


I then connect to the detached session with screen -r (you can see a list of detached sessions with screen -ls)


In the screenshot, you can see several GNU Screen tabs created by the script above. cmus is playing Internet radio, htop monitors CPU and memory for each process, and irssi with bitlbee daemon allows me to use irc to connect to Google Chat. In addition, I have the dropboxd and SpiderOakONE daemons running in headless mode so that my files on Dropbox and Spideroak get synced even when I'm not in a graphical session. Dropbox offers a script, dropbox.py for running dropboxd from the command line. This script has been packaged in AUR for Archlinux in the dropbox-cli package. In the case of SpiderOakONE, you can launch the daemon from the command line using the --headless option.

Here is a simple script that launches both daemons in the background when in a tty session:


In addition, I am running an NFS server for my LAN from this netbook -- all of this within 376 MB! In the screenshot above, the GNU Screen caption line shows the time, DoW, month, date, hostname, and a list of tabs that will expand to the right while properly reflowing even if the number of tabs goes off the right edge. You can find this caption setting in my .screenrc file from my dotfiles repo on Github.

In a series of posts I will talk more about cmus command line music player (that also supports Internet radio) and setting up irssi + bitlbee so you can connect to instant messaging services using an IRC client.

댓글 없음:

댓글 쓰기