Linux commands

// to rename filename
mv old-filename new-filename

// current working directory
pwd

// running process
top

// switch user
sudo su

// restart apache
service apache2 restart

// folder size
du -csh /dir-name/
du -sh /dir-name/

// show only dir
ls -ld — */
ls -d */

// create zip file
tar -czvf zip_file_name.tgz public_html/

// unzip file
tar -zxvf zip_file_name.tgz

// backup database
mysqldump -uUSERNAME -pPASSWORD database_name > file_name.sql

// restore backup
mysql -uUSERNAME -pPASSWORD database_name < file_name.sql

// change file or dir permission recursively
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 {} \;

// Change file/dir owner
chown -hR root:root public_html/

// download file
wget http://domain.com/filename

// delete file
rm -rf var/cache/*
rm -rf var/session/*
rm -rf var/report/*