How do I use the rsync tool to copy only the hidden files and directory (such as ~/.ssh/, ~/.foo, and so on) from /home/jobs directory to the /mnt/usb directory under Unix like operating system?

The rsync program is used for synchronizing files over a network or local disks. To view or display only hidden files with ls command:
[donotprint][/donotprint]

ls -ld ~/.??*

OR


ls -ld ~/.[^.]*

Sample outputs:

Fig:01 ls command to view only hidden files

rsync not synchronizing all hidden .dot files?

In this example, you used the pattern .[^.]* or .??* to select and display only hidden files using ls command. You can use the same pattern with any Unix command including rsync command. The syntax is as follows to copy hidden files with rsync:

rsync -av /path/to/dir/.??* /path/to/dest
rsync -avzP /path/to/dir/.??* /mnt/usb
rsync -avzP $HOME/.??* user1@server1.sxi.io:/path/to/backup/users/u/user1
rsync -avzP ~/.[^.]* user1@server1.sxi.io:/path/to/backup/users/u/user1

In this example, copy all hidden files from my home directory to /mnt/test:

rsync -avzP ~/.[^.]* /mnt/test

Sample outputs:

Fig.02 Rsync example to copy only hidden files

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

  • Coin Center Opens Nominations for the 2016 Blockchain Awards
  • Social Trading Giant eToro Adds Crypto Buying and Selling in 32 US States
  • Crypto Tracking Site CoinMarketCap Gets an Update
  • The 8 Steps to Becoming a Bitcoin-Savvy Bank
  • Brazil’s Central Bank Is Ramping Up Blockchain R&D
  • Sequoia Fund Says Blockchain Could Cut MasterCard Earnings
  • Bash Configure Automatic Logout [ Linux / Unix / Apple OS X ]
  • How To Set Up FTP isolation in CentOS or Ubuntu
  • UK Government Announces New Cryptocurrency Research Effort
  • British Charity Aims to Improve Maritime Safety with New Blockchain Lab
  • How to Install and configure AIDE Host Based IDS on RHEL 8 / CentOS 8
  • ICO Promoters Can Expect Canada to Be as Tough as the US
  • Install Stencyl 3.4 – Creating Games Without Coding on Linux
  • Up 15%: Bitcoin’s Price Bounces Back After 14-Month Low
  • Congressional Group Pushes for Blockchain Security Standards
  • SXI LLC Company
    SXI.IO is a global Blockchain software company, specialized in developing white label crypto exchange platforms , Wallet platforms, ICO platforms, Token Erc20 .....
    Fully Managed VPS Fully Managed VPS Fully Managed VPS

    You Might Also Enjoy NewS Post

    Best Free Web Hosting 2020

    Free Hosting 1GB $0.00 USD/mo Disk space 1GB Traffic 10GB/Month Domains 2 Plesk Cpanel Databases 10 Free 12 Month https://my.sxi.io/cart.php?a=add&pid=196

    02/05/2020 READ MORE

    Download Windows Templates for Virtualizor KVM

    Download any of client OS template to the location in Node ( /var/virtualizor/Xen or KVM according to the virtualization). http://mirror.softaculous.com/virtualizor/templates/windows-2003-x86.img.gz http://mirror.softaculous.com/virtualizor/templates/windows_2003R264.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2008r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012server.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2003-x86.img.gz http://mirror.softaculous.com/virtualizor/templates/windows_2003R264.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2008r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012server.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2012r2.img.gz http://mirror.softaculous.com/virtualizor/templates/windows-2016.img.gz For...

    23/04/2020 READ MORE