A Text Web Browser?
Yes, there are such things. In fact there are several available for Linux. Our Debian workstation has one installed by default. Called w3m, it is a full featured browser that operates in text mode. So what can you do with it? Well, we won't be watching YouTube with it, that's for sure, but many well written web sites (especially those designed to follow acceptable standards of accessibility) will render just fine. We can try it out:
me@linuxbox:~$ w3m linuxcommand.org
and after a few seconds we will see this:
The arrow keys will navigate, and the tab key will advance from link to link. Shift-h will bring up the help screens and shift-b will perform a "back" function (this will get you out of help too). Press the q key to quit w3m. The program can do tabbed browsing, render tables and has a number of command line tricks. This blog renders fine too, so you can now follow along directly on our all-text system.
Unfortunately, there is a bug that prevents w3m from using the mouse on the console to help with navigation. Fortunately, there are other browsers that you can install. See the link at the end of this article.
Automatically Mounting USB Devices
If we insert a USB flash drive into our system, we will see a kernel message appear on the screen. This is because the kernel sends its messages to the console in the hopes that an ever-vigilant operator (that's you) is paying attention. However this message means very little as it only announces the fact that the kernel has detected a device attached to the USP port. It does not mean that the system has done anything useful, like mounting the device. We could manually mount the device, that that is a nuisance.
To solve this problem we will install a package called usbmount that can automatically mount USB devices. We can do this using aptitude. Just search for the "usbmount" package and install it. We described the process in installment 3.
After the package is installed, we must modify its configuration file to allow support for VFAT file systems, the type most often used on USB drives. As a precaution, usbmount does not enable VFAT since the kernel does not fully support the "sync" mount option on VFAT file systems. Normally, usbmount allows USB devices to removed without unmounting. It does this by keeping file systems "synchronized," that is, it immediately writes changes to the device versus waiting to consolidate multiple write for improved performance. With VFAT enabled, the user must issue a sync command before removing a USB VFAT device.
After the package is installed, we need to (as root) edit the /etc/usbmount/usbmount.conf file and change the following two lines:
FILESYSTEMS="ext2 ext3"
to:
FILESYSTEMS="ext2 ext3 vfat"
and:
FS_MOUNTOPTIONS=""
to:
FS_MOUNTOPTIONS="-fstype=vfat,gid=floppy,dmask=0007,fmask=0117"
After the configuration file is modified, usbmount will automatically mount VFAT devices. You will find the mount point in the /media directory. When a flash drive is inserted we can verify the mount using df:
me@linuxbox:~$ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/hda1 18856292 980140 16918280 6% /
tmpfs 160096 0 160096 0% /lib/init/rw
udev 10240 88 10152 1% /dev
tmpfs 160096 0 160096 0% /dev/shm
/dev/sda1 15560 5944 9616 39% /media/usb0
and we see that the drive has been mounted on /media/usb0. Just remember to use the sync command before removing the device, or really bad things may happen to the drive:me@linuxbox:~$ sync
Midnight Commander
The last package we will install in this episode is Midnight Commander, a text based file manager. Using aptitude, install the mc package and the following additional packages that are recommended: arj, bzip2, odt2txt, unzip, and zip. If you prefer, you can use apt-get to install the packages as the mc package is a little hard to find using aptitude:
linuxbox:~# apt-get install mc arj bzip2 odt2txt unzip zip
After mc is installed we can fire it up:
me@linuxbox:~$ mc
and the following screen will appear:
The numbered blocks along the bottom of the screen correspond to the function keys, F1-F10 and permit access to many of the programs functions and it has a lot of them! Unlike w3m, the mouse is well supported by mc.
That's all for this installment. While you're waiting for Part 5, study Midnight Commander. It has a help function and a man page. That should keep you busy for a while! Also, if you are interested in other text-based web browsers, check out the Text Mode Browser Roundup from Linux Journal.
Further Reading
Other installments in this series: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
Need fresh usbmount.conf file- had issue using vi to edit and deleted file thinking I could easily rem/reinstall usbmount to get another copy. Removed/reinstalled usbmount in aptitude, no good. Removed /etc/usbmount directory and rebooted, both times reinstalling usbmount only adds mount.d and umount.d directories and no usbmount.conf file. Any ideas? Lesson learned, will make a copy of conf file prior to vi editing. Thanks, H
ReplyDeleteYes, try aptitude on the command line like so:
ReplyDeleteaptitude install usbmount_
(Notice the trailing underscore, this tells aptitude to purge the package not just remove it.)
Next, reinstall the package with:
aptitude install usbmount
(No trailing underscore. This performs an install.)
See the aptitude man page for more detail.
Ship righted- thank you! Na Zdravi!
ReplyDeleteWhat about mp3? Add mp3blaster to your list!
ReplyDeleteAnd: Could you setup a simple text file with a list of all your proposed packages?
Yours Stefan from Germany.
I believe that, even though terminal is awesome, at least for web browsing we could install Links 2, that has a graphic mode that works without the X. I use it as an emmergency tool and its amazing.
ReplyDelete