Copying a directory tree and its contents to another filesystem using tar will preserve ownership, permissions, and timestamps.
If you want recursively copy directory tree use next command:
tar cf - * | ( cd /target; tar xfp -)
The first part of the command before the pipe instruct tar to create an archive of everything in the current directory and write it to standard output (the – in place of a filename frequently indicates stdout). The commands within parentheses cause the shell to change directory to the target directory and untar data from standard input. Since the cd and tar commands are contained within parentheses, their actions are p...
Bash is quite useful for work with it from shell because of he has a couple methods which allow you do things easy and fast. Redirection is most useful thing. You use it everytime when work with shell.
Shell allows you redirect output and errors to places which you want, run command with file like stdin and so on... Let's try a few examples:
1. Execute ls command in ordinary mode. Stdout will your shell:
root@ansible:~# ls -l
-rw-r--r-- 1 root root 107 Feb 4 16:10 1
drwxrwxrwx 6 dpi dpi 4096 Nov 24 17:11 ansible
-rw-rw-r-- 1 dpi dpi 25 Jan 9 18:28 bla
drwxrwxr-x 3 dpi dpi 4096 Feb 14 11:42 bre
-rw-rw-r-- 1 ...