Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
GWN Tips & Tricks [Compilation]
View unanswered posts
View posts from last 24 hours

Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message

Joined: 16 Mar 2003
Posts: 410
Location: Netherlands

PostPosted: Fri Sep 12, 2003 2:32 pm    Post subject: GWN Tips & Tricks [Compilation] Reply with quote

Note: Please do not post chatter in this thread. See GWN Tips & Tricks [Discussion] if you want to comment or reply. Accepted posts to this thread are ONLY posts that are updates to this list in the EXACT same format. Thank you. -- pjp

Gentoo Weekly Newsletter Tips & Tricks:

KDE Transparency
Just because you have an older computer or a laptop doesn't mean you have miss out on some eye candy. The Translucency feature in KDE lets you have transparent windows, windecos and kicker, and drop shadows. This is real transparency, it doesnt just capture your desktop and use that. Any windows you have behind the transparent windows can be seen and changes reflected in real-time.

This weeks Tips and Tricks covers an application who's time has come: Synergy. This handy application is a software KVM, allowing you to use one keyboard and mouse across multiple machines with their individual monitors. Synergy even works cross platform (with copy and paste!) between Linux, OS X, and Windows.

Let Bash Save Your Aching Fingers
One the greatest things about Linux is that all you really need is a command prompt to get some work done. Of course, this comes at the expense of stressing out your finger muscles. Or... does it? Here's some nice little tips to save your aching fingers.

New update script
Back in the December 4th issue of the GWN, a nice update script called update-world was featured in the Tips and Tricks section. Since December, several more update scripts have been posted by budding developers. One such script is simply called update.

Estimate emerge time
You can analyze your system's emerge.log file to find out how long a given package took to compile and also to estimate the time of future compile jobs, or you can use genlop, which is designed for the job.

Spice up your MOTD
MOTD stands for "Message Of The Day". On most systems the file /etc/motd serves to output messages when someone logs in to the system. In this installment of Tips and Tricks we learn how use fortune and cowsay to create a fancy MOTD.

An easier way to update your world
Without doubt, one of Gentoo's best features is its package management system, Portage. Portage makes it very easy to update your entire system with one simple command. Sadly, things don't always go as smooth as they should. Almost every Gentoo user has typed emerge -uD world and gone to bed with the hope of waking up in the morning to a completely up to date system. Unfortunately, it's more likely that you.ll wake up to a failed emerge on package 3 of 220. And so the troubleshoot and emerge --resume process begins.
Enter update-world to save the day. Update-world is a bash script that was recently created by count_zero and posted in the forums. The script controls the update process and forces portage to skip past failed builds and continue compiling packages until the update list is finished. Failed builds are added to a list for review once the update is finished.

searching for ebuilds in overlays that are not locally available
With the diverse array of overlays now available to the community, one of the issues a person might have is finding that overlay that is just right for the package they are looking to install. Unfortunately, the default search capabilities of portage are only able to search though overlays that have already been installed on your system. Stefan Schweizer has written an excellent article at his Planet Gentoo blog this week detailing the workings of a tool that makes searching through remote overlays a much easier task than ever before. The package for this task is app-portage/eix.

Using 'until' with portage
Have you ever updated your world or system and walked away only to come back several hours later to find out the update did not complete because a package failed? The following simple command list and bash 'until' command will let you update your world or system to completion and skip those packages that failed...

Using GNU screen
GNU screen is a very useful program, especially if you are a coder or administrator. It has a lot of options, and it's not easy to find your way in its huge man page. Below is a small list of some useful options that you should put in your ~/.screenrc.

Changing default portage colors
When using a white background for a terminal emulator and portage displays some text in yellow (e.g. new useflags with the "%") it can be very hard to read. To change the yellow color of emerge output to something more readable (consistently and system-wide) one can just create the file /etc/portage/ with the following information:

Changing virtual terminals
Changing virtual terminals is already a fairly easy combination of keypresses in a standard Linux installation.If are you are in X, you would use Ctrl+Alt plus the function key of the terminal number to change to. Switching back is easy, just select Ctl+Alt+F7. Outside of X it's one less keypress - Alt+F2.
Like most things in a Unix-like environment, there is more than one way to accomplish your goal.This one is no different. The sys-apps/kbd ebuild installs a chvt binary which lets you change terminals with one command. The only argument it takes is an integer value of which one you want to switch to.

