THE LATEST

Linux disk usage statistics

The following are some useful commands to figure out which directory is consuming all of your disk space.

You can use the df command to find your disk free space for your mounted filesystems, for example :-

Show Plain Text
Text code
  1. # df -h -T
  2. Filesystem    Type    Size  Used Avail Use% Mounted on
  3. /dev/sda1     ext3     57G   15G   39G  28% /
  4. tmpfs        tmpfs    1.9G     0  1.9G   0% /lib/init/rw
  5. udev         tmpfs     10M   52K   10M   1% /dev
  6. tmpfs        tmpfs    1.9G     0  1.9G   0% /dev/shm
  7.  

The du cammand can be used to give your disk usage information, for example :-

Show Plain Text
Text code
  1. # ls | du -ch
  2. 52K     ./mysql
  3. 4.0K    ./bittorrent
  4. 20K     ./apt
  5. 136K    ./ntpstats
  6. 4.0K    ./samba/cores/smbd
  7. 4.0K    ./samba/cores/nmbd
  8. 12K     ./samba/cores
  9. 4.9M    ./samba
  10. 4.0K    ./iptraf
  11. 540K    ./apache2
  12. 12K     ./fsck
  13. 56K     ./exim4
  14. 4.0K    ./news
  15. 9.2M    ./installer/cdebconf
  16. 9.8M    ./installer
  17. 21M     .
  18. 21M     total
Filed under: Linux  Tags: Debian, Ubuntu

RECENT ARTICLES

Displaying your cakephp 1.2 version

The CakePHP dev's have made it super simple to display your cakephp version, I have only just stumbled across it when looking for something else in the API. Like me you might not have spotted it, its not an essential bit of code but a nice to have for those administering many sites on various servers and much better than finding the version text file on each install. I display the version number in the system setup part of the sites admin dashboard along with other framework related settings...

Filed under: Cakephp  

How to reboot a locked up local or remote Linux box

On the odd occasion your Linux box will lock up and won't appear to be working, at this point you go darn I'd love to do a controlled shutdown, here's one way of rebooting your local or remote Linux box...

Filed under: Linux  Tags: Debian, Ubuntu

Command to list only directory names under Linux

Sometimes you need to only only list the directory names under Linux, a simple command for this is...

Filed under: Linux  Tags: Debian, Ubuntu

How to setup a 30 second Cron job

Sometimes you need a cron job at a frequency less than the minimum of 1 minute (60 seconds) that cron allows. One way of achieving this is by...

Filed under: Linux  Tags: Debian, Ubuntu

Custom group by pagination and a calculated field

This is a basic example of how to use the CakePHP paginator helper with the group by condition, it took a little mucking around but this is how I got it working.

In this example we have a Comment controller which I want to paginate a custom query displaying an IP address and a calculated count field of the number of spam comments from this particular IP address...

Filed under: Cakephp  Tags: Pagination