Search This Blog

Thursday, 6 December 2012

Frequently used Putty commands

Database Dump:
mysqldump -u username -h localhost -p dbname > filename.sql

Import Database Dump:
mysql -u username -p -h localhost DATA-BASE-NAME < data.sql

Tar a folder:
tar -cv foldername > foldername.tar

GZip the tar file:
gzip foldername.tar

Extract tar.gz file:
tar -zxvf yourfile.tar.gz

Extract .bz2 file:
bunzip2  yourfile.bz2

Extract tar.bz2file:
tar jxf backup.tar.bz2

Copy files from source to destination:
scp local.xml username@hostnameORipaddress:FullFolderTargetPath


All the above commands require password.

Issues with MySql Dump:
mysqldump: Got error: 1016: Can’t open file: … (errno: 24) when using LOCK TABLES

Check and change the file permissions:

mysqldump: Got error: 1016:
http://voidweb.com/2011/05/mysqldump-got-error-1016-cant-open-file-errno-24-when-using-lock-tables/




Linux remove entire directory including all files and sub-directories command

To remove all directories and subdirectories use rm command. For example remove *.doc files and all subdirectories and files inside letters directory, type the following command (warning all files including subdirectories will be deleted permanently):

$ rm -rf letters/

Where,

    -r : Attempt to remove the file hierarchy rooted in each file argument i.e. recursively remove subdirectories and files from the specified directory.
    -f : Attempt to remove the files without prompting for confirmation, regardless of the file's permissions

Copy files and folders from one directory to another:
http://www.cyberciti.biz/faq/copy-folder-linux-command-line/

1 comment:

  1. For Me this post was very Useful........

    ReplyDelete