Play some games: ScummVM
While most of today's games won't run on Linux systems easily, there is still a wealth of options in yesterday's catalog that work great with an emulator. If you can hunt down an original copy of the games, ScummVM will run some classic point-and-click adventure games such as "Full Throttle", "Day of the Tentacle" and "The Secret of Monkey Island."

Exploring portage features
The new release of Portage 2.1 brings many features and improvements. While most of them are documented in the example make.conf and the portage man page they may not be obvious to most users, so we will show how to use some of these features.

Searching the portage tree with eix
eix is a handy utility that indexes your portage tree and quickly searches it. The latest stable version, 0.55, is also compatible with Portage 2.1's new metadata backend.

Managing your overlays with layman
layman is a small and nifty Python application written by Gentoo developer Gunnar Wrobel which allows to easily use and synchronize several Portage overlays on your local machine.

Efficient file change notifications
Many applications rely on tracking filesystem changes internally, and until recently, the most popular library providing functionality like this was app-admin/fam. Packages which use FAM for file-monitoring include GNOME, KDE, PHP, various file managers, various mail clients and servers, and many more. FAM works by repeatedly polling directory contents and looking to see if things have changed. This is inefficient, but it did the job for a while.
More recently, ultra-efficient kernel-side support for monitoring file changes was merged into Linux 2.6. This functionality, called inotify, is on by default, and is probably already available on your system (assuming you are relatively up-to-date). app-admin/gamin is a direct replacement for FAM, even implementing an identical API. The biggest bonus about gamin is that where available, gamin monitors the filesystem using inotify, destroying the ugly overhead which FAM had.

Iproute2 instead of ifconfig/route
For many, ifconfig and route are still the preferred commands for configuring a network through the command line. However, in modern network environments, ifconfig has its drawbacks. And as you would expect from a Free Software community, improved packages have been developed. iproute2 is one of them and is getting increasingly popular.

Rebuilding modules after a kernel upgrade
module-rebuild is a tool written by Gentoo developer John Mylchreest that serves a very simple, but utterly useful purpose: Whenever you've upgraded your kernel to a newer version, this script hunts down all packages that use -- now outdated -- kernel modules and rebuilds them for you.

Tune your filesystem
ext2/3 are the main filesystems for a large amount of users but what a lot of people don't know is that you can get almost Reiser4 speed out of it without any of the instability they'd associated with Reiser4. One of the great features of ext2/3 is the ability to tune it by adjusting various parameters. The one we are going to modify here is dir_index which essentially uses hashed b-trees to speed up lookups in large directories.

Recovering some log space
To keep your computer uncluttered and clean you can use these commands to keep /var/log nice and tidy.

Trying out filesystems where it does no harm
Ever felt like trying out an experimental filesystem like Reiser 4, but don't want to jeopardize your entire system? Then this thread in the Gentoo forums has a suggestion that just might do the trick: test it on a separate partition for /usr/portage -- if anything goes wrong, all you need to do is reformat /usr/portage and emerge --sync to get everything back the way it was before.

Watch it!
Sometimes one wishes to watch for changes, e.g to the free space on their disks, to users logged in and the likes. As with most things there exists a Unix tool to do that with the least amount of work: watch.

Tweaking kernel options yet some more
Remember our rather concise tip about the search function in the kernel's make menuconfig last week? A related tip is particularly helpful whenever you're trying to do something like eradicate an unknown dependency. For example, let's say that you want to change your kernel configuration from modular to monolithic. But when you try to make that change, it is blocked because there are still features marked "M" somewhere.

Searching for kernel features
If you cannot find what you are looking for in the kernel then there is a minimal search function provided by the "/" (slash) key.

Logging the boot messages
Wish to log the console output during the boot process? Starting with the new baselayout-1.12 it's now possible: Just edit /etc/conf.d/rc to show

ulimit and sysctl
The ulimit and sysctl programs allow to limit system-wide resource use. This can help a lot in system administration, e.g. when a user starts too many processes and therefore makes the system unresponsive for other users.

Catching emerge messages with enotice
One thing portage is lacking for a long time is catching all the notices and warnings during compilation, so that you know what changed during your latest nightly update. You know the bugs where something isn't working any more since the latest update, just because you didn't read the warning that scrolled up the screen while you didn't watched the compile-process? Here is a solution: enotice!

