grep -c ‘searchterm’ myfile
Remove exim mail queue from centos running cpanel
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
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
Corsair Flash Voyager Slider X1 256GB USB 3.0 Flash Drive (CMFSL3X1-256GB) Speed Test Review
We did a quick speed test benchmark on the Corsair Flash Voyager Slider X1 256GB USB 3.0 Flash Drive. Using the BlackMagic Disk speed test the usb drive was able to consistently read and wrote over 250MB/second.
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’ {} \;