Jump to content

Linux: Difference between revisions

From Costa's Wiki
No edit summary
No edit summary
Line 17: Line 17:
  IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo $i; done
  IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo $i; done
  IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo "$i;"| tr -d '\r\n'; find $i -type f | wc -l; done
  IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo "$i;"| tr -d '\r\n'; find $i -type f | wc -l; done
;ssh automation
ssh -i /usr/local/sbin/id_rsa -oStrictHostKeyChecking=no [email protected] 'upsc qnapups'
-i RSA key, -o add to known host automatically
;[[Audiofile operations]]
;[[Audiofile operations]]
;[[LVM operations]]
;[[LVM operations]]
;[[SSL Certificate with SAN]]
;[[SSL Certificate with SAN]]

Revision as of 20:39, 6 June 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
bash operations with file with spaces in name
IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo $i; done
IFS=$(echo -en "\n\b"); for i in $(ls -d */ | cut -f1 -d'/'); do echo "$i;"| tr -d '\r\n'; find $i -type f | wc -l; done
ssh automation
ssh -i /usr/local/sbin/id_rsa -oStrictHostKeyChecking=no [email protected] 'upsc qnapups'
-i RSA key, -o add to known host automatically
Audiofile operations
LVM operations
SSL Certificate with SAN