Using vim as Man-page and Info browser
Man-pages and Info are a very good resource for additional information of an application. Man-pages are usually shown with less and for Info you use the info-browser. Especially the info-browser is somewhat uncommon to use if you are not an emacs-user. In this week's Tips and Tricks we will show you how to use vim as your Man-page and Info browser.

Fullscreen task-switching: skippy
You know the problem: Too many applications open, too many windows open, and you are searching for one window you can't find in your taskbar or with the taskswitcher. That's the point when skippy becomes handy.

Bootup with the Gentoo 2005.0 logo
When you boot from the 2005.0 LiveCD you see an awesome Gentoo bootlogo and progress-bar -- and you wish you could impress your friends with it during your usual bootup?

Emerge flags deserving more attention
There are a few flags emerge accepts that can give some insight as to what it is (or will be) doing. We've described some of the newer ones that have been added with portage-2.0.51, but there are a couple of older switches that users may have forgotten about. Here's a quick look at two of those.

Portage magic: Identify obsolete packages
Gentoo developer Brian Harring designed a clever way to identify all merged versions of packages not available in Portage anymore -- both the official tree and packages from PORTDIR_OVERLAY. Here is the method he came up with...

Watching logfiles on your desktop: root-tail
A good sysadmin should be able to take care of what's going on his system at any time. To keep up with what's going on it would be best to see the logfiles just scrolling by on the desktop, but most utilities, like tail -f, cannot handle more than one file at a time. Moreover, it's a little tricky to configure a terminal so that it becomes borderless and transparent.

Gentoo bugzilla search plugin for Firefox
Are you using the little search input field on the upper right of your Firefox browser window? Most people do, and most of most people use it only to google for search terms. A little lesser known is the possibility to add plugins for limited searches at specific websites - or the Gentoo bug report system, for that matter. This extremely useful little add-on was concocted by developer Mike Frysinger, and hunts for your search terms in the overview of bug reports at Gentoo's central Bugzilla.

Denu - a Portage-savvy menu generator for window managers
Are you switching from Fluxbox to Gnome to KDE a lot? Would you like to try out even more window managers, if it wasn't for the missing application entries in the menus to hop along with you? This week's tip brings a nifty solution in reach: Denu is a brandnew tool to assist in menu generation. It can generate similarly structured menus for various window managers enabling easy transitions from one to another.

Devtodo: Nifty tool for developers and others
This small program provides a per-directory todo list. Items can be added, deleted, edited and changed in priority. The list is always sorted with the most important items on top, equal priority items sorted by time, oldest first.

Fresh USE flag and profile editors
ufed has served its purpose of providing an overview and editing USE flag settings in Gentoo systems for quite a while. Its ncurses-based interface wasn't exactly pretty, and it hasn't seen much development over the past few months. Enter the alternatives: Damien Krotkine has just brought his new "Profuse" up to speed and into Portage. It is meant to be particularly good at dealing with cascading profiles.

Revival of the Compose Key a.k.a. Multi_Key
Many users are on a keyboard layout which does not allow to type other characters than those printed on the keys. There are some workarounds with so-called "deadkeys" so that you can type characters with accents, but that does not enable you to type all characters in your locale.

Portage GUIs
Larry the Cow became just a bit frustrated with Portage and its textual frontend. There used to be the legendary KPortage to sooth his craving for a graphical user interface, but its development stalled, and it vanished from the Portage tree a long time ago. Then Larry tried guitoo and porthole. He was impressed. He found two up-to-date Portage frontends with ongoing development. All of a sudden, Larry the Cow was in control. And he liked it.

Portage magic
/var/log/emerge.log is well-known as the central reporitory of information about all emerge activity going on in system. Lesser known are some tricks you can do with the content of that log file.

Hotplugging? Coldplugging!
Today's tip comes straight from Gentoo's kernel package maintainer and developer department, and it reflects quite an important change in the behaviour of a core mechanism during the boot process.

Specifying only needed locales
The locales a user can choose from are built by the glibc. Usually all available locales starting from aa_DJ (Afar locale for Djibouti) over en_US (English locale for the USA) to zu_ZA.utf8 (Zulu locale for South Africa) will be installed. Unless you're working at the UN and administer a central server for all member states, it is difficult to conceive why you would need a system where all of these locales are installed. This week's tip was written with all those of you in mind who'd like to save 90 percent of the space occupied by locales in their system, by limiting the number of installed locales to the bare minimum.

