Showing posts with label scp. Show all posts
Showing posts with label scp. Show all posts

Thursday, August 8, 2013

// // Leave a Comment

Linux: HowTo Copy a Folder [ Command Line Option ]

I'm a new Linux user. How do I copy a directory or folder under Linux operating system using command line options and bash shell?

You can use various command to copy a folder under Linux operating systems.

cp Command

cp is a Linux command for copying files and directories. The syntax is as follows:
 
cp source destination
cp dir1 dir2
cp -option  source destination
cp -option1 -option2  source destination
 
In this example copy /home/vivek/letters folder and all its files to /usb/backup directory:
 
cp -avr /home/vivek/letters /usb/backup
 
Where,
  • -a : Preserve the specified attributes such as directory an file mode, ownership, timestamps, if possible additional attributes: context, links, xattr, all.
  • -v : Explain what is being done.
  • -r : Copy directories recursively.

Example

Copy a folder called /tmp/conf to /tmp/backup:
$ cp -avr /tmp/conf/ /tmp/backup
Sample outputs:
HowTO: Copy Folder Linux Terminal Command
Fig.01: cp command in action

rsync Command

You can also use rsync command which is a fast and extraordinarily versatile file copying tool. It can make copies across the network. The syntax is as follows:
 
rsync -av /path/to/source /path/to/destination
rsync -av /path/to/source/ /path/to/destination/source
 
To backup my home directory, which consists of large files and mail folders to /media/backup, enter:
$ rsync -avz /home/vivek /media/backup
I can copy a folder to remote machine called server1.cyberciti.biz:
$ rsync -avz /home/vivek/ server1.cyberciti.biz:/home/backups/vivek
Where,
  • -a : Archive mode i.e. copy a folder with all its permission and other information including recursive copy.
  • -v : Verbose mode.
  • -z : With this option, rsync compresses the file data as it is sent to the destination machine, which reduces the amount of data being transmitted — something that is useful over a slow connection.
You can show progress during transfer using --progress or -P option:
$ rsync -av --progress /path/to/source/ /path/to/dest
Sample outputs:
Copy Folder Linux Commands [ rsync ]
Fig.02: rsync command in action
Read More

Friday, April 19, 2013

// // Leave a Comment

File transfer in background using SCP

For scping large files, it is best to let them run in the background.

follow the steps below to transfer files using SCP command in the background

1) execute the normal scp command, eg:
# scp localfile.tar.bz2 user@server.ch:/path/on/server/

2) after confirming the key and authentificating (if necessary), you can "stop" the job by pressing : ctrl + Z
[1]+ Stopped scp localfile.tar.bz2 user@server.ch:/path/on/server/

3) then you can proceed the job in the background by typing
# bg
[1]+ scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


4) finally, to make sure the process is working in background, issue the “jobs” command
# jobs
[1]+ Running scp localfile.tar.bz2 user@server.ch:/path/on/server/ &


Now the session can be exited with the file transfer unaffected.
Read More

Thursday, November 29, 2012

// // Leave a Comment

How to Restore a Full Cpmove File Using Whm.

Restoring a full cpmove file or cpanel complete backup file is very easy using the whm interface. The only condition is that the cpmove file or the cpanel backup file should be in any of the below directory:

/home
/usr/home
/web
/home2
/home3
/root
/usr

So if you have the backup file at any other location then please move it to any of the above location otherwise you will not be able to restore the cpanel account using WHM.

Open the whm >> backup >> restore a cpmove file option.

Then you will be able to see the cpmove file available to restore.
Just put the username of the cpanel account that you can see in the backup file name too and its done !

Thats it !

Note: The username must match the name in cpmove file. you may see a list of cpmove files with different names, so only put the name which you want to restore.
Cool
Read More
// // Leave a Comment

How to Create a Backup using SSH Shell Commands.

How to make a backup using command prompt ? How to pack a user account using SSH putty ?
These similar questions are very common among newbies and new webmasters.
Here below is the code that you can use to pack a CPanel account.

1). Open SSH Command prompt window and login as root with your root password.
2). Run the below code and press enter.
Code:
/scripts/pkgacct username
Where username will be the username of the account you want to generate a backup for.
3). Your backup file will be available in /home/ directory fo your server.

CHEERS !
Read More