WGET

Introduction
Ever found yourself wanting to snag a file from somewhere on the internet without having to go through all the fuss of opening a web browser/FTP client and entering the URL? Or, have you ever found yourself wanting to be able to fetch files as part of a script? If so, wget is for you.

For basic purposes, just type wget http://server.com/foo.tar.gz, and wget will copy it locally. wget can also be configured to analyse HTML pages it downloads and follow links/downloads associated pictures by adding the -r option before the URL to grab, allowing you to snag a local copy of entire websites this way - you can even add the -k switch to have wget convert links in the HTML to work locally!

So Many Uses
wget has so many uses that we don’t have space to list them all here. However, here’s a quick taster of the most important options you can use: try the –delete-after switch to have wget download all the files it finds then delete them immediately afterwards - perfect if you want to pre-fill your proxy server with content. You can use the -H switch to allow wget to download files from other hosts when it’s in recursive mode (otherwise it won’t go beyond the original domain). The -b switch is available to make wget work in the background, which is good if you use it as a backup tool. Use -c to make wget try to continue a download from where it left off. Use –limit-rate to specify how much bandwidth wget is able to make use of. For example, –limit-rate 5k would stop wget using more than 5KB/s to download files.

Finally, use -w to specify how much time wget should wait in between file downloads - this is crucial if you don’t want to overload small servers.

Grokking Grep

One of the most useful, and therefore popular tools for administrators is grep and its associates egrep and fgrep. Put simply, grep searches through specified files for a given pattern and outputs matching lines.