Last week's GWN introduced brandnew Portage features, this week we'd like to take you back to a venerable, sturdy old feature that's hot nonetheless: PORTAGE_NICENESS.

Portage's new '--newuse' option
This week we want to explain a new Portage option which allows you to track changes to USE flag settings you may have altered after installing an application. We're talking about --newuse, one of a number of very useful new features in Portage 2.0.51. Before we start, make sure that you've installed the latest Portage revision on your box.

Gentoo Initscripts
This week we will have a look at some nice to know things about initscripts that every sysadmin and user should at least have heard of once.

OpenVPN primer
There are as many advantages to VPN tunnels as there are different VPN scenarios. One easy implementation is the "OpenVPN via tun-device" solution.

Some pretty .bashrc hints
This week we cover some nice to know bash tips that in my opinion every user should know of.

Roaming network profiles for Laptops with Quickswitch
Every Laptop user knows what I am talking about by saying that switching network profiles is a real problem and hard to keep track of when doing it manually. This is where Quickswitch comes in. Quickswitch is a utility that not only makes laptop users' everyday life easier by letting them create and use roaming network profiles, but it also has built-in support for multiple network cards, wireless LAN configurations, different kernel parameters, support for X configurations, Netscape preferences, Samba shares and so on and so forth.

Using Unison to Synchronize Two Directories
A very common question often asked in the Forums and on IRC is how to synchronize directories and files on a host or between different hosts. Unison is a robust user-level file-synchronization tool that works cross-platform available under the GNU Public License.

Comparing Files
Often people compare the differences between two files using diff. But if you needed to do a comparison of similarities between files, comm is the command to use.

Using bash history
If you have ever typed a long command and needed to repeat it, or you need to repeat a series of commands, try using history instead of re-typing.

Using 'make' for backups
Usualy make from sys-devel/make is known as a tool for compiling applications. But it could also be used to provide often used commands so that they can be accessed easily.

Finding recent files with ls and 'FlAt'
A quick way to find recently changed files is to pass the -FlAt flags to ls. Combined with head, this command can give you a quick overview of recently modified files in a directory.

Protecting files with noclobber
This tip is for people who have ever hosed important files by using > when they meant to use >>. Add the following line to .bashrc: set -o noclobber. The noclobber option prevents you from overwriting existing files with the > operator.

This will allow you to emerge unstable ebuilds by typing akmrg foo instead of the more cumbersome ACCEPT_KEYWORDS="~x86" emerge foo.

Implementing a command line thesaurus
Many people make use of dict to lookup word definitions. (If this is new to you, try dict word). Sometimes what we need instead of a dictionary is a thesaurus. This week's tip demonstrates a script to do just that.

Quick 'cd' trick
To return to the previous directory in the shell (bash, ksh, zsh, etc), use cd -

Changing the logname with sudo
If you use sudo and RCS, the $Author: carlos $ and $Id: 20040517-newsletter.xml,v 1.1 2004/05/18 01:20:52 carlos Exp $ RCS tags always appear as root instead of the actual person that edited the file. It's possible to compare file modification times with sudo log entries, but that's tedious. There's a much simpler way using sudo options.

Renaming Files
Often files need to be converted from uppercase to lowercase. Sometimes this is a side effect of moving from case-insensitive file systems to case-sensitive ones.

Multiple X-Sessions
XFree86 allows you to have multiple X sessions open at once. This can be useful if you want or need two different desktop environments open at once.

Timezone conversion using date
Many users may already use date to check the time from a console, but this week we're going to show you how it can be used to convert timezones.

Using ulimit
This week's tip introduces ulimit -- a command to define system resource limits. As a user, you can create self-imposed limits to prevent processes from taking up too much CPU time or memory.

Reading binary data with strings
This week's tip shows you how to extract ascii content from binary data using strings. This program is useful for determining the contents of non-text files such as core or other binary error files.

Recovering the root password
This week's tip shows you a couple of ways to reset the root password if you've forgotten it.

Converting Text Files
This week's tip shows you how to convert files from Windows format to UNIX format and vice versa. This can be handy if you've ever opened a file that was created in Windows and found your screen full of of ^M characters at the end of every line.

Using RCS
This week's tip shows you how to use of RCS to keep track of changes in configuration files. To get RCS and its related tools, install app-text/rcs from Portage. To get started with RCS, try putting /etc/make.conf under revision control.

