Deb A Day
mrxvt: Fast, light multitabbed terminal emulator
Article submitted by Hugo Carrer.
As any other Debian user I love writing obscure commands on my terminal. I love too having so many open terminals that I have to come up with a special system to find the one where my favorite obscure command is running on.
To be able to enjoy this I need a very fast multitabbed terminal emulator: mrxvt.
Some of the things I like the most about mrxvt are for example,
- It is very fast and light.
- Fast pseudo-transparency.
- Background with your favorite images.
- Highly configurable keyboard shortcuts.
- You can have the same command typed on every tab at the same time. This feature is disabled by default. you can enable it by editing /etc/mrxvt/mrxvtrc and uncommenting the ToggleBroadcast macro (around line 171). After that, Ctrl+Shift+d toggles input broadcasting to all tabs.
- Automatic or “by-hand” tab labeling.
- It is independent of your desktop (no KDE or GNOME needed).
- Did I mention that is very fast and light?
After installing it would look something like this:
You can change this rather old fashioned look by copying the example config file from
/usr/share/doc/mrxvt-common/examples/mrxvtrc.sample.gz
And placing it in ~/.mrxvtrc
The file is full of comments helping you with the meaning of each option. Of course you can find all available options in the man page. Some useful shortcuts are Ctrl-shift-t to open a new tab and Ctrl-shift-m to show the menu.
So, after playing, trying and tweaking for a little while you can get a futuristic look for your terminals. Like this one of me sketching this article on an emacs session inside mrxvt (Note all those beautiful tabs up there)
Downsides? Well it depends on the kind of user,
- No UTF-8 support.
- It has no config menu.
- You have to remember the shortcuts or read the config file every now and then.
- And as with anything worth doing, to get things working the way you want to you’ll have to read through the man page and maybe scratch your head once or twice but it’ll work.
To sum up, it’s the perfect application to config during those boring rainy weekends and then show off to your friends at work.
mrxvt is available in Debian stable and in Ubuntu too.
DevTodo: a reminder/task program aimed at developers.
Article submitted by Raman Pandarinathan.
DevTodo is a simple command-line-based package to keep todo lists. Lists are prioritized and hierarchical. Each task in the list has a priority (very high, low, medium etc.) and a given task can be linked to another todo database, making the list hierarchical. The lists are stored as an XML file (.todo) in the current directory, so if you manage multiple projects, you can have different todo lists and DevTodo will update the information based on your current working directory.
As the Todo list is stored in an XML file, you can use an XSLT template to export it to other formats. In Debian, you can find templates to export to HTML and PDF in /usr/share/devtodo.
Managing your todo listsBasic commands are:
- todo displays the list of tasks pending in the order of priority.
- tda adds a task to the list. The optional argument -g links the task to another task (creates a subtask).
- tdd marks a task as complete (done) with comments.
- tde edit a task.
- tdr removes a task completely.
With the use of some small shell scripts, when you cd into a directory with a .todo in it, DevTodo can display the Todo items for that directory. There are scripts for bash and tcsh in /usr/share/doc/devtodo/examples. To enable it under bash, add this to your .bashrc:
if [ -f /usr/share/doc/devtodo/examples/scripts.sh ]; then . /usr/share/doc/devtodo/examples/scripts.sh fi Pros and Cons- Pros
- Simple command line interface.
- Easy storage using XML.
- Fast and elegant.
- Oriented towards developers.
- Cons
- No GUI.
- No recent development (last commit was at the end of 2007), upstream seems to be inactive.
- No calendaring.
DevTodo is available in Debian since Sarge and in Ubuntu (universe) since Dapper.
EasyTag: a graphical interface to managing your music files’ tags
EasyTag is a graphical utility to edit the descriptive ID3 tags for your music files. One will think primarily of MP3 files, but it also does other formats, such as Ogg, FLAC, MP4/AAC, MusePack, Monkey’s Audio files and WavPack files (APE tag).
EasyTag’s screen real estate is divided into three windows. The left window shows you the directories of your file system. The middle window shows you the music files in your currently selected directory. The right window is further subdivided into top and bottom information boxes: the top shows you the technical information about the file (bit rate, frequency, mode, size, and time), and the bottom shows you the actual ID3 fields.
The ID3 fields are pretty complete as they let you fill in all the relevant info you could want to put in, e.g., title, artist, album, year, genre, personal comments. You can also attach a photo to the file.
Once you start up EasyTag, it will search your home directory for any and all music format files. This behavior is either helpful or annoying; if it’s the latter, you can simply stop the search and go to the directory of your choice. It will resume the search from there.
Tagging filesThere are three ways to tag music files with EasyTag:
- Manually.
- Automatically with the “Fill Tag” scanner.
- Automatically via CDDB, which is a database for software applications to look up audio CD information over the Internet.
Manual tagging is pretty much self-explanatory (and tedious.)
Automatic Fill Tag relies on the filenames of your music files to automatically fill in the ID3 entries. EasyTag has a couple dozen formats that cover almost every imaginable case.
Automatic CDDB tagging only works if files are sorted per album and if the actual CDDB entry exists. You don’t actually have to have the CD on hand: you can search for the album ID through EasyTag. Once found, it will label the files for you.
All in all, a great way to manage and maintain information on your music files.
AvailabilityEasyTag is available in Debian since at least Sarge and in Ubuntu (universe) since Dapper.
aria2: high speed command line download utility
Bonus article this week, submitted by Anthony Bryan and Tatsuhiro Tsujikawa.
If you’re a frequent downloader and comfortable on the command line, then you need to try out aria2. aria2 is a cross platform download utility, similar to graphical download managers except that it uses less system resources.
aria2 has a number of invaluable features such as download resuming, BitTorrent and Metalink support, segmented downloading, downloading a single file from one or multiple servers (including integrated BitTorrent and HTTP/FTP transfers), downloading many files at the same time, automatic error recovery/repair (BitTorrent and Metalink downloads only), etc.
aria2 is a command line application, but don’t let that scare you off. You can use aria2fe, a graphical front end, if that makes you more comfortable.
Keep in mind that aria2 is more for heavy downloading, and if you want a webspider then wget would be a better choice.
How to use itThe easiest way to invoke aria2 is by typing aria2c URL/fileName
$ aria2c http://host/image.isoThe URL can be either a regular URL to a file, a URL to a .torrent file, or a URL to a .metalink file. For BitTorrent and Metalink downloads, there are extra options available such as throttling upload speed, only downloading selected files, changing listening ports, and seed time and ratio. To pause a download, press Ctrl-C. You can resume the transfer by running aria2c with the same argument in the same directory.
Downloading identical files from multiple sourcesaria2 supports multiple URLs for the same file. You can specify them on the command line (space separated) and aria2 will download from multiple URLs at the same time.
$ aria2c http://host/image.iso http://mirror/image.isoThis command will split the download between multiple servers. aria2 can even download the same file from BitTorrent and FTP/HTTP at the same time, while the data downloaded from FTP/HTTP is uploaded to the BitTorrent swarm.
Repairing damaged downloadsaria2 can repair downloads with errors by using the information in .torrent or .metalink files.
$ aria2c -M test.metalink --check-integrity=trueThe -M option specifies a local file called test.metalink to get the information to repair the download.
Parameterized URLsYou can specify set of parts. The following command will download part of the same file from 3 servers, don’t forget to escape the parameter to avoid shell expansion.
$ aria2c -P 'http://{host1,host2,host3}/file.iso'You can specify numeric sequence using []. This command will download image000.png through image100.png from the same server.
$ aria2c -Z -P 'http://host/image[000-100].png'The -Z option is required if the all URIs don’t point to the same file, such as the above example.
Other optionsaria2 has a lot more options, you can for instance use:
- -T filename.torrent to specify a local .torrent file.
- -M filename.metalink to specify a local .metalink file.
- -i textfile will download all the URLs listed in a textfile.
- -s for example -s2 will download a file using 2 connections.
- -j for example -j5 will download 5 files concurrently.
aria2 has many other options. To read the man page, type:
$ man aria2c Availabilityaria2 is available on most Linux distributions. Official Debian and Ubuntu package are available:
Community & developersaria2 is actively maintained and developed by Tatsuhiro Tsujikawa. Bug reports, feature requests, and forums are found on SourceForge.
Linksemail-reminder: Never forget a birthday or an anniversary again!
Article submitted by François Marier. Guess what? We still need you to submit good articles about software you like!
Email-Reminder is a simple tool to define events for which you want to receive a reminder by email. These reminders (sent out daily by a small cronjob) can be either on the day of the event and/or a few days beforehand.
Events can be:
- birthdays
- anniversaries
- weekly, monthly and yearly events
Here is an example of what you get in your inbox for an upcoming birthday:
From: Email-Reminder Date: Tue, 12 May 2007 04:00:22 -0400 (EDT) To: Francois Marier <fmarier@gmail.com> Subject: Trent Reznor’s birthday Hi Francois, I just want to remind you that Trent Reznor is turning 42 in 5 days. You can reach Trent Reznor at trent@example.com. Have a good day! – Sent by Email-ReminderAnd here is one on the day of an anniversary:
From: Email-Reminder Date: Tue, 29 Jul 1996 04:00:11 -0400 (EDT) To: Francois Marier <fmarier@gmail.com> Subject: 15th anniversary of Prince Charles and Lady Diana Hi Francois, I just want to remind you that the 15th anniversary (Crystal) of Prince Charles and Lady Diana is today. Have a good day! – Sent by Email-Reminder Event DefinitionEvents for each user are defined in an XML file (~/email-reminders) in that user’s home directory, click here to see a sample file. You don’t actually have to define each event by hand in the XML file though. Email-Reminder comes with a simple GTK user interface:
AvailabilityEmail-Reminder has been in Debian since Sarge and in Ubuntu since Dapper. It is licensed under the GPL.
More InformationYou can find out more about Email-Reminder by visiting its homepage and subscribing to its news feed.
If you want to get involved, see the roadmap and feel free to contribute some patches!
aiccu: add IPv6 connectivity to your machine
Article submitted by Caspar Clemens Mierau. Guess what? We still need you to submit good articles about software you like!
It’s time: no reason should prevent you from adding IPv6 connectivity to your machine. Of course it’s still an issue, as most ISPs don’t provide native IPv6. So in most cases the easiest way for you is to set up a tunnel to an IPv6 broker. There are currently several free brokers. I’ll show a simple way of getting IPv6 connectivity with the aiccu and SixXS.
Apply for an accountFirst you have to apply for an account on SixXS. Please note: as a kind of ISP, Sixxs really need valid information from you. You may give them a link to your Xing or LinkedIn profile.
Your application will be checked and (probably) approved. Wait for the mail. After that go to the SixXS website, request a new tunnel, and pick an entry point near you. This step also needs to be approved. Wait for the mail (it takes up to a day).
Set up aiccuNow let’s get it running. Install the package aiccu (apt-get install aiccu). During installation you will be asked, which broker you are using. SixXS is already preconfigured, so choose it and input your account information. If everything is fine, aiccu will check SixXS and ask for your tunnel information.
Open a terminal and run ifconfig sixxs—it should show a new network interface with an IPv6 address. Now let’s check IPv6. Open Firefox and go to http://www.kame.net/. If the turtle logo is moving, your are using IPv6, if it does not, you don’t.
The SixXS credit systemYou should understand the SixXS credit system. It’s used to limit users in repeating bad actions and to make sure they maintain their tunnels. For example if a static tunnel is down it will cost you some credits, thus you better keep it up. One could see the credit system as a bank, you got a credit limit and you can’t go over it and buy everything you want, but when you earn credits because your tunnel is up you can do a lot with it.
Security issuesNote that all your IPv6 traffic will be directed through the broker, so you have to take care of the security.
IPv6 contentCheck http://www.sixxs.net/misc/coolstuff/ for interesting IPv6 content: high traffic news servers, the IPv6 freenode server and so on. Always keep in mind, that not every application is ready for IPv6 and many applications need to be configured for IPv6. With Debian/Ubuntu you should be able to use at least Firefox, Thunderbird, Pan, and Irssi.
aiccu is available in Debian since Etch, and in Ubuntu since Feisty
Happy networking!
Debian-administration.org on rinetd
Unusual non-article ahead:
Debian-administration.org has a nice article about rinetd entitled “Easily forwarding arbitrary TCP connections with rinetd”, go and check it, it is an interesting package I didn’t know about!
file: classify unknown files on the console
Article submitted by Caspar Clemens Mierau. Guess what? We still need you to submit good articles about software you like!
Somebody just sent you a mail with attachments that don’t have usable file extensions so you don’t really know how to handle them. Audio file? PDF? What is it? The same problem might occur after a file recovery, on web pages with upload features, etc.
While you can try to give the file an extension and open it with a software you think might be suitable, the better way is to let your computer find out what is all about. As a GNU/Linux user you probably already think “There is surely a command line tool for this”. Of course there is: the file by Ian Darwin.
It often gets automatically installed by dependencies. In any case, aptitude install file will help you. file depends on libmagic which provides patterns for the so called “magic number” detection.
Let’s assume we have the following directory with unknown files:
$ ls -l total 2152 -rw-r--r-- 1 ccm ccm 4118 2008-03-30 06:32 unknown.0 -rw-r--r-- 1 ccm ccm 10220 2008-05-06 02:23 unknown.1 -rw-r--r-- 1 ccm ccm 12693 2008-05-06 02:23 unknown.2 -rw-r--r-- 1 ccm ccm 25933 2007-10-26 07:41 unknown.3 -rw-r--r-- 1 ccm ccm 2121 2007-10-26 07:41 unknown.4 -rw-r--r-- 1 ccm ccm 185 2007-10-14 20:14 unknown.5 -rw-r--r-- 1 ccm ccm 1189011 2008-05-17 22:37 unknown.6 -rw-r--r-- 1 ccm ccm 824163 2008-02-02 05:02 unknown.7 -rw-r--r-- 1 ccm ccm 82367 2007-09-20 06:18 unknown.8 -rw-r--r-- 1 ccm ccm 8872 2006-04-24 12:43 unknown.9Now we want to know what’s inside those black boxes. Therefore we just call file * on the console:
$ file * unknown.0: XML unknown.1: ELF 32-bit LSB relocatable, Intel 80386, version 1 (SYSV), not stripped unknown.2: ASCII C program text unknown.3: PDF document, version 1.4 unknown.4: LaTeX 2e document text unknown.5: perl script text executable unknown.6: gzip compressed data, from Unix, last modified: Wed Oct 8 16:27:09 2003 unknown.7: Ogg data, Vorbis audio, stereo, 44100 Hz, ~192003 bps, created by: Xiph.Org libVorbis I (1.0) unknown.8: PNG image data, 492 x 417, 8-bit/color RGBA, non-interlaced unknown.9: HTML document textHey, that’s all. Pretty impressive, isn’t it? file does even not only distinguishes binaries and text files, it even tries to guess what programming language a text file is written in. And the magic is not that much magic: for example, in case of the ZSH script it just sees a shebang pointing to the zsh in the first line of the file, a PDF file typically starts with “%PDF” and so on. It’s all about patterns.
file provides you with some command line options that make it’s usage even more helpful. The most interesting is -i as it prints out MIME-types instead of verbose file types. If you are a web developer and want to know the exact MIME-type for a file download, this can save you a lot of time:
$ file -i * unknown.0: text/xml unknown.1: application/x-object, not stripped unknown.2: text/x-c; charset=us-ascii unknown.3: application/pdf unknown.4: text/x-tex unknown.5: application/x-perl unknown.6: application/x-gzip unknown.7: application/ogg unknown.8: image/png unknown.9: text/htmlGreat, isn’t it? The Apache web server also uses libmagic for this purpose. With file you just use a wrapper for the same task.
file is available in Debian and Ubuntu for a long time.
zsh: a REALLY nice alternative for bash
Article submitted by Danilo Martins. Guess what? We still need you to submit good articles about software you like!
After years using ZSH instead of BASH, I still don’t understand why isn’t everybody using it. ZSH is a complete shell that will certainly make your life easier. Give it a try.
First of all, you need it installed (duh). APT and its super cow powers will do this for you. You can simply use:
$ sudo apt-get install zsh
and you should be all set. Alternatively, you can install the package “zsh-beta”, but it tends to crash once in a while… ZSH is available on any repository of Debian and Ubuntu.
To try it out, you can simply type zsh, but you wouldn’t be very happy with the result. Let’s personalize it first. First of all, create a file named .zshrc on your home directory. Inside, you should put the text listed below (note: see the commented lines —be sure to try each of them out sometime)
### Uncomment the following line if you want to use the "command not found" Ubuntu command #. /etc/zsh_command_not_found ### These are a really nice view of the command line. If you do not like it, comment all lines. PS1='\033[30;47m\u:\w>\033[0m ' prompt='%U%n%u:%B%~%b# ' PROMPT2='%_> ' echo "\e[1;9]\e[8]" RPS1='< %U%m%u >‘ ### General config sets LS_COLORS=’no=00:fi=00:di=01;34:ln=01;36:pi=40;33:so=01;35:bd=40;33;01:cd=40;33; 01:ex=01;32:mi=5;31;46:or=5;31;46:*.cmd=01;32:*.exe=01;32:*.com=01;32:*.btm=01;3 2:*.bat=01;32:*.deb=01;31:*.tar=01;31:*.tgz=01;31:*.arj=01;31:*.taz=01;31:*.lzh= 01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.gz=01;31:*.jpg=01;35:*.gif=01;35:*.bmp=0 1;35:*.xbm=01;35:*.xpm=01;35:*.png=01;35:*.ppm=01;35:’ LS_OPTIONS=”-F -B –color=auto” ### Default definitions ## I use MOST as my default pager. You should too, but it’s up to you #PAGER=/usr/bin/most command_oriented_history=1 HISTCONTROL=ignoreboth ulimit -c unlimited umask 022 mesg y ### LS and V aliases alias ls=”ls $LS_OPTIONS” #–format=vertical alias v=”ls $LS_OPTIONS –format=long” alias l=”v” ### Export everything so far export PS1 NLSPATH PAGER MAIL LS_COLORS LS_OPTIONS LIBRARY_PATH C_INCLUDE_PATH CPLUS_INCLUDE_PATH EDITOR TERM XFILESEARCHPATH ### History configuration export HISTFILE=$HOME/.zsh_history export HISTSIZE=8192 export SAVEHIST=8192 ### CD shortcuts export CDPATH=.:~ ### List of file extensions you wish to ignore on a ls export FIGNORE=”~:.o” ### These are very interesting. I will explain some of them at the end setopt share_history setopt appendhistory setopt autocd setopt automenu setopt autopushd setopt autoresume setopt complete_in_word setopt extended_glob setopt hist_ignoredups setopt hist_ignorespace setopt list_types setopt mailwarning setopt no_flowcontrol setopt no_hup setopt no_notify setopt printexitvalue setopt pushd_ignoredups setopt pushd_silent ### Making sure your keyboard will work on any terminal bindkey ‘^[[1~’ beginning-of-line bindkey ‘^[[4~’ end-of-line bindkey ‘^[[2~’ overwrite-mode bindkey ‘^[[3~’ delete-char bindkey ‘^[[6~’ end-of-history bindkey ‘^[[5~’ beginning-of-history bindkey ‘^[^I’ reverse-menu-complete bindkey ‘^[OA’ up-line-or-history bindkey ‘^[[A’ up-line-or-history bindkey ‘^[[B’ down-line-or-history bindkey ‘^[OB’ down-line-or-history bindkey ‘^[OD’ backward-char bindkey ‘^[OC’ forward-char bindkey ‘^P’ history-beginning-search-backward bindkey ‘^N’ history-beginning-search-forward bindkey ‘^[[[A’ run-help bindkey ‘^[[[B’ which-command bindkey ‘^[[[C’ where-is bindkey ‘^D’ list-choices ### See for yourself, at the end alias -g …=’../..’ alias -g ….=’../../..’ alias -g …..=’../../../..’ ### Push History from previous sessions fc -R $HISTFILE ### Forcing the rehash _force_rehash() { (( CURRENT == 1 )) && rehash return 1 } ### Loading the completion style zstyle ‘:completion:*’ completer _oldlist _expand _force_rehash _complete ### Aliasing “run-help” unalias run-help autoload run-help ### Loading the compinit autoload -U compinit compinitNow do run zsh. If you see a different prompt (specially if you did not comment the prompt lines on the .zshrc example above), it’s working. Now, it’s time you see what you can do with this.
First example. Lets suppose you’re doing a long command (cat /etc/mailcap | grep “^audio” | sed s/mplayer/gmplayer) and forget the command syntax for the sed program. You simply move your cursor to the command “sed” and press ALT-H. This should open the man page for sed. After you close the man page, you will automatically be returned with the command you were typing.
Second example. You’re connecting to a remote host using SSH. You remember that you want to use the X11 forwarding, but you don’t remember how to do this. Then, you type “ssh -” and press TAB. Yes, ZSH auto-completes not only files, but also command parameters. Be sure to try it out with whatever command you want to use.
Third example. You have a SSH key to a remote host, and you wish to copy a file from there using SCP. But you do not remember exactly where the file is. You simply type “scp user@remotehost:/home/myuser/myf”, press TAB and watch ZSH doing its amazing trick. Not only ZSH auto-completes files and parameters, but also remote files (remember that for this to work you need to have the RSA/DSA key on the remote host).
Fourth example. You want to install a Debian package (I love this one), but you don’t remember (or are too lazy to) type the whole name of the package. Instead, you simply type “apt-get install mysql-client” and press TAB, and watch ZSH magically auto-completing the package name. If you have more than one, it will list all available below, and if you keep pressing TAB it will complete through each one of them, one at a time. And yes, not only ZSH auto-completes files, parameters and remote files, but it also auto-completes package names. Well, I think we had enough of the “auto-complete” examples, didn’t we?
Fifth example. Yesterday you used a loooooong command and you are too lazy to type it all again. You also do not want to press UP until it appears. Instead of it, you simply type the beginning of the command and try the ALT-P combination. ZSH will auto-complete your command from the history. You can keep using ALT-P and swapping to the previous entries. If you missed it, ALT-N gets you to the next.
Last example. You typed apt-gey install foo bar foo2 bar2 foo3 bar3 foo4 bar4 … foo239 bar239 and pressed ENTER. Oh, shit, apt-gey does not exist. Instead of pressing UP, HOME, going to “gey” and changing it to “get”, you can simply use ^gey^get. This is a shortcut to “repeat the last command, but all occurrences of “gey” are now “get”.
If you liked the way ZSH works and want to use it as your default shell, you can always use the chsh command, and put /usr/bin/zsh there. It's now your default shell.
Enjoy!
Ghextris: tetris clone with a hexagonal makeover
Article submitted by Alex Drachmann. Guess what? We still need you to submit good articles about software you like!
The object of the game is much the same as with tetris, only the frame and the falling objects are hexagons. You have to slot the coloured pieces together making rows, which disappear once they are complete, the game ends if the stack of pieces reaches the celling.
Hexagons are hard to stack, so the game is more challenging than other games of its type, but it gets easier with practice. The game play gets rapidly challenging, as you make mistakes or run out of room and to make it worse, the objects you get are often the most useless for the job, plus it seems as if they fall at an increasingly faster rate. A score is kept based on how many lines you complete. Your current score and the highest score can be viewed on the bottom of the window, so you can try to match or beat your best score or that of a friend.
The interface and graphics are simple and integrates nicely in with the gnome environment. The colouring of the pieces is plain, with no texture or shading, so it doesn’t distract away from the game play. The top bar has two entries: play and hepl. The play menu has three actions, «play» (keyboard shortcut: ctrl+n), «pause» (ctrl+p or just p) and «quit» (ctrl+q). The help menu only has the infamous «about» option, with details about the version and author available.
The keys for playing the game are the direction keys, left and right on the keyboard, which moves the pieces left or right. The up and down keys turn the pieces 90 degrees in one direction or the other. Pressing the space bar makes the current piece crash into the slot directly beneath it.
The version I played was version 0.9.0, which is the current version in the universe repositories of Ubuntu Hardy Heron 8.04 and in the Debian repositories. Ghextris is available in all current releases of Debian and Ubuntu.
The official site of the game is: http://mjr.iki.fi/software/ghextris.
The author of the game and lone developer of it is Mikko Rauhala, who admits to being inspired by a similar game called Xhextris by David Markley.
JOE Joe’s own editor: a really usable text editor
Article submitted by Neil Stewart. Guess what? We still need you to submit good articles about software you like!
Back in the day, when I was new to Linux, joe was the first text editor that I managed to quit without having to reboot my machine. That I am still using it today, many years later, goes to show just how simple yet powerful joe is. If you don’t want to use emacs (because what’s the point of running two operating systems?) and still can’t work out how to use vi, then joe is for you.
joe is started from the command line with joe or joe filename to edit filename. When you start joe you get a single header bar with information about where the cursor is, what time it is and, crucially, the message «Crtl-K H for help» (^KH in joe shorthand). So if you press Ctrl and K together, release them, and then press and release H, the top half of the screen is given over to a brief list of commands. And it’s here I learnt how to quit (without rebooting), how to open a new file, how to save a file. And how to move the cursor around, how to find and replace, how to skip over words and lines, how to marks blocks of text and move them about. And you can carry on working on your file —you just type— with the help up. So within a really short amount of time you’ll be up to speed.
But joe is powerful too. For example, you can process any block of text through any shell command. joe’s help file gives a good example. If you mark the block of text by moving the cursor to the beginning and ^KB, then move to the end and ^KK, then pipe the block of text through sort with ^K/ sort. joe then runs the block of text through sort and replaces the block with the result. Powerful, especially in conjunction with old faithfuls like tr and sed.
Search and replace is also easy. ^KF and enter a search term. That’s it. But search and replace is powerful too. You can reuse old search terms by pressing the up cursor key, including terms from previous sessions. You can use tab completion to complete from any of the words in your current document after you’ve typed the first few letters. Then you can choose what to do when you find it. To replace press R and enter the replace term. You can replace one by one, or replace all. ^L finds the next entry. And you can use regular expressions —this is unix after all. Again the help file has a neat example. If you search for \*,\*,\*$ (\* matches zero or more characters and $ matches the end of a line) and replace with \2,\1,\0 (\X matches Xth pattern found) the string «one,two,three» becomes «three,two,one». Bring up help with ^KH and skip a few screens with ^[. a few times to remind yourself of the regular expressions.
Macros are easy too. Start recording one of ten macros with ^K[ and then a digit. Finish the macro with ^K]. Then use ^Kdigit to play the macro.
joe has many more features. joe remembers where it was in the file when you next edit it. joe colours your C, Java, LaTeX, HTML, and many other formats by default. joe indents your source code and justifies your text. joe supports multiple windows. joe can set bookmarks. You can compile your source code from within joe (^[C) and then skip to the errors the compiler identifies (^C= next error, ^C- previous error).
Finally, joe is old, stable, and just works. It’s in version 3.5 in etch and lenny. I use it for everything, all day every day, and it never fails. Find out much more with info joe or at the Sourceforge home page.
mhddfs: join several real filesystems together to form a single larger one
Article submitted by Roman Mamedov. Guess what? We still need you to submit good articles about software you like!
Suppose, you have three hard drives - sized 80, 40 and 60 GB. And 150 GB of music files, which you need to store on these drives. How would you do it?
The two solutions I knew of, were:
- either to simply have three separate «Music» folders - one per each drive;
- or create some sort of RAID, joining all the drives into an array.
However, the first method is quite tiresome, as one needs to decide how to split the data between the drives and keep track of what is stored where. For example, I might decide to store all «Classical» music on the first disk, and «Rock» music on the second. Then, suddenly, the first drive fills up and the second one still has plenty of space. Now I need to move the files between the disks, or jump around with symlinks.
The RAID method, while solving this problem, always incurs significant loss of either storage reliability or usable disk space.
But recently, I found a better solution to this problem and similar ones: mhddfs. It is a FUSE filesystem module which allows to combine several smaller filesystems into one big «virtual» one, which will contain all the files from all its members, and all their free space. Even better, unlike other similar modules (unionfs?), this one does not limit the ability to add new files on the combined filesystem and intelligently manages, where those files will be placed.
The package is called «mhddfs» and is currently present in Debian Testing and Unstable. It does not seem to be available in Ubuntu at the moment.
Let's say the three hard drives you have are mounted at /mnt/hdd1 /mnt/hdd2 and /mnt/hdd3. Then, you might have something akin to the following:
$ df -h Filesystem Size Used Avail Use% Mounted on ... /dev/sda1 80G 50G 30G 63% /mnt/hdd1 /dev/sdb1 40G 35G 5G 88% /mnt/hdd2 /dev/sdc1 60G 10G 50G 17% /mnt/hdd3After you have installed the mhddfs package using your favourite package manager, you can create a new mount point, let's call it /mnt/virtual, which will join all these drives together for you. The beauty of FUSE means you don't really have to be root for this (can be just a member of the fuse group), but for the sake of examples' simplicity, let's suppose we are logged in as root here.
# mkdir /mnt/virtual # mhddfs /mnt/hdd1,/mnt/hdd2,/mnt/hdd3 /mnt/virtual -o allow_other option: allow_other (1) mhddfs: directory '/mnt/hdd1' added to list mhddfs: directory '/mnt/hdd2' added to list mhddfs: directory '/mnt/hdd3' added to list mhddfs: move size limit 4294967296 bytes mhddfs: mount point '/mnt/virtual'The «-o allow_other» option here means that the resulting filesystem should be visible to all users, not just to the one who created it.
The result will look like this:
$ df -h Filesystem Size Used Avail Use% Mounted on ... /dev/sda1 80G 50G 30G 63% /mnt/hdd1 /dev/sdb1 40G 35G 5G 88% /mnt/hdd2 /dev/sdc1 60G 10G 50G 17% /mnt/hdd3 mhddfs 180G 95G 85G 53% /mnt/virtualAs you can see, the new filesystem has been created. It joined the total size of all drives together (180G), added together the space used by all files there (95G) and summed up the free space (85G). If you look at files in /mnt/virtual, you'll notice that it has files from all three drives, with all three directory structures «overlayed» onto each other.
But what if you try to add new files somewhere inside that /mnt/virtual? Well, that is quite tricky issue, and I must say the author of mhddfs solved it very well. When you create a new file in the virtual filesystem, mhddfs will look at the free space, which remains on each of the drives. If the first drive has enough free space, the file will be created on that first drive. Otherwise, if that drive is low on space (has less than specified by «mlimit» option of mhddfs, which defaults to 4 GB), the second drive will be used instead. If that drive is low on space too, the third drive will be used. If each drive individually has less than mlimit free space, the drive with the most free space will be chosen for new files.
It's even more than that; if a certain drive runs out of free space in the middle of a write (suppose, you tried to create a very large file on it), the write process will not fail; mhddfs will simply transfer the already written data to another drive (which has more space available) and continue the write there. All this completely transparently for to the application which writes the file (it will not even know that anything happened).
Now you can simply work with files in /mnt/virtual, not caring about what is being read from which disk, etc. Also, the convenience of having large «contiguous» free space means you can simply drop any new files into that folder and (as long as there's space on at least one member of the virtual FS) not care about which file gets stored where.
If you decide to make that mount point creating automatically for you on each boot, you can add the following line to /etc/fstab:
mhddfs#/mnt/hdd1,/mnt/hdd2,/mnt/hdd3 /mnt/virtual fuse defaults,allow_other 0 0For more details, see man mhddfs.
The last, but not the least important thing to mention, is the fact that it's very simple to stop using mhddfs, if you later decide to do so - and not lose any file data or directory structure. Let's say, at some point in time, you purchase a new 500 GB hard disk, and want to sell the smaller disks on Ebay. You can just plug in the new drive, copy everything from /mnt/virtual onto it, and then remove mhddfs mount point and disconnect old drives. All your folders, which were previously merged in a «virtual» way by mhddfs, will now be merged in reality, on the new disk. And thanks to the fact that files themselves are not split into bits which are stored on different drives, even in the unlikely event when mhddfs suddenly no longer works for you (or disappears from existence), you can still copy all your data from all three drives into one single folder, and have the same structure you previously had in that /mnt/virtual mount point.



