Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 042010
 

How to check which directory used up most of the disk space?

Answer:

For example, assume you are at /usr/local, you want to generate a report on disk space usage on all the sub directories, you can use the following command

# du -k * | sort -n

.
.
14564   share/man/man3
14816   share/man
16624   share/perl/5.10.0
16628   share/perl
33060   share

It will give you a very clear and useful report.

Jan 022010
 

How to ping a web site periodically

Answer:

1. Setup a cron job

crontab -e

2. Enter the job detail as following

1 * * * * /usr/bin/wget -O - -q -t 1 http://www.example.com/cron.php

3. Fine tune the crontab configurations if needed.

Jan 022010
 

How to alter the priority of running processes

Answer:

The basic syntax is as the following

renice {priority} pid

Where priority range from -20 to 19 (lowest priority)

For example, to set the priority of pid 755 to -19, try

sudo renice 19 755

If you want to set by process name instead of pid, you can use

sudo renice 19 `pgrep apache2`

Where apache2 is the process name you want to set.