Linux
Appearance
- 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