Category Archives: Linux

Clean apc cache

cli

php -r 'apc_clear_cache();apc_clear_cache("user");apc_clear_cache("opcode");'

web

curl -s --user username:password "apc.php?CC=1&OB=1" > /dev/null
curl -s --user username:password "apc.php?CC=1&OB=2" > /dev/null
curl -s --user username:password "apc.php?CC=1&OB=3" > /dev/null
curl -s --user username:password "apc.php?CC=1&OB=4" > /dev/null

Find out current path on a shell script

path=$(cd -P -- "$(dirname -- "$0")" && pwd -P)

Kill process by name

kill `ps -ef | grep process_name | grep -v grep | awk ‘{print $2}’`

Tunneling MySQL over SSH

ssh -fNg -L 3307:127.0.0.1:3306 user@host

		

mkdir recursive

mkdir -p /your/long/path

Auto start Apache on CentOS (start on boot)

/sbin/chkconfig --levels 235 httpd on

Export GIT Repo (zip)

git archive --format zip --output /path/to/zipfile.zip master 

convert tab to space (vim)

:set expandtab tabstop=4 shiftwidth=4

Remove .svn file or folder

find -name '.svn' -type d -print | xargs rm -rf {}
rm -rf `find . -type d -name .svn`

Install composer

Composer is a dependency management for PHP and writen in PHP

curl -s https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin/
alias composer='/usr/local/bin/composer.phar'
Page 1 of 41234