snippets

View on GitHub

HowTo Copy a Folder

-a : Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.

-v : Explain what is being done.

-r : Copy directories recursively.

cp -avr dirname1 dirname2

include hidden files

cp -aR folder1/. folder2/

kill apache2 process

kill -9 $(ps -e | grep apache2 | awk '{print $1}')
ps -A|grep mysql
sudo pkill mysql
ps -A|grep mysqld
sudo pkill mysqld
service mysql restart

APACHE Commands

sudo apachectl -k restart
sudo /etc/init.d/apache2 restart

Restart MySQL

sudo /etc/init.d/mysql restart
# restart `mariadb`
service mariadb restart

view info about qmail process

ps uax | grep qmail

enable admin mode

sudo -s

rename file

mv file_name_previous.sql file_name_new.sql

search by file name

find -name "filename"
find / -name filename.php
# search for the files which have .php.bak name endings
find . -type f -name "*.php.bak"

search for eval string in the al files

grep -rnw eval --exclude-dir=.git ./

export the last 3000 rows from the log file

tail -n 3000 error_log > /home/.............../error_log