If you carry your work to and from (Web hosting packages)

If you carry your work to and from the office on alaptop, use the scpto copy files from your laptopto your home computer (and back again). You can also use the scp -rcommand to quicklymove a user from one machine to another. If you re upgrading to a new system, scp -ris aneasy way to quickly transfer your work with nodisruptions. scpwas designed to copy files from one com- puter to another. You can also use scpto copya file from one place to another withinyourcomputer, just like you would use cp. We findscpto be much more intuitive when it comesto copying directory trees. To move a directory tree with scp, open your termi- nal window and enter this command: $ scp -r user@host:source user@host: destinationThat s all there is to it. The -rflag tells scpto copysourceand everything underneath it. Table 13-2 highlights two options worthy of mention. TABLE13-2: WORTHWHILESCPOPTIONSOptionWhat It Does-CCompresses the data stream for faster transfers. -l limitThrottles file transfers to no more thanlimitK bits per second. (Use this option ifyou re sharing a network connection and youdon t want to hog all the bandwidth). Getting familiar with scp(and its secure shellcousin, ssh) is definitely worth the time. scpisa fast, secure, and easy way to move files andarchives from one location to another. scpandsshshare many command-line optionsbecause scpis built from ssh. For more infor- mation about ssh, see Technique 33. Archiving complex search resultsUse the pipe character ( |) to combine programslike findand rpmwith the tarcommand to createarchives that contain the results of complexsearches. Using tarwith findcan seem complex, but it is veryuseful. One example of a combined command is asfollows: $ find / -user freddie | tar -zcvf fredfiles -T - This command finds all the files owned by the userFreddie and sends the output (the list of filenames) to the tarcommand. The -T -portion of the com- mand instructs tarto read the list of filenames fromits standard input (which, in this case, is the outputof the findcommand) rather than from the com- mand line. For more in-depth information about using the findcommand, see Technique 12. Backing up an installed packageUse tarwith rpmto create a backup of an installedpackage. To back up an installed copy of the webminpackage, use this command: $ rpm -ql webmin | tar -cvf webminbackup -T - For more information about using rpmqueries, see Technique 16. Uprooting Entire DirectoryTreeswith scpSometimes, you need to move more than a single file you need to move an entire directory tree (a directory and all the files and subdirectoriesunderneath it). When that s the case, use scpto getthe job done quickly and easily. For example:
Visit our web design programs services for an affordable and reliable webhost to suit all your needs.

Leave a Reply