This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| comp:commands [2022/09/24 14:47] – [Copy files between servers] Bernard Condrau | comp:commands [2026/07/19 17:24] (current) – [Copy all files except some in all sub directories] Bernard Condrau | ||
|---|---|---|---|
| Line 13: | Line 13: | ||
| ===== Copy files between servers ===== | ===== Copy files between servers ===== | ||
| - | | + | |
| - | | + | |
| + | * also enable the user on the target machine to run rsync with root privileges, to do so create file ''/ | ||
| + | user ALL = NOPASSWD:/ | ||
| + | - Copy from cloud< | ||
| ===== File Management ===== | ===== File Management ===== | ||
| + | |||
| + | ==== Read very large text file ==== | ||
| + | tail -n 100 ./ | ||
| + | head -n 100 ./ | ||
| ==== Copy all files except some in all sub directories ==== | ==== Copy all files except some in all sub directories ==== | ||
| Line 29: | Line 35: | ||
| ==== Find all files containing specific text ==== | ==== Find all files containing specific text ==== | ||
| - | | + | |
| + | * If you only want the filenames that have a matching line without showing the matching line:< | ||
| ==== Find all files which were modified within the last month from the current directory ==== | ==== Find all files which were modified within the last month from the current directory ==== | ||
| find . -newermt $(date +%Y-%m-%d -d '1 month ago') -type f -print | find . -newermt $(date +%Y-%m-%d -d '1 month ago') -type f -print | ||
| Line 48: | 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 ==== | ||