Linux: Difference between revisions
Appearance
Created page with ";Copy directories without content rsync -av -f"+ */" -f"- *" "$source" "$target"" |
No edit summary |
||
| Line 1: | Line 1: | ||
;Copy directories without content | ;Copy directories without content | ||
<pre> | |||
rsync -av -f"+ */" -f"- *" "$source" "$target" | rsync -av -f"+ */" -f"- *" "$source" "$target" | ||
</pre> | |||
;Delete Files older Than | |||
<pre> | |||
find /var/log -name "*.log" -type f -mtime +30 -delete <br> | |||
find /var/log -type d -mtime +30 -exec rm -rf {} \; | |||
</pre> | |||
;How to print a file, excluding comments and blank lines, using grep | |||
<pre>grep -v '^$\|^#\|^\s*\#' filename | grep -v "^[[:space:]]*$" | more</pre> | |||
Revision as of 09:45, 7 April 2022
- Copy directories without content
rsync -av -f"+ */" -f"- *" "$source" "$target"
- Delete Files older Than
find /var/log -name "*.log" -type f -mtime +30 -delete <br>
find /var/log -type d -mtime +30 -exec rm -rf {} \;
- How to print a file, excluding comments and blank lines, using grep
grep -v '^$\|^#\|^\s*\#' filename | grep -v "^[[:space:]]*$" | more