Friday, November 22, 2013

Linux commands



1. scp from remote host to local host
#scp your_username@remotehost.com:test.txt /local/dir

2. To sort files based on size
#find / type f -size +100000k -exec ls -lh {} \;

3. Add an Existing user to a group
 #gpasswd -a userNamer groupName

and check using #groups userName

4. To take backup of a single database


# mysqldump -u root -p database_name > database_name.sql
 
5. To restore a single database
 
# mysql -u root -p database_name < database_name.sql
 
Make sure you have a database in the name "database_name" before executing this command.
 
6. Mysql command to check database size
 
# SELECT table_schema AS "Database name", SUM(data_length + index_length) / 1024 / 1024 AS "Size (MB)" FROM information_schema.TABLES GROUP BY table_schema; 
 

No comments:

Post a Comment