SlackwareThis Forum is for the discussion of Slackware Linux.
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Ilgar : I did something like this recently. Looks OK to me. Just don't forget to preserve ownership and permissions when moving/copying (it was cp -p for copying I think...).
To make an exact copy of a directory hierarchy, I prefer to use the good old GNU Tar command. I think it is the easiest and safer solution. For example, to copy /usr/ to /mnt/hdax/usr/ with GNU Tar, I would use :
$ su - root
# ( cd / ; tar cf - usr ) | tar xpf - -C /mnt/hdax/
Asterisk character, hidden files and filename expansion rules of the shell
(...) Or if you prefer the cp command:
# cp -rpfd /directory/path/* /mnt/directory/
The asterisk character ("*") should be used carefully as it is subject to the filename expansion rules which are applied by the shell before the command is executed. In the above example, hidden files (.*) in the /directory/path/ directory won't be copied as BASH does not include hidden files when it expands the asterisk character. Since an example is worth a thousand words : look at the output of the folllowing command and notice that hidden files/directories are not listed :
Yes, that is correct and a good point. You should not use the '*' in the cp command if you have hidden files in that immediate path. It will of course copy over hidden files but they would need to be nested.
# ls -a /home/Test/Hidden
. .. .a .ab .abc .abcd .abcde
# ls -a /home/Test2
# linux:/home# cp -rpfd /home/Test/* /home/Test2/
# linux:/home# ls -a /home/Test2/Hidden
. .. .a .ab .abc .abcd .abcde