Menu Close

Category: News

find large files in ubuntu

This command find all files >400MB:

find /  -type f -size +400000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

And for exclude a folder from this command:

find / -not \( -path /mnt -prune \)  -type f -size +400000k -exec ls -lh {} \; | awk '{ print $9 ": " $5 }'

 

For see the free space you can do:

df -h

 

if you want to see  total size of a folder:

du -sk -h /home/

 

and for listing of all size:

du -h /home/

 

Type the following command at the shell prompt to find out top 10 largest file/directories:

# du -a /var | sort -n -r | head -n 10

Sample outputs:

1008372 /var
313236  /var/www
253964  /var/log
192544  /var/lib
152628  /var/spool
152508  /var/spool/squid
136524  /var/spool/squid/00
95736   /var/log/mrtg.log
74688   /var/log/squid
62544   /var/cache

If you want more human readable output try:

$ cd /path/to/some/where
$ du -hsx * | sort -rh | head -10

Where,

  • du command -h option : display sizes in human readable format (e.g., 1K, 234M, 2G).
  • du command -s option : show only a total for each argument (summary).
  • du command -x option : skip directories on different file systems.
  • sort command -r option : reverse the result of comparisons.
  • sort command -h option : compare human readable numbers. This is GNU sort specific option only.
  • head command -10 OR -n 10 option : show the first 10 lines.

Mount SATA DISK in Ubuntu VM ESXI5

Sometimes, we need to do things in different ways.

I’ve a new ESXI 5 Server, and i want to have a NAS virtual machine on it.

The problem is that ESXI doen’t not support direct access to SATA drives, and use virtual image disks for a NAS is not a good thing (very bad performance).

For bypass this problem, we use Raw Disk Mapping (RDM).

Optimize backup with IO e CPU priority

On my server, i need to backup my data and my databases about 2/3 times at day.

First, i compress folders with TAR, then i copy it with rsync to other servers in LAN.

Files are from 500MB to 2GB, so the transfer operation give my a heavy impact to server perfomance, with a Load from 5 to 7 (when the max should be 4 with my hardware) and sometime apache or mysql crash.

Clear Memory Cache on Linux Server

By default the Linux OS has a very efficient memory management process that should be freeing any cached memory on the machine that it is being run on. However when it comes to Cached memory the Linux OS may at times decide that the Cached memory is being used and is needed which can lead to memory related issues and ultimately rob your server of any potentially free memory. To combat this you can force the Linux OS to free up and stored Cached memory.