README.md - added new one-liners

- signed-off-by: trimstray <trimstray@gmail.com>
This commit is contained in:
trimstray 2018-07-09 12:09:57 +02:00
parent 4a9beba7c1
commit 518bd28ba0

View file

@ -309,6 +309,7 @@ disown -a && exit
```bash ```bash
kill -9 $$ kill -9 $$
unset HISTFILE && exit
``` ```
###### Perform a branching conditional ###### Perform a branching conditional
@ -371,6 +372,13 @@ rename 'y/A-Z/a-z/' *
printf "%`tput cols`s" | tr ' ' '#' 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)) ##### 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 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 <username> -print
```
###### Find files and directories for all without specific user
```bash
find . \!-user <username> -print
```
###### Delete older files than 60 days
```bash
find . -type f -mtime +60 -delete
```
___ ___
##### Tool: [top](https://en.wikipedia.org/wiki/Top_(software)) ##### 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 ###### Checking whether the private key and the certificate match
```bash ```bash
@ -1201,3 +1255,15 @@ grep . filename > newfilename
```bash ```bash
grep -vE '(error|critical|warning)' filename 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
```