krlaboratories

how easy copy and move files in linux

Feb 7th, 2022 (edited)
574
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.58 KB | None | 0 0
  1. /* copy and migrations files */
  2.  
  3. cp -r /dir1/ /dir2/ - copy dir and files without save access rights
  4. cp -a /dir1/. /dir2/ - copy dir and files (contain hidden) with save access rights
  5. cp -a /dir1/ /dir2/ - copy dir and all files to another dir
  6. cp -rp /dir1/* /dir2 - copy all files of folder 'dir1' to folder 'dir2'
  7.  
  8. /* SCP files copy between servers */
  9.  
  10. scp -i /secretkey /dir1 username@XX.XX.XX.XXX:/dir2
  11. scp -i /secretkey username@XX.XX.XX.XXX:/dir1 /dir2
  12. scp -i /secretkey -r /dir1/ username@XX.XX.XX.XXX:/dir2/ - copy all files recursive from dir1 to dir2 on other server
Add Comment
Please, Sign In to add comment