Linux

Watching email logging live on a Linux box

|

I’m told that most mail service applications on Linux keep their log in /var/log/maillog. Watching this log is as simple as:

tail -f /var/log/maillog

Removing/deleting a soft link

| |

Note: Thanks to user feedback you can find the *correct* solution to this problem in the second half of the article below. The first portion deals with my problem and my workable, but not-quite-correct, solution.

This is my totally incorrect, yet usually workable solution to a problem I have faced on several occasions with the Linux shell util ln. The problem occurs when I create a soft link to a directory and then I attempt to remove the soft link. If I try to remove it with rm, I find that I can't. My favorite part is that rm will tell me both that the link is a directory and also that it is not a directory:

{duck@zoe} $ ln -s /home/duck/www/gallery/gallery2
create symbolic link `gallery2' to `/home/duck/www/gallery/'
{duck@zoe} $ rm gallery2/
rm: remove directory `gallery2/'? y
rm: cannot remove directory `gallery2/': Is a directory
{duck@zoe} $ rm gallery2/ -rf
rm: cannot remove `gallery2/': Not a directory

Managing variables in the bash shell

| |

A few quick notes on how to perform simple variable management in the Unix/Linux bash shell.

Enumerate all variables:
env

Retrieving variable values:
echo $VARIABLE

Set a variable like so:
VARIABLE=whatever

Append to a variable like so:
VARIABLE=$VARIABLEmore

Example: To add /usr/bin to the path, as you would need to do in Cygwin if you intend to make use of any of the base tools, type:
PATH=$PATH:/usr/bin

Making certain a file is not going to be changed accidentally

|

Only the superuser can change a file which has been protected by the chattr 'a' attribute:
chattr [-R] +a files...