linux poison RSS
linux poison Email
0

HowTo Forward the mail to many addresses using procmail

We just need to add more addresses to the action line:

:0
* ^Subject: This is urgent$ ! first@one.com second@two.net third@three.org

If you have a large list of recipients, you might prefer to store the addresses in an external file you can edit without mucking with your Procmail filters:

:0
* ^Subject: This is urgent$
! `cat addresses.txt`
Read more
1

Great Comment on Linux Vs Windows

Some days back I was reading an article on OpenSuse 10.2 review (Linux Vs Windows) and fortunately I came across a great comments on that article …..

read below …..

Shaking my head at you guys (gals?)! 8^)

I’ve been using linux on my main computer for 5+ years, and on my webservers for over 10. Actually started with SUSE desktop (well tried Caldera 2.1 waaay back when UGH!), then went to Fedora to get the “latest & greatest.” (They usually had bleeding edge software before other distros… Mozilla, etc.). I’ve had to purchase Windows due to my job. Picked up Vista, couldn’t upgrade from ME, so got the XP upgrade instead.

Tried Ubuntu on a friends puter, liked it so tried it on mine. All good except could not make on the motherboard nVidia Ge6100 work. Had read some reviews about SUSE, so d/led it. Setting up dual boot. Windows & Linux can read FAT32, so decided to set up my box like this. The 1st 200Gb drive as NTFS XP, 200Gb #2 as linux, 400Gb as FAT32 shared between the 2 for docs, pics, music and such.

Has anyone installed Windoze lately or just purchased pre-installed?
It took about 1 1/2 hours just to format 200Gb!!! So don’t get picky about 30 or 40 minutes to install a linux distro!
And it only formatted 128Gb, so had to use System Commander to stretch it out to the full 200Gb!

Rebooted into my newly installed XP.
NO SOUND
NO INTERNET
NO PRINTER
Call ISP. duh! I needed to install the drivers off the CD that came with my motherboard. I’ve been installing Linux for so long, I forgot about that crap.
Everything just works from linux install. (Except nVidia problem mentioned earlier).
Rounded up my driver CDs and got all that working.
Can anyone explain to me why after paying $100USD for Windoze upgrade it could not do something my FREE linux programs do like install drivers for motherboards and printers???

So now I have a great OS system installed on my box… NOT!
NO SOFTWARE!!!
Installed Office 2003, an old copy of CorelDraw I had, and some other webmaster programs, like ftp, ssh, 1stPage, etc. (You know, programs you get installed for free when using linux…)
Shelled out $40USD for Windows Live virus etc protector.
If I wasn’t dual booting, I’d still be looking around for buggy shareware to do simple things us Linux geeks just take for granted… (burn CDs, play games, make to do lists, bitTorrent, IM, etc.)

In all, it took me about 8 hours to get xp up and running close to the way I wanted.

Installed SUSE, complete with HUGE software stash, did complete update, changed a few things around like I wanted, and it only took me about 1 1/2 hours. That included formatting 3 times as much hard drive.

Oh yeah, I won’t go into trying to get FAT32 working on the large hard drive too much. Checked MS knowledge base. An older one said to go into device manager to format large hard drives. A newer article says, xp can’t do it, use your 95, 98 or ME install disk. HUH? Xp won’t see FAT32 formatted by System Commander, Linux, or DOS command line format. My conspiracy theory is that they knew Linux can read & write to it so they took it out of their OS. Shaking my head at Billie…
Read more
5

Get Hostname from IP address

To get the hostname from the IP address.
The simplest way is to use the “host” utility provided by Gnu/Linux. Just run…

poison:~ # host 64.233.187.99
99.187.233.64.in-addr.arpa domain name pointer jc-in-f99.google.com.
poison:~ #


This will query the name server and provide you with the hostname of the IP address.By default it will query the nameserver listed in the /etc/resolv.conf file.
Read more
0

Working with Archives

Working with tar Archives

To create an archive of a directory tree with tar, you can do something like this:

nikesh@poison:~/temp> tar -cf directory.tar directory/
nikesh@poison:~/temp> ls
directory directory.tar

The preceding command creates (c), verbosely (v), the file (f) directory.tar, which is a tar archive, by running tar on directory.

If you want to list the files in the archive:

nikesh@poison:~/temp> tar -tf directory.tar
directory/
directory/afile
directory/bfile

Here the option lists the contents of the file (f) directory.tar.

Using gzip Compression with tar

