SHARE

Compress files inside directory

go directory:

cd /var/www/yourfile/

zip -r filename.zip .

import sql to database

mysql -u user -pyourpassword yourdatabase < your-file-db.sql

Compress and decompress folder

For compressing:

tar -cvzf tarballname.tar.gz itemtocompress

and for decompression:

tar xzvf file.tar.gz

Export database settings

simple:
mysqldump -u root -p <database> > /data/raidpsbkp2.sql
with procedures and functions
mysqldump -u root -p -R <database> > /data/raidpsbkp2.sql
//ignore views
mysqldump -u root -p -R --ignore-table=dps.vw_tour --ignore-table=dps.vw_user_booking <database> > /data/raidpsbkp2.sql

//custom tables
mysqldump -u root -p -R --skip-triggers dps photo photo_upload photocategory photocategoryrelation > /data/dpscustomtablesoct.sql

//ignoring triggers and data
mysqldump -u root -p -R --skip-triggers --no-data <database> > /data/raidpsbkp2.sql
//ignoring triggers
mysqldump -u root -p -R --no-create-info --skip-triggers <database> > /data/raidpsbkp2.sql
//stored procedures and triggers
mysqldump --routines --no-create-info --no-data --no-create-db --skip-opt <database> > outputfile.sql

//no triggers, no data, no info

mysqldump -u root -p -R --database <database> --skip-opt --routines --no-create-info --no-data --no-create-db --skip-triggers > /var/www/raidpsproc2

Export all database to one file

mysqldump -u root -p --all-databases > alldb.sql

Compress sql file

gzip -9 /data/yourdatabase.sql

Send from host to other server

scp -r foo your_username@remotehost.edu:/some/remote/directory/bar

Give permissions 755 to files inside folder

First go to folder:

cd /yourfolder/

then give permissions:

chmod -R 755 *

Change owner/group to file inside folder

First go to folder:

cd /yourfolder/

then give permissions:

chown -R www-data:www-data *

Remove all files inside folder

go to folder

rm -rf /yourfolder/*