Job Control
This week's tip shows you how to use the basics of job control in the shell by putting processes in the background and returning them to the foreground.

Improving DNS Lookups
This week's tip shows you how to improve DNS lookups by using multiple nameservers. This is useful if you've ever had your primary DNS server become unreachable for any reason.

Using watch to repeat comands
This week's tip shows you how to use watch to have commands run repeatedly. Make sure you have the sys-apps/procps package installed to make use of watch.

Using nl to number lines
This weeks tip shows you how to use nl to add line numbers to a file. One of the more common commands to add line numbers is simply cat -n. However, nl adds extra functionality (such as controlling for white space, zero padding, and column justification).

Forwarding an SSH agent
This weeks tip shows you how to forward ssh sessions between hosts so you don't have to copy private keys between hosts.

Shell Auto-logout
This week's tip shows you how to have your shell automatically logout after a set period of time.

Linux Magic System Request Key Hacks
This week's tip is about the 'magic' SysRq key that can be used to send events to the kernel in Linux.

Using /etc/skel
This week's tip shows you how to use /etc/skel to ensure that all new users on your system get the same initial settings.

Tips for 'ls'
This week's tip demonstrates some useful variations of one of the most common commands in a linux system: ls.

Backup up files with tar
This weeks tip demonstrates a quick way to back up files using tar.

ANSI Escape Sequences: Colors
This week's tip shows the colors available as ANSI escape sequences. These can be used to beautify terminal prompts, text, or anything else that understands ANSI escape sequences.

Killing a Hung Virtual Console
This week's tip shows you how to restore a hung virtual console (without rebooting). To do this, you need sys-apps/lsof from portage.

Using the file command
This week's tip demonstrates the use of the file command. This command has been in UNIX since at least 1973 but is often overlooked. However, it's an extremely useful command for classifying files.

Spell Checking with Aspell
This week's tip demonstrates spell checking a file withaspell. aspell. While aspell comes with it's own dictionary, it also allows you to create and maintain a personal dictionary as well. There are many uses of aspell, but this week we are just going to look at interactively spell checking a file.

Scheduling with "at"
This week's tip shows you how to schedule events in Gentoo Linux with the at command. While cron is the more common scheduling utility in Gentoo Linux, at is useful for scheduling one-time events, or simply setting a task to run at some date/time in the future.

Displaying Runlevels
This week's tip is about a couple of utilities to help you deal with init scripts and runlevels. Gentoo Linux has four main runlevels: boot, default, nonetwork, single. To manipulate these, use the /sbin/rc-update command. While rc-update add and rc-update del are covered in the Gentoo Docs, you may be wondering how to see the runlevels a service is in. This is done with the rc-update show command.

Using the Gentoo Log Parser (genlop)
This week's tip introduces the Gentoo Log Parser (genlop), which is a utility to create useful reports from your /var/log/emerge.log file. To get started with genlop, you'll need to install it using the following command: emerge app-portage/genlop.

Introducing the -- flag
This week's tip introduces the -- flag. This flag is supported by many utilities but isn't always documented in the man pages. However, it can be very useful, especially when dealing with malformed filenames.

Using qpkg
This week's tip demonstrates some basic uses of the "query package" (qpkg) which allows you to perform get information about installed or uninstalled packages on your system. It can be used to find package ownership of files, to find duplicate packages, to list the files installed by a package, and more.

Using netstat
This week's tip demonstrates some useful applications of the netstat command. Netstat is a command used to print out a list of network connections, routing tables, and other statistics related to networking.

An introduction to info
This week's tip introduces the info command. Just about everyone has used the man command to look up information on a command, but the info command is less well known. However, it's actually the preferred documentation method of many programmers. So if man doesn't have what you're looking for, try using info instead.

An introduction to sudo
This week's tip demonstrates some common uses of sudo which allows normal users to run commands with elevated privileges. This week we look at using sudo to view log files and handle basic user administration.

Using SSH for remote commands
This week's tip shows a less common use of SSH. Most people use SSH to login to servers or boxes remotely. However, you can also use SSH to issue commands on remote servers without opening a full login shell.

Editing USE flags with ufed and euse
This week's tip introduces two USE flag editors; ufed (an ncurses based utility) and euse (a command line utility). Between these two programs the days of opening /etc/make.conf and editing USE manually can be over.

