Browsing through the Ports Collection
Pages: 1, 2
My second stop in the ports collection is usually the
directory, as it contains many small but useful utilities. One such useful
symlinks, which will find and identify all symlinks on your
system. This utility comes with a short little manpage showing all of its
switches. I decided to see all the symlinks on my system, so I became the
superuser (so I would have permission to scan all directories) and ran the
utility like so:
su Password: symlinks -vr / relative: /dev/vga -> ttyv0 relative: /dev/mixer -> mixer0 relative: /dev/sequencer -> sequencer0 relative: /dev/dsp -> dsp0 relative: /dev/audio -> audio0 relative: /dev/dspW -> dspW0 relative: /dev/music -> music0 relative: /dev/pss -> pss0 relative: /dev/dsp0 -> dsp0.0 relative: /dev/audio0 -> audio0.0 relative: /dev/dspW0 -> dspW0.0 absolute: /dev/mouse -> /dev/sysmouse other_fs: /dev/log -> /var/run/log absolute: /dev/modem -> /dev/cuaa1 other_fs: /etc/termcap -> /usr/share/misc/termcap other_fs: /etc/rmt -> /usr/sbin/rmt relative: /etc/aliases -> mail/aliases other_fs: /etc/apsfilter/basedir -> /usr/local/share/apsfilter other_fs: /sys -> usr/src/sys other_fs: /compat -> /usr/compat other_fs: /home -> /usr/home
In less than a second, every symlink on my system had been listed. Very handy utility for this purpose.
Another handy utility in the "sysutils" section is
pkg_tree, which will
list all of the ports and packages installed on your system in a tree-like
structure, so you can see their dependencies.
If you've built more than a couple of packages or have built a mega-port such as Gnome or KDE, you'll definitely want to page the output like so:
pkg_tree | more or pkg_tree | less
Just to give you an example of its output, I'll show the first ten lines of mine:
pkg_tree | head Mesa-3.4.2_1 ORBit-0.5.8_1 |\__ pkgconfig-0.8.0 |\__ glib-1.2.10_4 | \__ pkgconfig-0.8.0 \__ gettext-0.10.35 OpenSSH-askpass-18.104.22.1681.02.24 aalib-1.2_2 acroread4-4.05 \__ linux_base-6.1
The last utility I'll mention today in the "sysutils" section is
fortunelock. This is a short and sweet program with a short little
manpage. If you need to leave a terminal and don't want to log out first,
It will prompt you for a password and ask you to repeat it. Once you've done so, it will repeat random fortunes until you return and re-enter the password. Passersby will at least be entertained by your terminal, even if they don't know the password to access it.
One of my favorite ports is in the
/usr/ports/textproc directory and is
glimpse. I have a lot of articles and whitepapers stashed away in
my home directory, and this utility is indispensible for finding a certain
line of text. It is similar to the
locate utility in that it builds a
database; because of this database, searches are blazingly fast, almost
The first time you want to use
glimpse, go to your home directory (I'm
assuming the information you want to find is somewhere in your home
directory and its subdirectories) and build the database like so:
cd glimpseindex -o This is glimpseindex version 4.12, 1999. Indexing "/home/genisis" ... Size of files being indexed = 6437564 B, Total #of files = 850 Index-directory: "/usr/home/genisis" Glimpse-files created here: -rw------- 1 genisis wheel 35658 Jan 13 19:52 .glimpse_filenames -rw------- 1 genisis wheel 3400 Jan 13 19:52 .glimpse_filenames_index -rw------- 1 genisis wheel 0 Jan 13 19:51 .glimpse_filetimes -rw------- 1 genisis wheel 510659 Jan 13 19:52 .glimpse_index -rw------- 1 genisis wheel 863 Jan 13 19:52 .glimpse_messages -rw------- 1 genisis wheel 342572 Jan 13 19:52 .glimpse_partitions -rw------- 1 genisis wheel 130 Jan 13 19:52 .glimpse_statistics -rw------- 1 genisis wheel 262144 Jan 13 19:52 .glimpse_turbo
The indexing will churn along for a few minutes, depending on how large your home directory is. You'll note that it will make several hidden files in your home directory that all begin with ".glimpse". Once you've made the database, try to find something. As an example, I know that somewhere I have a file that tells me the modem code for "auto answer," but I can't remember which file, so I'll try:
glimpse "auto answer"
/home/genisis/unix: no result codes (Q1), and auto answer (&S0=1). Then write the
/home/genisis/unix: at&s0=1 turn on auto answer
Not only is the modem code located in
/home/genisis/unix, I don't even
have to read the file as, it also returned the modem code I was looking
for. See why this is one of my favorite utilities?
The manpage for
glimpse has several examples on how to fine-tune your
search. If you use this utility often and are constantly creating and
removing files from your home directory, you may want to consider running
glimpseindex as a
cron job. I'm pretty lazy, so I usually just rerun
glimpseindex whenever I can't find what I'm looking for.
While I was in the "textproc" section, I also came across an interesting
utility known as
dadadodo. Even if you decide not to build this port,
I highly recommend checking out the homepage of this utility's creator; it's well worth a visit.
To run the utility, simply type:
I've found that saved emails, especially boring, overly technical ones, make great input files. With a utility like this, one could quit their day job to become either a poet or a fortuneteller.
The last port I built from the "textproc" section really impressed me. It
gutenbook port. If you haven't heard about the Gutenberg
Project, you can check it out here.
A separate project, known as the Gutenbook project, is a very user-friendly utility for accessing and reading the etexts available at Project Gutenberg. You may also want to check out the URL for Gutenbook and see the screenshots for yourself.
Once you've built this port, start it from an X Windows session. If you click on the "Browse Gutenberg (L)ibrary" button and wait a few seconds, you'll get a list of all of the available etexts. The titles are in alphabetical order and there are tabs so you can go to the section you are interested in. Or, use the "Search in Title/Author" section to search for a specific etext. Once you find one you're interested in, highlight it, click "Read Selected Etext," and wait a few seconds as it downloads it for you. You know it's finished when a zip file appears under the "Local Copy" column. Close that window and your selected etext will be loaded and ready for you to read. Not only can you read it, but you can jump to a certain page or search for a specific bit of text. You may never want to read a book the old-fashioned way again. One last note: you'll notice that a new directory named "Gutenberg_Library" will be created in your home directory to store your downloaded etexts.
The last port I'll mention today is a Keyboard Practicer found in
This is a very user-friendly GUI interface to practice your typing skills. Run it from an X Windows session and it will look like this:
The default mode is to show a Dvorak layout; if you're using a regular keyboard, go to "Options-->Keyboard" and choose "Qwerty".
Then, just start typing what you see in the top section without looking at your fingers. If you're not sure where the key is located, don't look at your fingers; instead, notice which key is highlighted on your monitor. This program will keep track of your mistakes and your speed in wpm. If you want to practice typing another file, go to "File-->Load file" which will show you all of the files in your home directory. Highlight one to practice typing and to see if you can improve your speed.
I hope you enjoyed this latest tour through the ports collection and will check out some ports yourself to make your own discoveries.
Dru Lavigne is a network and systems administrator, IT instructor, author and international speaker. She has over a decade of experience administering and teaching Netware, Microsoft, Cisco, Checkpoint, SCO, Solaris, Linux, and BSD systems. A prolific author, she pens the popular FreeBSD Basics column for O'Reilly and is author of BSD Hacks and The Best of FreeBSD Basics.
Read more FreeBSD Basics columns.
Return to the BSD DevCenter.