locate command on Linux

locate command find files on a linux server.

To install locate, run

On CentOS

On Debian/Ubuntu

locate searches through a static index of files. This is rebuild daily using cronjob. You can manually update it by running

Monitor Apache site traffic with Apachetop

apachetop is a command line tool like top, that shows traffic on a web site. It used apache access log to show th stats. This will be useful to monitor a web sites traffic in real time.

If you need to set path to apache log file, configure with

On CentOS

On Ubuntu/Debian

Running apachetop with custom log file location

Amazon S3 CORS

To enable CORS for Amazon S3 bucket, add

Uninstall CloudLinux imunify360

Recently all CloudLinux installed imunify360 on all my Cpanel Servers. This is a paid product, so free version is not much useful as you need to scan manually. I use maldet on all my servers and happy with it, so i removed imunify360 from my servers.

To uninstall imunify360, run

Disable the repo with

Resize a linux file system with resize2fs

On cloud servers, once you upgrade disk, you will need to resize the filesystem. On Linux ext4 file system, you can do this with command resize2fs.

To resize filesystem on /dev/sdb, run

Here the full disk is used as file system with NO partition. If you have partion, you need to specify partition number like /dev/sdb1

Plesk move vhosts folder

Plesk use /var/www/vhosts folder to store sites. On some servers this folder will be on smaller partition. Say you have all disk space on partition /home, in such cause, you can use following command to move web site files to /home folder with following command.

/home/ = you can replace this any any folder you wish. Plesk will move the site files, update the configuration as required.

NOTE: In this example, i used /var/www/vhosts instead of /home/ as the server was using non default folder for vhosts, i am moving all sites back to default location (/var/www/vhosts).

See Plesk

Bandwidth Limit on rsync

I wanted to transfer some files between two computers, but don’t want to use all bandwidth available on the network as it will affect other users on the network.

To limit bandwidth, use –bwlimit Option.

Here –bwlimit=1500 will limit bandwidth usage to 1.5 MB/s.

See rsync