Converting data with units
This week's tip shows you how to use the units command which is a nifty utility that converts quantities between scales (e.g. meters to feet or kilograms to pounds). While not an essential tool, it can certainly be convenient at times.

Creating ScreenShots with import
This week's tip shows you how to take screenshots of your desktop or individual windows using the import command. import is provided by ImageMagick so you'll need to install it from portage.

Using script
This week's tip shows you how to use script as a way to store or share everything printed during a terminal session. This can be a great way to remotely demonstrate command-line Linux to a less experienced user. Alternatively, it's a good way to keep a record of everything you do (or did) for a specific session.

A Quick and Easy Password Generator
This week's tip shows you how to quickly generate a list of passwords using /dev/urandom, and uuencode.

All about:Mozilla
This week's tip shows you some useful tricks in Mozilla - specifically the about: address. To access these special pages in Mozilla (or any Mozilla based browser), just enter the URL into the location bar.

Accessing the Kazaa network without Wine
This week's tip shows you how to use giFT to access the Kazaa network without using WINE.

Using Screen
This week's tip demonstrates the use of screen which is a "fullscreen window manager that multiplexes a physical terminal between several processes." Practically speaking, this just means you can use screen to start a process in one terminal and check the output in another.

Killing Processes
This week we show you some interesting ways to kill stubborn processes. Never let it be said that you can't kill a process again! The first way is the old boring way that most people probably use. Use the command ps aux, look through the process list until you find the PID you want and issue the kill command. How tedious!

Quick Backup Tricks
This week we show you some quick backup tricks to keep important files backed up in the event of a machine failure. To have these run daily, just add these scripts to /etc/cron.daily. These aren't all encompassing but could easily be expanded or combined with other simple scripts to ensure that your system stays backed up.

Querying Portage with etcat
This week's tip shows you how to use the etcat command to retrieve information on Portage, USE flags, package versions, and much more.

Combining Commands with For
This week's tip shows you how to run similar commands in a loop to avoid typing in the same command over and over again. For example, untarring several tar.gz files. Or perhaps renaming files with similar extensions.

Export an X Session
This week's tip shows you how to run GUI programs remotely by exporting an X session and tunneling it over SSH. Note that this is heavily dependant on the speed of your network connection. If you're trying to run Mozilla off of a box on the other side of the country on a 56K modem it is probably not going to work very well. The best application for this is running programs over the same LAN or possibly a high-speed WAN. An easy example application is running gvim remotely so you can have a GUI editor.

Blocking Spam with bogofilter
While we've already had one tip on blocking spam with SpamAssassin, this week we look at another way to block spam using bogofilter (available in portage), crontab and Evolution. This example uses MH style mailboxes but could be extended to other types as well.

Setting the Hardware Clock
This weeks tip shows you how to set the hardware clock on your Gentoo Linux box with the command hwclock.

Using Fluxbox Autogrouping
If you use the Fluxbox window manager, autogrouping and tabs allows you to view programs as a grouped window instead of separate windows. This week's tips demonstrates this feature using Eterm as an example.

Adding Users with Superadduser
Adding users to a system can be tedious. It involves creating an account, setting a password, and creating a home directory. This week's tip shows how to make adding users easier with the use of superadduser.

Privilege Separation in Portage
One nice feature of Portage is that it can drop privileges and compile as a less privileged user. It can also sandbox most phases of the installation. This week's tip shows you how to enable these features of Portage to increase the security of your system.

Preventing System Reboot with Ctrl-Alt-Del
The "Three-Finger-Salute" or, the key combination Ctrl+Alt+Del is typically mapped to the command /sbin/shutdown -r now. In other words, it reboots your system. Sometimes this may be unwanted behavior, so this week's tips shows you how to disable, or remap that key combination.

Using /dev/loop to view a CD image
This week's tip explains how to use the loop device to view or share files from a CD image or ISO file.

Changing File Attributes
This week's tip explains how to use chattr to keep important system files secure. The "change attribute" command, or chattr, can be used to add or change existing file attributes for things such as synchronous updates, tighter file security, and more. However, this command is only available on ext2 or ext3 partitions.

Synchronizing System Date/Time with rdate
This week's tip shows you how to keep your system's date and time synced without the hassle of NTP. The command rdate allows you to get the time from a server running NTP but doesn't require you to set up your own NTP server.

