Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
comp:commands [2023/04/16 20:52] – [Copy files between servers] Bernard Condraucomp:commands [2026/07/19 17:24] (current) – [Copy all files except some in all sub directories] Bernard Condrau
Line 17: Line 17:
     * also enable the user on the target machine to run rsync with root privileges, to do so create file ''/etc/sudoers.d/rsync'' (line 1) with content (line 2)<code>$ sudo visudo /etc/sudoers.d/rsync     * also enable the user on the target machine to run rsync with root privileges, to do so create file ''/etc/sudoers.d/rsync'' (line 1) with content (line 2)<code>$ sudo visudo /etc/sudoers.d/rsync
 user ALL = NOPASSWD:/usr/bin/rsync</code> user ALL = NOPASSWD:/usr/bin/rsync</code>
-  - Copy from cloud<code>$ rsync -avz -e 'ssh -p 22 -i /path/to/private/identity/file' --info=progress2 user@x.x.x.x:/path/to/dir/ /local/dir/</code>+  - Copy from cloud<code>$ rsync -avz -e 'ssh -p 22 -i /path/to/identity/file' --info=progress2 user@x.x.x.x:/path/to/dir/ /local/dir/</code>
 ===== File Management ===== ===== File Management =====
 +
 +==== Read very large text file ====
 +  tail -n 100 ./file-name.txt
 +  head -n 100 ./file-name.txt
  
 ==== Copy all files except some in all sub directories ==== ==== Copy all files except some in all sub directories ====
Line 52: Line 56:
 ==== Determine size of a folder path ==== ==== Determine size of a folder path ====
   du -hs   du -hs
 +
 +==== Find size of all sub-directories (only 1 level) ====
 +  find -maxdepth 1 -type d -path ./proc -prune -o -exec du -hs "{}" \;
  
 ==== Change permissions for all files in a directory tree ==== ==== Change permissions for all files in a directory tree ====