Linux / Unix: scp Copy All Hidden Dot Files

Linux / Unix: scp Copy All Hidden Dot Files

To copy all hidden dot files (files whose names begin with a period, such as .bashrc or .bash_history) using the scp command in Linux or Unix, you can use the -a option. The -a option tells scp to preserve the file attributes of the source files when copying them, which includes preserving the hidden status of dot files.

For example, to copy all hidden dot files from a remote server to the current directory on your local machine, you can use the following command:

‮efer‬r to:lautturi.com
scp -a username@remote:/path/to/source/.* .

This will copy all hidden dot files in the /path/to/source directory on the remote server to the current directory on your local machine.

You can also use the -r option to copy directories recursively, which will copy all files and directories, including hidden dot files, in the source directory and its subdirectories.

For example, to recursively copy all files and directories, including hidden dot files, from the /path/to/source directory on the remote server to the /path/to/destination directory on your local machine, you can use the following command:

scp -ar username@remote:/path/to/source/ /path/to/destination/

This will copy all files and directories, including hidden dot files, from the /path/to/source directory and its subdirectories to the /path/to/destination directory on your local machine.

For more information about the scp command and its options, you can refer to the scp man page or search online for tutorials and examples.

Created Time:2017-10-29 22:09:00  Author:lautturi