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/*

Advertisements

Published by

samrat131

Hello, I am a software developer from Bangladesh. I develop professional web sites/applications using LAMP(Linux, Apache, MySql, PHP) Stack. I have 7 years of professional working experience developing websites on WordPress, Magento, Laravel, Yii, Code Igniter. I have in depth knowledge on following language and tools, PHP, C, C++, Java, MySql, HTML(5), CSS(3), JavaScript, jQuery, Linux, Windows, Apache, Ngnix.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s