web analytics

Posts Tagged ‘Linux’

Finding large files on Linux distributions

Written by config on . Posted in Linux

Advertisement

Finding large files on all operating systems is a daily task for systems administrators around the world, it serves a lot of purposes.
I will show multiple ways to do it on various Linux distribution. Simple and makes your life easier.

Pay attention to the size in all examples – change it according to your needs.

RPM Based distributions: Red Hat, Centos, Fedora

Specify path:

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

Example for specific path:

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

Current Dir:

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

Debian or Debian based ( Ubuntu and various other deb based distros )

Specify path:

find {/path/to/location} -type f -size +{file-size-in-kb}k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

Current Dir:

find . -type f -size +10000k -exec ls -lh {} \; | awk '{ print $8 ": " $5 }'

Largest files in directory:

ls -lSh | less

du -xakh .|sort -n|tail -10

du -k | sort -n | perl -ne 'if ( /^(\d+)\s+(.*$)/){$l=log($1+.1);$m=int($l/log(1024)); printf                 ("%6.1f\t%s\t%25s  %s\n",($1/(2**(10*$m))),(("K","M","G","T","P")[$m]),"*"x (1.5*$l),$2);}'

find . -type f -print0 | xargs -0 ls -lSh | head -10

Permission denied errors when starting bind9 on Ubuntu 10.04 with Plesk 10

Written by config on . Posted in Linux, Ubuntu

If you are getting the following in your error log and you cannot start bind9 on Ubuntu 10.04 server with Plesk 10 installed:

named[5372]: loading configuration from '/etc/named.conf'
named[5372]: none:0: open: /etc/named.conf: permission denied
named[5372]: loading configuration: permission denied
named[5372]: exiting (due to fatal error)

Cpanel 11.30 on Centos 6.0

Written by config on . Posted in Linux

Cpanel updated its offering on the Centos even before Centos released a new version, but it seems like Cpanel itself can’t get its stuff straight. As of today (after a week of tries and failures) it is finally possible to install Cpanel on Minimal installation of Centos 6.0 without installing perl or anything else manually on the server before running Cpanel installation script (“latest”). Cpanel uses a very interesting approach here, they are downloading their own perl package with perl 5.8.8 (which is the perl used in Centos 5.0 if I’m not mistaken). I’m sure they got their own reasons but I would love to hear a decent explanation on that.

Plesk for Linux – Fixing .htaccess pcfg_openfile error – permission fix

Written by config on . Posted in Linux, Ubuntu

Problem with directory / files permissions after installing some software on your Plesk Linux server ( Nagios for example known to cause this in certain scenarios ).

From /var/www/vhosts/domain.com/statistics/logs/error_log :

[critical] [client 192.168.0.13] (13)Permission
denied: /var/www/vhosts/domain.com/httpdocs/.htaccess pcfg_openfile:
unable to check htaccess file, ensure it is readable

You will see Forbidden Error in your browser.

If you check the mentioned location you will notice that .htaccess file is probably not even there. Creating it and giving it the correct permissions won’t help of course.

In our case permissions set wrong on the httpdocs / httpsdocs directory itself.
Try this to fix:

cd /var/www/vhosts/domain.com/
chmod 755 httpdocs
chmod 755 httpsdocs

You don’t have to set the permissions to 755 as 751 for example will work as well. Play with the permissions on httpdocs to find the suitable solution.

How to open CLI to VMware ESXi. How to Clone Virtual Machines.

Written by config on . Posted in Linux

ESXi Commands

You can access the CLI by switching to terminal 1 using Alt-F1.
Now type “unsupported”, This is not echoed so you won’t see anything. If you get it right, you will get a prompt asking for the root pasword.

( This might not work in ESXi 4.0 as VMWare is trying to limit ESXi for their own corporate reasons )

That drops you at a shell prompt. (ash is our shell).
Hint: editor = vi

Now you can you modify /etc/inetd.conf and uncomment the ssh line so that you can ssh into it unless you are planning always being at the console.
Reboot (init 6)

Cloning Virtual machines in ESXi

vmkfs tools -i /vmfs/volumes/datastore/YourVM/YourVM.vmdk /vmfs/volumes/datastore/NewVM/newvm.vmdk
vim-cmd vmsvc/getallvms
vim-cmd vmsvc/power.reset xx

check out these ( with vim-cmd vmsvc/command ):

power.off
power.on
power.reboot
power.reset
power.shutdown
power.suspend

esxtop = is your top tool