Jump to content

Linux: Difference between revisions

From Costa's Wiki
No edit summary
No edit summary
Line 3: Line 3:
rsync -av -f"+ */" -f"- *" "$source" "$target"
rsync -av -f"+ */" -f"- *" "$source" "$target"
</pre>
</pre>
;Find files
find /path/to/dir -type f -name "*" -newermt 2013-02-07 ! -newermt 2013-02-08
find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -print
find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -ls
;Delete Files older Than
;Delete Files older Than
<pre>
<pre>

Revision as of 22:22, 23 May 2022

Copy directories without content
rsync -av -f"+ */" -f"- *" "$source" "$target"
Find files
find /path/to/dir -type f -name "*" -newermt 2013-02-07 ! -newermt 2013-02-08
find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -print
find $HOME/projects -type f -name "*.py" -newermt 2013-02-07 ! -newermt 2013-02-08 -ls
Delete Files older Than
find /var/log -name "*.log" -type f -mtime +30 -delete 
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
Audiofile operations
LVM operations
SSL Certificate with SAN