Archive for November 19th, 2008

Copy / Paste files and folders.
– copy a file
~# cp filename1 filename2
A copy from filename1 is created in the same directory
~# cp /home/myweb/filename1 /home/hisweb/filename2
Creates a copy from filename1 into another directory and name filename2
To copy a folder use the -r ( recursive option )
~# cp -r folder1 folder2
~# cp -r /home/myweb/folder1 /home/hisweb/folder2

To copy and preserve the user and group rights use the -p flag
~# cp -rp filename 1 filename2
To show all options type:
~# cp –help

 

To move a file or to rename a file use:
~# mv filename1 filename2
For folders addd the -r ( recursive ) flag
~# mv -r folder1 folder2

 

To create a dump file use the following syntax:

/var/lib/mysql # mysqldump -u root -p mysqldatabase > backup.sql

You will be prompted for the password and the backup file will be created.

————————————————————————-

To restore a backup dump file use the following syntax:

/var/lib/mysql # mysql -u root -p mysqldatabase < backup.sql

You will be promted for the password and the backup will be restored.

 

To change date and time on your shell manually you need type the following code:

~# date --set 2008-11-19
~# date --set 15:25:0

Make sure to respect the syntax.