Using tmpfs
This week's tip shows you how to make use of tmpfs to speed up access time for small temporary files. Tmpfs simulates a filesystem by supporting normal read/writes but the files are stored in memory. This makes access much faster. Note that files stored in tmpfs are not saved between reboots. Also, tmpfs is only recommended for systems with large amounts of memory.

Using a localized rsync mirror rotation.
This week's tip shows you how to take advantage of the new country and continent-specific round robin rsync mirror rotations.

Creating a Certificate Authority (CA)
This week's tip shows you how to create your own Certificate Authority used for signing SSL certificates.

Handling Files with Spaces
Many Gentoo users still favor command line tools (ls, find, etc.) over the newer GUI interfaces such as Nautilus or Konqueror. However, many command line users find that dealing with filenames that have spaces in them is difficult; especially when trying to automate a process or deal with multiple files at once.

Mirror, Mirror On The Wall
As Gentoo's userbase grows, a common complaint is the slowdown of its primary mirrors. Many people in the community have responded, adding more mirrors to help distribute the load. So where do you find these mirrors? One way is to look on the website at The other (easier) way is to use the handy mirrorselect tool. MirrorSelect is a simple ncurses interface that allows you to select which mirror(s) you want to use for your machine.

Bash Commands and Tricks
Just about all Gentoo user make use of the command line - this week focuses on some little-known navigation commands that may make your life easier.

See which USE variables affect a package during an emerge
One of the most-often requested features in Portage is the ability to quickly and easily see what effect USE variables have during the emerge process. The release Portage 2.0.46-r12 makes this feature available.

Setting Your Terminal Title
Since most Gentoo users frequently use terminals (xterm, Eterm, etc.), this week's tip shows how to make them more useful by adding information to the title. We can add the username, hostname, and working directory into the terminal title, making it easier to see where a terminal is, especially if it is minimized. Instead of having to open up the full terminal window, a quick glance at the taskbar is all that's necessary.

Using Procmail and SpamAssassin to Block Spam and Filter Mailing Lists
The proliferation of unsolicited email, or spam, is becoming more and more widespread. However, there are many tools to help prevent spam. This week, we look at using Procmail and SpamAssassin to filter incoming mail and to block incoming spam. Procmail is a mail filter than can be used to sort incoming mail into separate folders as well as many other types of mail preprocessing. SpamAssassin is a mail filter that uses heuristic scanning to identify spam.

Using GnuPG to digitally sign emails
GNU Privacy Guard (GnuPG) is an open source version of the commercial Pretty Good Privacy (PGP) software for creating digital signatures. This weeks Tips and Tricks will cover the creation of a key, exporting your key to a public keyserver, and finally adding your digital signature to email.

Keeping track of emerge world
Gentoo ebuilds sometimes require post-install configuration. Typically these ebuilds will notify you of any necessary commands to run. However, when running an emerge update world, these notices can scroll by very quickly and get lost as subsequent packages are installed. To get around this, we can send the output of emerge to a logfile. We use the 'tee' command to accomplish this since 'tee' allows us to watch the emerge in process in addition to writing to a file.

Updating a Gentoo system
Most Gentoo users are familiar with the Portage system used to install software. One of the features that you may not be familiar with is that Portage can also update your entire system at once. This is known as an 'update world'.

Getting information about installed packages
New Gentoo users often ask how to get a list of installed packages from the Portage tree, but what many of those who give answers might not know is the abundance of tools that can be used to do so. From Portage's pkglist, the gentoolkit's qpkg and epm(an rpm work-alike), to walking the /var/db/pkg/ directory structure yourself, there are definitely quite a few choices. Here are two ways to list all installed packages, first using pkglist (found in /usr/lib/portage/bin/, which is often not in $PATH), the second running find on /var/db/pkg/:

Manually resetting a service
Have you ever tried to restart a crashed service and gotten the following error message?

When all else fails, read the manual...
Registered Linux User #340626

Last edited by xentric on Fri Oct 05, 2007 10:14 pm; edited 92 times in total
Back to top
View user's profile Send private message

Joined: 16 Mar 2003
Posts: 410
Location: Netherlands

PostPosted: Sat Sep 13, 2003 7:08 am    Post subject: Reply with quote

EDIT: this script hasn't been updated. It won't catch all tips because the devs don't use
consistent formatting of the GWN source... I just copy-paste the tips manually now.

I wrote a small perlscript that automagically produces BBcode output for the list above...
I just open the generated html page with a browser and cut&paste the BBcode into a forum message.

