diff --git a/README.md b/README.md index 52175e8..2671180 100644 --- a/README.md +++ b/README.md @@ -309,6 +309,7 @@ disown -a && exit ```bash kill -9 $$ +unset HISTFILE && exit ``` ###### Perform a branching conditional @@ -371,6 +372,13 @@ rename 'y/A-Z/a-z/' * printf "%`tput cols`s" | tr ' ' '#' ``` +###### Show shell history without line numbers + +```bash +history | cut -c 8- +fc -l -n 1 | sed 's/^\s*//' +``` + ___ ##### Tool: [mount](https://en.wikipedia.org/wiki/Mount_(Unix)) @@ -438,6 +446,38 @@ find / -type f -size +20M find -type f -exec md5sum '{}' ';' | sort | uniq --all-repeated=separate -w 33 ``` +###### Change permission only for files + +```bash +cd /var/www/site && find . -type f -exec chmod 766 {} \; +cd /var/www/site && find . -type f -exec chmod 664 {} + +``` + +###### Change permission only for directories + +```bash +cd /var/www/site && find . -type d -exec chmod g+x {} \; +cd /var/www/site && find . -type d -exec chmod g+rwx {} + +``` + +###### Find files and directories for specific user + +```bash +find . -user -print +``` + +###### Find files and directories for all without specific user + +```bash +find . \!-user -print +``` + +###### Delete older files than 60 days + +```bash +find . -type f -mtime +60 -delete +``` + ___ ##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software)) @@ -656,6 +696,20 @@ EOF )) ``` +###### Convert DER to PEM + +```bash +( _fd_der="cert.crt" ; _fd_pem="cert.pem" ; \ +openssl x509 -in ${_fd_der} -inform der -outform pem -out ${_fd_pem} ) +``` + +###### Convert PEM to DER + +```bash +( _fd_der="cert.crt" ; _fd_pem="cert.pem" ; \ +openssl x509 -in ${_fd_pem} -outform der -out ${_fd_der} ) +``` + ###### Checking whether the private key and the certificate match ```bash @@ -1201,3 +1255,15 @@ grep . filename > newfilename ```bash grep -vE '(error|critical|warning)' filename ``` + +###### Show data from file without comments + +```bash +grep -v ^[[:space:]]*# filename +``` + +###### Show data from file without comments and new lines + +```bash +egrep -v '#|^$' filename +```