Tag: SSH

  • Find String in Files in Linux

    To find some string within files in Linux, you can use this command grep -rnw ‘/your/path/’ -e “find this string” -r means recursive -n means line number -w means match the whole word 🙂

  • How to Install PhantomJS in cPanel / WHM Server

    Here is what i did to install PhantomJS in cPanel / WHM 🙂

  • How to Append Date and Time to Log File in Linux

    If we want to get detailed log report, we can store multiple log files with date and time information on the file name 🙂 We can do this command in Linux : your_command_here > /path_1/path_2/your_log_$(date +”%Y-%m-%d_%H-%M-%S”).txt

  • How to Delete Files in Directory in Linux

    If you want to delete files within a directory in Linux, you can use this simple command rm -f /your/directory/* If you want to delete files and directories recursively within a directory in Linux, you can use this command instead 🙂 rm -rf /your/directory/*

  • Empty a File Using Linux Command

    Today i received an e-mail notification from cpanel that a partition in my server is almost full. First i checked largest directories / files using this command : du -h –max-depth=1 /some/path Then i noticed that they were some log files which took space in my partition 🙂

  • How to Remove Directory and Subdirectories Recursively in Linux

    Sometimes there is occasion where deleting files from Cpanel takes a very long time to finish. For example because there are too many files under a directory. In this situation we can use SSH to delete a directory and all files and subdirectories under that directory. We can use the command below. But be careful, […]

  • How to Create and Extract Tar.gz File in Linux

    How to create tar.gz in Linux : tar -zcvf “archive.tar.gz” “file.sql” tar -zcvf “archive.tar.gz” “/home/example/public_html/” How to extract tar.gz in Linux : tar -zxvf “archive.tar.gz”

  • How to Install PECL Memcache in WHM / CentOS

    You can run these commands to install PECL memcache (not memcached). However, this memcache will work with memcached. wget http://pecl.php.net/get/memcache-3.0.8.tgz tar xvfz memcache-3.0.8.tgz cd memcache-3.0.8 phpize ./configure make make install Take note of the php extensions directory that memcache is installed in. Mine is: /usr/local/lib/php/extensions/no-debug-non-zts-20020429/ Then add this line to your php.ini extension=”/usr/local/lib/php/extensions/no-debug-non-zts-20020429/memcache.so”

  • How to Install Memcached in WHM / CentOS

    I use Centos & WHM. Here is how to install memcached (not memcache) using command line. First, installing memcached wget http://memcached.org/latest tar -zxvf memcached-1.x.x.tar.gz cd memcached-1.x.x ./configure && make && make test && sudo make install

  • How to Change SSH Port with WHM & CSF

    If you are using WHM & CSF, under CentOS, you may follow this steps to change SSH port from 22 (default) to something else 🙂