Maybe someone wants to play around with this, so here's the web-scraping code:

#!/usr/bin/perl -w

$baseurl = "";
$output = "/home/projects/files/gwntips/bbsource.html";

sub load_links{
   @list = `wget --quiet $baseurl --output-document=-`;
   for ($i = 0; $i < @list; ++$i) {
      $_ = $list[$i];
      if (/class="tableinfo"><a href/) {      # identify line containing link
         /<a href\=\"/;                  # look for string that indicates start of the link
         $_ = $';                     # take everything that's behind the above match
         /">/;                        # locate the trailing ">
         $url = $`;                     # take everything infront of the above match ($`)
         &extract_date;                  # extract date to make link to correct GWN page
         print "Loading $url\n";

sub extract_date{
   if ($month =~ "01") { $date="$day-JAN-$year"; }
   if ($month =~ "02") { $date="$day-FEB-$year"; }
   if ($month =~ "03") { $date="$day-MAR-$year"; }
   if ($month =~ "04") { $date="$day-APR-$year"; }
   if ($month =~ "05") { $date="$day-MAY-$year"; }
   if ($month =~ "06") { $date="$day-JUN-$year"; }
   if ($month =~ "07") { $date="$day-JUL-$year"; }
   if ($month =~ "08") { $date="$day-AUG-$year"; }
   if ($month =~ "09") { $date="$day-SEP-$year"; }
   if ($month =~ "10") { $date="$day-OCT-$year"; }
   if ($month =~ "11") { $date="$day-NOV-$year"; }
   if ($month =~ "12") { $date="$day-DEC-$year"; }

sub load_page{
   @line = `wget --quiet $_[0] --output-document=-`;
   for ($j = 0; $j < @line; ++$j) {
      $_ = $url;
      $url = $_;
      $_ = $line[$j];
      if (/Tips and Tricks<\/p>/i) {         # identify tips and tricks section
         for ($k = $j+1; $k < @line; ++$k) {
            $_ = $line[$k];
            if (/<p/i) {               # look for <p to find title
         for ($k = $j+1; $k < @line; ++$k) {
            $_ = $line[$k];
            if (/<p/i) {               # look for <p> to find description which follows after title

sub extract_title{
   s/<[^<>]+>//g;                        # remove all html tags
   s/[^a-zA-Z0-9 -_+.!?:\/\\]//g;            # remove characters except those in the regexp
   s/^\s+//;                           # strip all spaces from beginning of line
   if ($_ !~ /^\s+$/) { print FILE "<b>[url=".$url."][b]".$_."[/b][/url]</b><br>\n"; }

sub extract_description{
   for ($l = $k; $l < @line; ++$l) {
      $_ = $line[$l];
      s/<p>//i;                        # strip off the <p> tag
      s/\t//g;                        # strip all tabs from line
      s/^\s+//;                        # strip all spaces from beginning of line
      if (/<\/p>/i) {                     # look for </p> which indicates end of the tip-description
         s/<\/p>//i;                     # strip off the </p> tag
         if ($_ !~ /^\s+$/) { s/<[^<>]+>//g; print FILE "$_"; }
      } else {                        # or just print a line of the description
         if ($_ !~ /^\s+$/) { s/<[^<>]+>//g; print FILE "$_"; }
   print FILE "<br><br>\n\n";

sub make_bbsource{
   open(FILE, ">$output");
   print FILE "<html><head><title>Gentoo Weekly Newsletter - Tips & Tricks</title></head><body>\n";
   print FILE "[i]Note:  Please do not post chatter in this thread.  See [url=]GWN Tips & Tricks [Discussion][/url] if you want to comment or reply.  Accepted posts to this thread are ONLY posts that are updates to this list in the EXACT same format.  Thank you.  -- pjp[/i]\n\n";
   print FILE "<br><br>\n";
   print FILE "<b>[b]Gentoo Weekly Newsletter Tips &amp; Tricks:[/b]</b><br><br>\n\n";
   print FILE "<br>[size=9]Source: [url=".$baseurl."]".$baseurl."[/url][/size]<br>\n";
   print FILE "</body></html>\n";
   print "Listing of all Gentoo Weekly Newsletter Tips & Tricks complete...\n";
   print "Document generated --> $output\n";


(Anyone ever noticed that the phrase "main;" will not show up between code tags in BBcode? Weird shit...)
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum