Use these commands to remove the entire exim mail queue from centos running cpanel. service exim stop cd /var/spool/exim find input -type f -exec rm -rf {} \; find msglog -type f -exec rm -rf {} \; service exim restart
Archive | Linux Commands
Find all files modified on a certain date or between dates on Cpanel CentOS Linux
Recently we had a site that was hacked and we needed find all of the files that had been modified on a certain date. We used this Linux Find command to find and list the files modified between May 19-21, 2015: find /home/mysite/public_html -newermt 2015-05-19 ! -newermt 2015-05-21 -ls .
Using a custom php.ini when using FAST CGI (fcgi) in Cpanel WHM
When using FastCGI (FCGI) as the loader for PHP, traditional php_values in the .htaccess file as well as custom php.ini files in the public_html directory no longer work. Instead we must create a wrapper for the main FCGI binary that causes the php.ini to be loaded from it’s current working directory instead of the server-wide one. […]
Linux Recursive GREP search excluding directories example
This command will search for text inside files in a directory while excluding some directories you do not want to search in. This is helpful when a search is going slow due to a directory that might contain thousands of files that you are not interested in searching through, such as an images or cache directory. grep -r […]
Linux CentOS CPanel find file in directory
Command to search a directory for a file in a Linux CentOS CPanel server: find -name “query”
CPanel Centos how to extract one directory from a TAR backup
This command will extract one directory from a CPanel backup TAR file tar -xvf mysite.tar.gz mysite/homedir/public_html/directory
CPanel CentOS Linux list directories and their total sizes
Use this command to list the folders in a linux directory along with their total sizes in human readable format: du -sh * | sort -h
How to use SED to search and replace a string in multiple files in linux
You can use the SED linux command to search and replace a string within all files inside a directory: This example replaces all occurrences of fast with slow in file names that end in .htm: $ find ./* -name ‘*.htm*’ -type f -exec sed -i ‘s/fast/slow/g’ {} \;
How to use whatis and xargs linux commands
Have you ever wanted to know what the commands various commands in linux do? Such as the commands in: /bin /sbin /usr/bin Move to the bin directory of your choice and follow the example below: cd /bin ls | xargs whatis | less You will get an output of the command and a summary of it’s […]
The netcat linux command
One of the neatest tools that I’ve found is the program netcat. It is a way to pipe data over the network simply and easily. You don’t need a fancy protocol like CIFS, just stream the data over the LAN. Netcat is a “full duplex” connection, meaning it both sends and receives using the connection. […]