If you want to create a gzipped tar archive (the -z option implies compression, while the c means create):

nikesh@poison:~/temp> tar -zcf directory.tgz directory/
nikesh@poison:~/temp> ls
directory directory.tgz

The original is still there, unlike when we compressed a single file with gzip. (Note that .tgz and .tar.gz are used interchangeably for filenames of gzipped tar archives.)

To list the files in this case, use the following:

nikesh@poison:~/temp> tar -tzf directory.tgz
directory/
directory/afile
directory/bfile

Using bzip2 Compression with tar

If you want to use compression with bzip2 instead of gzip, the required option is -j rather than -z:

nikesh@poison:~/temp> tar -jcf directory.tar.bz2 directory/
nikesh@poison:~/temp> ls
directory directory.tar.bz2

nikesh@poison:~/temp> tar -jtf directory.tar.bz2
directory/
directory/afile
directory/bfile

Unpacking tar Archives

To unpack a tar archive, you need to use the -x option (for extract):

nikesh@poison:~/temp> tar -xvf directory.tar
or
nikesh@poison:~/temp> tar -zxvf directory.tgz
or
nikesh@poison:~/temp> tar -jxvf directory.tar.bz2

Here the options have the following meanings:
The -x option to tar means extract.
The z option implies that you are uncompressing a tar archive where gzip compression has been used.
The joption is needed if you are extracting an archive where bzip2 compression has been used.

Working with zip Archives

The common zip archive format (associated with the DOS and Windows programs PKZIP and WinZip among others) is supported on Linux. To unzip a zip archive, simply do the following:

nikesh@poison:~/temp> unzip zipfile.zip

To create a zip archive of the current directory:

nikesh@poison:~/temp> zip -r ~/newzip.zip .

This will recursively zip up the current directory and create the zip file newzip.zip in you’re your home directory (~).
The program zipinfo will give a listing and information about compression ratios:

nikesh@poison:~/temp> zipinfo zipfile.zip

Read more
0

How to find - Size of a directory & Free disk space

‘du’ - Finding the size of a directory

$ du
Typing the above at the prompt gives you a list of directories that exist in the current directory along with their sizes. The last line of the output gives you the total size of the current directory including its subdirectories. The size given includes the sizes of the files and the directories that exist in the current directory as well as all of its subdirectories. Note that by default the sizes given are in kilobytes.

$ du /home/nikesh
The above command would give you the directory size of the directory /home/nikesh

$ du -h
This command gives you a better output than the default one. The option ‘-h’ stands for human readable format. So the sizes of the files / directories are this time suffixed with a ‘k’ if its kilobytes and ‘M’ if its Megabytes and ‘G’ if its Gigabytes.

$ du -ah
This command would display in its output, not only the directories but also all the files that are present in the current directory. Note that ‘du’ always counts all files and directories while giving the final size in the last line. But the ‘-a’ displays the filenames along with the directory names in the output. ‘-h’ is once again human readable format.

$ du -c
This gives you a grand total as the last line of the output. So if your directory occupies 30MB the last 2 lines of the output would be

30M .
30M total

The first line would be the default last line of the ‘du’ output indicating the total size of the directory and another line displaying the same size, followed by the string ‘total‘. This is helpful in case you this command along with the grep command to only display the final total size of a directory as shown below.

$ du -ch | grep total
This would have only one line in its output that displays the total size of the current directory including all the subdirectories.

$ du -s
This displays a summary of the directory size. It is the simplest way to know the total size of the current directory.

$ du -S
This would display the size of the current directory excluding the size of the subdirectories that exist within that directory. So it basically shows you the total size of all the files that exist in the current directory.

$ du –exculde=mp3
The above command would display the size of the current directory along with all its subdirectories, but it would exclude all the files having the given pattern present in their filenames. Thus in the above case if there happens to be any mp3 files within the current directory or any of its subdirectories, their size would not be included while calculating the total directory size.

-
‘df’ - finding the disk free space / disk usage

$ df
Typing the above, outputs a table consisting of 6 columns. All the columns are very easy to understand. Remember that the ‘Size’, ‘Used’ and ‘Avail’ columns use kilobytes as the unit. The ‘Use%’ column shows the usage as a percentage which is also very useful.

$ df -h
Displays the same output as the previous command but the ‘-h’ indicates human readable format. Hence instead of kilobytes as the unit the output would have ‘M’ for Megabytes and ‘G’ for Gigabytes.
Read more
Related Posts with Thumbnails