Util to clean up your logfiles.
If you’re like me, you have a list with 430 subscribers, plus 100+ messages per day coming in over UUCP. Well, what’s a hacker to do with these huge logs? Install chklogs, that’s what. Chklogs is written by Emilio Grimaldo, [email protected], and the current version 1.8 available from http://ftp.iaehv.nl:/pub/users/grimaldo/chklogs-1.8.tar.gz. It’s pretty self explanatory to install(you will, of course, check out the info in the doc subdirectory). Once you’ve got it installed, add a crontab entry like this:
# Run chklogs at 9:00PM daily.
00 21 * * * /usr/local/sbin/chklogs -m
Setting UTC or local time
When Linux boots, one of the initialisation scripts will run the /sbin/hwclock program to copy the current hardware clock time to the system clock. hwclock will assume the hardware clock is set to local time unless it is run with the –utc switch. Rather than editing the startup script, under Red Hat Linux you should edit the /etc/sysconfig/clock file and change the “UTC” line to either “UTC=true” or “UTC=false” as appropriate.
What is IP masquerading and when is it of use?
IP masquerading is a process where one computer acts as an IP gateway for a network. All computers on the network send their IP packets through the gateway, which replaces the source IP address with its own address and then forwards it to the internet. Perhaps the source IP port number is also replaced with another port number, although that is less interesting. All hosts on the internet see the packet as originating from the gateway.
Any host on the Internet which wishes to send a packet back, ie in reply, must necessarily address that packet to the gateway. Remember that the gateway is the only host seen on the internet. The gateway rewrites the destination address, replacing its own address with the IP address of the machine which is being masqueraded, and forwards that packet on to the local network for delivery.
This procedure sounds simple, and it is. It provides an effective means by which you can provide second class internet connections for a complete LAN using only one (internet) IP address.
If your Xwindow freezes sometimes, here are two ways that you may try to kill your server. The first is the simple simple way of killing your X server the key combination: Ctrl+Alt+Backspace
The second way is a little more complicated, but it works most of the time. Hit Ctrl+Alt+F2 to startup a virtual console, then log in with your user name and password and run:
# ps -ax | grep startx
This will give you the PID of your Xserver. Then just kill it with:
# kill -9 PID_Number
To go back to your first console, just hit Alt-F1
Pipes are easy. The Unix shells provide mechanisms which you can use them to allow you to generate remarkably sophisticated `programs’ out of simple components. We call that a pipeline. A pipeline is composed of a data generator, a series of filters, and a data consumer. Often that final stage is as simple as displaying the final output on stdout, and sometimes the first stage is as simple as reading from stdin. I think all shells use the “|” character to separate each stage of a pipeline. So:
data-generator | filter | … | filter | data-consumer
Each stage of the pipeline runs in parallel, within the limits which the system permits. Hey, look closely, because that last phrase is important. Are you on a uni-processor system because if you are, then obviously only one process runs at a time, although that point is simply nitpicking. But pipes are buffers capable of holding only finite data. A process can write into a pipe until that pipe is full. When the pipe is full the process writing into it blocks until some of the data already in the pipe has been read. Similarly, a process can read from a pipe until that pipe is empty. When it’s empty the reading process is blocked until some more data has been written into the pipe.
Using DOS-like commands
There’s a package called mtools which is included with most of the distributions out there.
There are several commands for basic DOS stuff. For example, to directory the floppy drive, type mdir a:. This is rather handy–you don’t need to mount the floppy drive to use it.
Other commands are: mattrib , mcd, mcopy, mdel, mformat, mlabel, mren (rename), mmd, mrd, and mtype.
This doesn’t work for reading from hard disks. In that case, you would add entries to /etc/fstab, drive type msdos for fat16 partitions, and vfat for fat32.