Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
development:linux:file_management [2020/03/02 14:52]
kalenpw created
development:linux:file_management [2021/06/29 15:06] (current)
kalenpw
Line 4: Line 4:
 ---- ----
 ===== cp ===== ===== cp =====
-<code>+<code bash>
 # trailing slash affects whether source gets copied or not # trailing slash affects whether source gets copied or not
-cp -r ./old_dir ./new_dir # will move old_dir into new_dir +cp -r ./old_dir ./new_dir  # will copy old_dir into new_dir 
-cp -r ./old_dir/ ./new_dir # will move everyhing inside old_dir to new_dir+cp -r ./old_dir/ ./new_dir # will copy everyhing inside old_dir to new_dir 
 +</code> 
 + 
 +---- 
 +===== scp ===== 
 +<code bash> 
 +# unlike cp trailing slash does not have affect. scp will always copy the source_dir 
 +scp -rP 2222 kalenpw@kalenpw.com:/path/to/file.txt ./dest_file  
 +# use an ssh alias in scp 
 +scp ./file.txt khalidor:/home/kalenpw
 </code> </code>
  
 ---- ----
 ===== rsync ===== ===== rsync =====
 +<code bash>
 +# like cp trailing slash causes source_dir to not be copied
 +rsync -r source ./dest/  # source will be inside dest
 +rsync -r source/ ./dest/ # only inner files of source will be moved
 +
 +rsync -r source/ ./dest/ --delete # delete files in dest that didn't exist in source
 +</code>
 +----