It is a simple task and a very common task for a VPS user. You have a VPS, and want to know the disk usage of your data and system. You are also want to know which folder takes the biggest disk space.
The command is du
du takes a single argument, specifying a pathname for du to work; if it is not specified, the current directory is used. The SUS mandates for du the following options:
-a, display an entry for each file (and not directory) contained in the current directory
-c, display a grand total of the disk usage found by the other arguments
-d #, the depth at which summing should occur. -d 0 sums at the current level, -d 1 sums at the subdirectory, -d 2 at sub-subdirectories, etc.
-H, calculate disk usage for link references specified on the command line
-k, show sizes as multiples of 1024 bytes, not 512-byte
-L, calculate disk usage for link references anywhere
-s, report only the sum of the usage in the current directory, not for each file
-x, only traverse files and directories on the device on which the pathname argument is specified.
Above command usage method retrieved from Wikipedia.
Here is what I entered to get the result I want.
Continue reading “How to know the disk usage of your VPS”
It is a guide to install LEMP on a Centos 6.4 64bit VPS at Burst.net. It is also working on other VPS. LEMP stands for Linux, NginX, MySQL, PHP.
First of all, rebuild the OS on VPS with Centos-6.2-x86_64.
Other VPS providers have similar interface to rebuild / reload operation system.
After 5 to 10 minutes, the VPS is ready to use.
SSH to VPS through PUTTY with root account. The following installation steps will be done in terminal window.
1) Update the system to Centos 6.4
There are 158 updates need to be installed. So just confirm it and wait all the updates completed. Then the Centos is updated from 6.2 to 6.4.
Continue reading “Install LEMP on Centos 6.4 64bit at Burst.Net VPS”
There are certain PHP configuration tat affect security features. The following recommended security configuration options is for production servers.
- register_globals set to off
- safe_mode set to off
- error_reporting set to off
- disable these functions: system(), exec(), passthru(), shell_exec(), proc_open(), and popen()
- open_basedir set for both the /tmp directory and the web root so that scripts cannot access files outside a selected area
- expose_php set to off
- allow_url_fopen set to off
Continue reading “How to config PHP to secure Web Server”
It is a general test on a Centos 6.4 system. The benchmark script is made by http://www.php-benchmark-script.com/. The first time I run it on the updated default Centos6.4. The php version is 5.3.3. I think it has Xcache installed. The test result is Total time: 8.482 sec. Breakdown as below:
- test_math 2.332 sec.
- test_stringmanipulation : 2.321 sec.
- test_loops : 2.346 sec.
- test_ifelse : 1.483 sec.
Then I upgrade or replace the php 5.3 by php 5.5. I follow the guide on Webtactic. http://www.webtatic.com/packages/php55/ Continue reading “PHP 5.5 is 20% faster than PHP5.3”
Yesterday, when I sign in one of my VPS webmin control panel, it displayed an upgrade button. Look at the folowwing screen shot and just click the button underneath, Upgrade Webmin Now.
It is a update with new features and bug fixes. Worth to upgrade.
Then, I click Upgrade Webmin Now button to upgade Webmin from 1.630 to 1.640. see following release notes of this new version of Webmin.
Version 1.640 (13th August 2013)
- Even more German translation updates thanks to Raymond Vetter, Norwegian updates thanks to Stein-Aksel Basma, Polish from Piotr Kozica, and Catalan from Jaume Badiella.
- UI consistency improvements in the Linux Firewall and Xinetd modules.
- Support for new Apache 2.4 features, such as IncludeOptional, the removal of NameVirtualHost and use of apachectl to get enabled modules.
- Improved error detection and better handling of disks that don’t start on cylinder 1 in the Fdisk module.
- Support for growing a logical volume to the maximum size possible in the LVM module.
- Fixes for total and free memory detection under OpenVZ / Virtuozzo.
- Mandriva Linux improvements in the Bootup and Shutdown and other modules.
- Fix for a bug that could cause /etc/webmin to be deleted following a failed upgrade on Debian.
- Improved support for FreeBSD 8, bringing it into sync with FreeBSD 9.
Continue reading “Webmin update to 1.64”
htop is an interactive process viewer for Linux. It is a text-mode application (for console or X terminals) and requires ncurses.
If you used top command before, I would like to tell you that htop is a replacement of top, but even better.
Since I have rpmforge Repository on my VPS, the installation is as simple as one command.
yum install htop
When finished, I run htop command.
Continue reading “Install htop on Linode VPS”
When using a SSD to hold the system with the fresh installation, 4K alignment is a key point to improve the performance.
Ensure that your new partition layout is aligned with the 4KB sectors of such drives (older hard drives used 512B alignment). If your partition is not “4K aligned”, then you will have performance issues as the logical and physical sector boundaries will not line up, causing two physical write/erase cycles to happen for each logical one.
Based on IBM article, Linux has same issue when you use SSD.
When use Ubuntu Live CD to do the partition, it will make 4K alignment automatically. See the screen below.
2048 (default since fdisk 2.17.2) means that my SDD is aligned correctly. Any other value divisible by 8 is good as well.
Continue reading “Make sure 4K Alignment on SSD”
LILO (Linux Loader) and GRUB (GRand Unified Bootloader) are both configured as a primary boot loader (installed on the MBR) or secondary boot loader (installed onto a bootable partition).
First question, what is a boot loader.
The simple answer: a boot loader loads the operating system.
When your machine loads its operating system, the BIOS reads the first 512 bytes of your bootable media (which is known as the master boot record, or MBR). For more information of MBR, see MBR at Wikipedia.
Continue reading “Difference between GRUB and Lilo”
There are three types of files need to untar.
One is normal tar file, second is gzip compressed, the last one is bzip2 compressed.
Here is the commend to untar these files as below.
Continue reading “How to untar a tar file or gzip-bz2 tar file in linux”
The task is to delete files from the folder and sub-folders, maybe sub-sub-folder.
Say I want to delete .htaccess from every folder, but keep all others no-touch.
It is hard to go into each folder and delete the file. It takes time and also very easy to miss some folders.
There is one command in Linux. Great tool for it.
One line to do the job.
Continue reading “Delete files recursively”