Linux / UNIX scp Copy Hidden . (Dot) Files

How do I copy all hidden files from $HOME using scp command line tool?

scp is secure remote copy program which copies files between hosts on a network. The correct syntax to copy all hidden files using scp is as follows:
$ scp -rp /path/to/source/. user@server2.cyberciti.biz:/path/to/dest/
You need to append a dot to the end of the source so that it will copy all files. A better solution is to use the rsync command as follows:
$ rsync -av --progress /path/to/source user@server2.cyberciti.biz:/path/to/dest/

ADVERTISEMENTS

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallCentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
2 comments… add one
  • Jess Aug 28, 2014 @ 12:34

    This doesn’t work. Neither solution copied the .bashrc

  • Jerry Aug 9, 2020 @ 18:40

    A solution with SCP won’t work.

    It produces error:
    “scp: error: unexpected filename: .”

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.