Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
en:tools:linux:file-handling [2023/09/30 14:28] crunchyslimeen:tools:linux:file-handling [2023/10/25 12:01] (current) admin
Line 92: Line 92:
  
 ==== copy while preserving arborescence ==== ==== copy while preserving arborescence ====
-[[source|https://ostechnix.com/copy-specific-file-types-while-keeping-directory-structure-in-linux/]]+[[https://ostechnix.com/copy-specific-file-types-while-keeping-directory-structure-in-linux/|source]]
  
-<bash code>find. -name '*.mp3' -exec cp --parents \{\}~/target\;</code>+<code bash>find. -name '*.mp3' -exec cp --parents \{\}~/target\;</code>
  
    * ''find'' – command to find files and folders in Unix-like systems.    * ''find'' – command to find files and folders in Unix-like systems.
Line 107: Line 107:
 ==== recursively copy all files without preserving the file tree ==== ==== recursively copy all files without preserving the file tree ====
  
-<bash code>find. -name '*.PNG' -exec cp\{\}allpics/\;</code>+<code bash>find. -name '*.PNG' -exec cp\{\}allpics/\;</code>
  
 Here we are at the root of the file tree to explore and the destination folder is ''allpics''. Here we are at the root of the file tree to explore and the destination folder is ''allpics''.
Line 113: Line 113:
 ==== list the differences between two directories ==== ==== list the differences between two directories ====
 count the differences count the differences
-<bash code>diff -y <(cd /path/to/files/1/ && ls -R) <(cd /path/to/files/2/ && ls -R) | wc -l</code>+<code bash>diff -y <(cd /path/to/files/1/ && ls -R) <(cd /path/to/files/2/ && ls -R) | wc -l</code>
  
 list the differences in diff.log list the differences in diff.log
-<bash code>diff -y <(cd /path/to/files/1/ && ls -R) <(cd /path/to/files/2/ && ls -R) > diff.log</code>+<code bash>diff -y <(cd /path/to/files/1/ && ls -R) <(cd /path/to/files/2/ && ls -R) > diff.log</code>
  
 adding ''grep -E \/'' or ''-d'' on the ''ls'' allows you to list directories adding ''grep -E \/'' or ''-d'' on the ''ls'' allows you to list directories
Line 122: Line 122:
 ==== list the duplicates ==== ==== list the duplicates ====
 [[https://buildvirtual.net/how-to-find-duplicate-files-on-linux/|source]] [[https://buildvirtual.net/how-to-find-duplicate-files-on-linux/|source]]
-*detect duplicates* + 
-<bashcode>fdupes -Sr .</code>+**detect duplicates** 
 + 
 +<code bash>fdupes -Sr .</code> 
 + 
 +==== Disk usage ==== 
 +Usefull commands :  
 +<code bash> 
 +#liste the 30 largest files in filetree 
 +du -Sh | sort -rh | head -30</code> 
 +<code bash> 
 +#ncurse disk usage 
 +ncdu 
 +#on remote system 
 +ssh -C user@system ncdu -o- / | ./ncdu -f- 
 +</code>
  • en/tools/linux/file-handling.1696076930.txt.gz
  • Last modified: 2023/09/30 14:28
  • by crunchyslime