Delete via File Descriptor to free up disk space

Sometimes, you might see your “df -h /” showing 100% usage and even after deleting gigs of files/folders, you might not see the disk freed up.

So, this is what you have to do.

~]# lsof | grep deleted
java 8859 hudson 1w REG 253,0 3662503356 7578206 /crucible/data/current/var/log/fisheye.out (deleted)

Then execute:

cd /proc/PID/fd
ex: cd /proc/8332/fd

fd]# ls -l |grep deleted

total 0
l-wx—— 1 hudson devel 64 Feb 7 11:48 1 -> /crucible/data/current/var/log/fisheye.out (deleted)

The “1” will be the file descriptor. Now type “> FD” to reclaim that space

fd]# > 1

OR if you can find the entry in /proc/fd/ that cooresponds to the filehandle, you can cat /dev/null to it.

ex: lr-x—— 1 tomcat rms 64 Jun 23 18:02 /proc/8332/fd/341 -> /usr/local/tomcat

fd]# cat /dev/null > /proc/8332/fd/341

After running this, you will see that the inode is still open, but now it’s size is 0.

Few wget options I can think of…

Sometimes, you keep forgetting few options for the common command and start googling around. Recently, I was stuck with wget to bypass the validity of ssl certificate and I was wondering what the command was… So, here it is:

wget --no-check-certificate

Thought of adding few more. So, other useful options for wget is as follows:

If you want to avoid using proxy when downloading files even if the appropriate *_proxy environment variable is defines, then use wget with –no-proxy option as follows:

wget --no-proxy

In case you want to set https proxy, when downloading the file, you can export when downloading the file as follows:

export https_proxy="USERNAME:PASSWORD@Server-Name:PORT-NUMBER/"
wget https://kernelcraft/foo/abc.tar.gz

Another way to do the above is by passing the username and password to the server using wget command as follows:

export https_proxy=""
wget --http-user="USER" --http-password="PASSWORD"

So, getting back to the basics, wget with just a URL, will pull the 1st page it hits, for eg: index.html, index.php etc.

In case if you want wget to slurp down and grab anything in it’s vicinity, then use it with ‘-m’ option as follows:

wget -m

The above command will put all the files it gets hold within a particular directory structure.

You’ll probably want to pair -m with -c (which tells Wget to continue partially-complete downloads) and -b (which tells wget to fork to the background, logging to wget-log).
If you want to grab everything in a specific directory – say, the ‘edu’ directory on the yahoo web site – use the -np flag:

wget -mbc -np

This will tell Wget to not go up the directory tree, only downwards

Wget with User-Agents and Robots.txt file:

By default, Wget plays nicely with a website’s robots.txt. This can lead to situations where Wget won’t grab anything, since the robots.txt disallows Wget.
To avoid this: first, you should try using the –user-agent option:

wget -mbc --user-agent=""

This instructs Wget to not send any user agent string at all. Another option for this is:

wget -mbc -e robots=off

…which tells Wget to ignore robots.txt directives altogether.

Wget to search for mirrors:

In case you want to get a list of mirrors providing rsync connectivity for Mageia 3 release, you can use the following wget command:

url=; wget -q ${url} -O - | grep rsync:

How DNS works

When you type into your web browser, your browser sends a query over the Internet to find the website for The first server you query interacts with is the recursive resolver, which is typically operated by your ISP. The recursive resolver knows which other DNS severs it needs to ask to get the IP for

The 1st type of DNS server the recursive resolver talks to is called a root server. The root servers are running all over the world and each one knows the DNS information about TLD such as ‘.com’. The recursive resolver ask a root server for DNS information about ‘.com’. Each TLD’s DNS stores the address information for the second level domain ( within the top level domain (.com). When your query reaches the TLD server, the TLD server answers with the IP address of the domain’s nameserver which will provide the next piece of information. Next the recursive resolver sends the query to the domain’s nameserver. This DNS server knows the IP address for the full domain,, and that answer is returned to the recursive resolver.

Now, that the recursive resolver knows the IP address for the domain name in your query, the recursive resolver tells the browser what the IP address is. Finally, your browser can send a request to the website to retrieve the website’s content, using the IP address.

Restrict users to add Cron job in Linux

Regular users can modify and install their own cron configuration or jobs.

If you want to restrict users to add new cron jobs, then you have to first remove (or backup) cron.deny file and then create a new file cron.allow and add one line for each users. It will deny all those users who are not in this list from adding a cron job.

[root@nagios ~]# mv /etc/cron.deny /etc/cron.deny.bak

[root@nagios ~]# vi /etc/cron.allow

I added 2 users other than user ‘soj’. Now, as user soj, I am trying to add a new cronjob and as you can see the user soj is denied from add a new cron job.

[soj@nagios ~]$ crontab -e
You (soj) are not allowed to use this program (crontab)
See crontab(1) for more information

You can implement the same for ‘at’ as well by placing allowed users to /etc/at.allow.

Deleting an LVM partition

Following are the steps to delete an LVM partition:

1. Unmount LVM partition
2. Disable the LVM partition
3. Delete the LVM partition
4. Disable the Volume Group
5. Delete the Volume Group
6. Delete the physical Volume

So, let’s start:

Unmount LVM partition:
[root@nagios soj]# umount /dev/exampleVG/exampleLV

Disable LVM partition:
[root@nagios soj]# lvchange -an /dev/exampleVG/exampleLV

Delete LVM volume:
[root@nagios soj]# lvmremove /dev/exampleVG/exampleLV

Disable Volume Group
[root@nagios soj]# vgchange -an exampleVG

Delete the Volume Group
[root@nagios soj]# vgremove exampleVG

Delete the Physical Volume
[root@nagios soj]# pvremove /dev/sdc1 /dev/sdc2