A basic scenario might be using grep error /var/log/* to print out all error messages in your system logs. Similarly, you can replace error with warning or notice to get different information. However, if no filenames are specified on the command line, grep searches standard input for matches, which is where it often comes in most useful.

Take, for example, the command ps aux. On most computers, this will output around thirty lines of text describing the processes running, of which you may be only be interested in three. Using grep, we can filter the result of ps so that we only see results based on the criteria we pass to grep. So, to filter for programmes being run by user hudzilla, use: ps aux | grep hudzilla. This will technically match any programmes being run that are called hudzilla, but that’s pretty unlikely! This could be extended by using: ps aux | grep -c hudzilla which returns the total number of programmes being run by hudzilla (grep -c counts the number of matches). To finish, the hudzilla search pattern can be substituted with a call to another command-line programme, giving a command like this: ps aux | grep -c `whoami` -v. Note that whoami is surrounded by back-ticks (next to the z key), not single quotes. The -v parameter greps on the inverse of the search criteria, which, when combined with using the result of the command whoami, means that grep will pick up every programme not being run by you.

Vocabulary

Just for some folks who don’t know - I didn’t and I’m still learning:

Releases
1.3 Unstable releases (odd numbers)
1.4 Stable releases (even numbers)

IDE - Integrated development environment

Linux - pronounced ‘lin’ (as in lint) and ‘ux’ (as in crux)

Linux kernel - this is the first piece of software that gets loaded into memory when a Linux system boots.

Man pages - In terminal type man ? (followed by a command name). Try also man -k or apropos or whatis or man -f

Killing processes - The ‘kill’ command

A Story about buying cars

Imagine a crossroads where four competing auto dealerships are situated. One of them (Microsoft) is much, much bigger than the others. It started out years ago selling three-speed bicycles (MS-DOS); these were not perfect, but they worked, and when they broke you could easily fix them.

There was a competing bicycle dealership next door (Apple) that one day began selling motorized vehicles–expensive but attractively styled cars with their innards hermetically sealed, so that how they worked was something of a mystery.

The big dealership responded by rushing a moped upgrade kit (the original Windows) onto the market. This was a Rube Goldberg contraption that, when bolted onto a three-speed bicycle, enabled it to keep up, just barely, with Apple-cars. The users had to wear goggles and were always picking bugs out of their teeth while Apple owners sped along in hermetically sealed comfort, sneering out the windows. But the Micro-mopeds were cheap, and easy to fix compared with the Apple-cars, and their market share waxed.

Eventually the big dealership came out with a full-fledged car: a colossal station wagon (Windows 95). It had all the aesthetic appeal of a Soviet worker housing block, it leaked oil and blew gaskets, and it was an enormous success. A little later, they also came out with a hulking off-road vehicle intended for industrial users (Windows NT) which was no more beautiful than the station wagon, and only a little more reliable.

Since then there has been a lot of noise and shouting, but little has changed. The smaller dealership continues to sell sleek Euro-styled sedans and to spend a lot of money on advertising campaigns. They have had GOING OUT OF BUSINESS! signs taped up in their windows for so long that they have gotten all yellow and curly. The big one keeps making bigger and bigger station wagons and ORVs.

On the other side of the road are two competitors that have come along more recently.

One of them (Be, Inc.) is selling fully operational Batmobiles (the BeOS). They are more beautiful and stylish even than the Euro-sedans, better designed, more technologically advanced, and at least as reliable as anything else on the market–and yet cheaper than the others.

With one exception, that is: Linux, which is right next door, and which is not a business at all. It’s a bunch of RVs, yurts, tepees, and geodesic domes set up in a field and organized by consensus. The people who live there are making tanks. These are not old-fashioned, cast-iron Soviet tanks; these are more like the M1 tanks of the U.S. Army, made of space-age materials and jammed with sophisticated technology from one end to the other. But they are better than Army tanks. They’ve been modified in such a way that they never, ever break down, are light and maneuverable enough to use on ordinary streets, and use no more fuel than a subcompact car. These tanks are being cranked out, on the spot, at a terrific pace, and a vast number of them are lined up along the edge of the road with keys in the ignition. Anyone who wants can simply climb into one and drive it away for free.

Customers come to this crossroads in throngs, day and night. Ninety percent of them go straight to the biggest dealership and buy station wagons or off-road vehicles. They do not even look at the other dealerships.

Of the remaining ten percent, most go and buy a sleek Euro-sedan, pausing only to turn up their noses at the philistines going to buy the station wagons and ORVs. If they even notice the people on the opposite side of the road, selling the cheaper, technically superior vehicles, these customers deride them cranks and half-wits.

The Batmobile outlet sells a few vehicles to the occasional car nut who wants a second vehicle to go with his station wagon, but seems to accept, at least for now, that it’s a fringe player.

The group giving away the free tanks only stays alive because it is staffed by volunteers, who are lined up at the edge of the street with bullhorns, trying to draw customers’ attention to this incredible situation. A typical conversation goes something like this:

Hacker with bullhorn: “Save your money! Accept one of our free tanks! It is invulnerable, and can drive across rocks and swamps at ninety miles an hour while getting a hundred miles to the gallon!”

Prospective station wagon buyer: “I know what you say is true…but…er…I don’t know how to maintain a tank!”

Bullhorn: “You don’t know how to maintain a station wagon either!”

Buyer: “But this dealership has mechanics on staff. If something goes wrong with my station wagon, I can take a day off work, bring it here, and pay them to work on it while I sit in the waiting room for hours, listening to elevator music.”

Bullhorn: “But if you accept one of our free tanks we will send volunteers to your house to fix it for free while you sleep!”

Buyer: “Stay away from my house, you freak!”

Bullhorn: “But…”

Buyer: “Can’t you see that everyone is buying station wagons?”

Dyne:bolic

Dyne:bolic is a live distribution designed for media production which can run in just 64MB of RAM. Configured as a streaming media server by default, the distribution also runs on the Microsoft Xbox - which suggests all kinds of low-budget possibilities. For more details, see Dyne:bolic.

Killing Processes

The ‘kill’ command. You need to type a process number. If you don’t know the process number, type ‘top’ or ‘ps -A’, then a simple ‘kill 123456′.

To kill all instances type ‘kill all’ or ‘killall mozilla’, will kill all Mozilla processes.