Q. How do I copy all the file including subdirectories from DVD disk mounted at /mnt/dvd to /home/tom at a shell prompt under CentOS Linux?
A. You need to use cp command to copy SOURCE to DESTINATION or multiple SOURCE(s) to a DIRECTORY. Gnu cp command has -a option which copy directories recursively while preserving the file attributes such as mode,ownership,timestamps and security contexts, if possible additional attributes such as links et all.
cp command syntax
Use the following syntax:
cp -a {/path/to/source} {/path/to/destination}
For example copy all files including subdirectories from /mnt/dvd/data to /home/tom/data, enter:
$ cp -a /mnt/dvd/data/* /home/tom/data
OR
$ cp -av /mnt/dvd/data/* /home/tom/data
Recursively copy entire directories
Many other command (including cp) support -r or -R option for copying file recursively. For example scp secure network copy command:
$ scp -r *.cpp remote_user@server.nixcraft.in:~
OR use cp command locally (instead of -a option):
$ cp -r *.cpp /path/to/dest
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop





![Linux Copy File Command [ cp Command Examples ]](http://s13.cyberciti.org/images/shared/rp/3/22.jpg)





![Linux: HowTo Copy a Folder [ Command Line Option ]](http://s13.cyberciti.org/images/shared/rp/3/21.jpg)
![Unix Copy Command Examples [ cp command ]](http://s13.cyberciti.org/images/shared/rp/3/20.jpg)

{ 0 comments… add one now }