Friday, October 19, 2007

DU, DF , Quota

du (abbreviated from disk usage) is a standard Unix program used to estimate the file space usage; space used under a particular directory or files on a file system.

Sum of directories in Kbytes:
$ du -sk *
2800344 directoryOne
4270554 directoryTwo

du -sh Documents/
409M Documents

disk usage of all subdirectories and files including hidden files within the current directory (sorted by filesize) :
$ du -sk .[A-z]* *|sort -n

df (abbreviated from disk free) is a standard Unix computer program used to display the amount of available disk space for filesystems on which the invoking user has appropriate read access, df is usually implemented by reading the mtab file or using statfs.
$ df -k
Filesystem 1024-blocks Free %Used Iused %Iused Mounted on
/dev/hd4 32768 16016 52% 2271 14% /
/dev/hd2 4587520 1889420 59% 37791 4% /usr
/dev/hd9var 65536 12032 82% 518 4% /var
/dev/hd3 819200 637832 23% 1829 1% /tmp
/dev/hd1 524288 395848 25% 421 1% /home
/proc - - - - - /proc


/dev/hd10opt 65536 26004 61% 654 4% /opt

Wednesday, October 17, 2007

Install Perl Modules at your home directory
(1) install from the module package
Normally, the Perl5 module installation procedure includes commands something like these:
% perl5 Makefile.PL
% make
% make test
% make install
% make clean

The first command, perl5 Makefile.PL, directs perl5 to create a makefile for the new module you are installing. When installing a perl5 module locally you must designate the home directory of your perl5 installation on the command line. That information is used by perl5 to create the makefile. Substitute the following command for perl5 Makefile.PL:

% perl5 Makefile.PL PREFIX=/usr/home/USERNAME/usr/local

The value USERNAME above should be replaced with your Virtual Private Server primary user account name. So the complete installation process is:

% perl5 Makefile.PL PREFIX=/usr/home/USERNAME/usr/local
% make
% make test
% make install
% make clean

For older modules it may be necessary to designate several other variables on the command line during the module installation:

% perl5 Makefile.PL PREFIX=/usr/home/USERNAME/usr/local \
INSTALLPRIVLIB=/usr/home/USERNAME/usr/local/lib/perl5 \
INSTALLSCRIPT=/usr/home/USERNAME/usr/local/bin \
INSTALLSITELIB=/usr/home/USERNAME/usr/local/lib/perl5/site_perl \
INSTALLBIN=/usr/home/USERNAME/usr/local/bin \
INSTALLMAN1DIR=/usr/home/USERNAME/usr/local/lib/perl5/man \
INSTALLMAN3DIR=/usr/home/USERNAME/usr/local/lib/perl5/man/man3

To save yourself some typing you can create a file and put these variable assignments above in to a file (FILENAME) something like this:

PREFIX=/usr/home/USERNAME/usr/local \
INSTALLPRIVLIB=/usr/home/USERNAME/usr/local/lib/perl5 \
INSTALLSCRIPT=/usr/home/USERNAME/usr/local/bin \
INSTALLSITELIB=/usr/home/USERNAME/usr/local/lib/perl5/site_perl \
INSTALLBIN=/usr/home/USERNAME/usr/local/bin \
INSTALLMAN1DIR=/usr/home/USERNAME/usr/local/lib/perl5/man \
INSTALLMAN3DIR=/usr/home/USERNAME/usr/local/lib/perl5/man/man3

Then, each time you install a perl5 module you can use the following syntax:

% perl5 Makefile.PL `cat FILENAME
% make
% make test
% make install
% make clean

You also can have a few different local module installation procedures, for example one for production perl and another for development:

% perl5 Makefile.PL `cat FILENAME.production`

or

% perl5 Makefile.PL `cat FILENAME.development`

(2) Install the module from CPAN at your home directory
You should copy

/usr/lib/perl5/5.6.1/CPAN/Config.pm

to

/home/users/xytang/.cpan/CPAN/MyConfig.pm

And change the new MyConfig.pm so all references to /root/.cpan are
changed to /home/users/xytang/.cpan with your favourite editor.

Installing Perl5 Modules yourself on your Virtual Private Server can be a tricky
exercise. Utilities for installing Perl5 modules generally assume that the installation is being done in the root area of
the file system of the host machine. As a Virtual Private Server user you do not have access to the root area of the host
machine. So, you must install Perl5 modules locally, within your Virtual Private Server file system.


Sunday, October 07, 2007

Check library dependence
Does any guru know how to exam the library dependency?
ldd
/sbin/ldconfig - configure dynamic linker run time bindings
ld.so, ld-linux.so* - dynamic linker/loader