mirror of
https://github.com/trimstray/the-book-of-secret-knowledge.git
synced 2024-12-18 17:36:14 +00:00
minor fixes
- signed-off-by: trimstray <trimstray@gmail.com>
This commit is contained in:
parent
7de5c33234
commit
d9aaa77cf5
34
README.md
34
README.md
@ -1225,8 +1225,8 @@ rm !(*.foo|*.bar|*.baz)
|
|||||||
###### Pass multi-line string to a file
|
###### Pass multi-line string to a file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# cat >filename ... - overwrite file
|
# cat >filename ... - overwrite the file
|
||||||
# cat >>filename ... - append to file
|
# cat >>filename ... - append to a file
|
||||||
cat > filename << __EOF__
|
cat > filename << __EOF__
|
||||||
data data data
|
data data data
|
||||||
__EOF__
|
__EOF__
|
||||||
@ -1294,7 +1294,7 @@ for ((i=5; i<=10; ++i)) ; do printf '%02d\n' $i ; done
|
|||||||
for i in {1..10} ; do echo $i ; done
|
for i in {1..10} ; do echo $i ; done
|
||||||
```
|
```
|
||||||
|
|
||||||
###### Simple Bash Filewatching
|
###### Simple Bash filewatching
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
unset MAIL; export MAILCHECK=1; export MAILPATH='$FILE_TO_WATCH?$MESSAGE'
|
unset MAIL; export MAILCHECK=1; export MAILPATH='$FILE_TO_WATCH?$MESSAGE'
|
||||||
@ -1323,12 +1323,29 @@ ___
|
|||||||
|
|
||||||
##### Tool: [fuser](https://en.wikipedia.org/wiki/Fuser_(Unix))
|
##### Tool: [fuser](https://en.wikipedia.org/wiki/Fuser_(Unix))
|
||||||
|
|
||||||
|
###### Show which processes use the files/directories
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fuser /var/log/daemon.log
|
||||||
|
fuser -v /home/supervisor
|
||||||
|
```
|
||||||
|
|
||||||
###### Kills a process that is locking a file
|
###### Kills a process that is locking a file
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
fuser -k filename
|
fuser -ki filename
|
||||||
```
|
```
|
||||||
|
|
||||||
|
* `-i` - interactive option
|
||||||
|
|
||||||
|
###### Kills a process that is locking a file with specific signal
|
||||||
|
|
||||||
|
```bash
|
||||||
|
fuser -k -HUP filename
|
||||||
|
```
|
||||||
|
|
||||||
|
* `--list-signals` - list available signal names
|
||||||
|
|
||||||
###### Show what PID is listening on specific port
|
###### Show what PID is listening on specific port
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -1529,7 +1546,7 @@ ___
|
|||||||
top -p $(pgrep -d , <str>)
|
top -p $(pgrep -d , <str>)
|
||||||
```
|
```
|
||||||
|
|
||||||
* `<str>` - process containing str (eg. nginx, worker)
|
* `<str>` - process containing string (eg. nginx, worker)
|
||||||
|
|
||||||
___
|
___
|
||||||
|
|
||||||
@ -3063,7 +3080,6 @@ httpd.serve_forever()
|
|||||||
import BaseHTTPServer, SimpleHTTPServer
|
import BaseHTTPServer, SimpleHTTPServer
|
||||||
import ssl
|
import ssl
|
||||||
|
|
||||||
|
|
||||||
httpd = BaseHTTPServer.HTTPServer(('localhost', 4443),
|
httpd = BaseHTTPServer.HTTPServer(('localhost', 4443),
|
||||||
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
SimpleHTTPServer.SimpleHTTPRequestHandler)
|
||||||
|
|
||||||
@ -3151,9 +3167,9 @@ sed ':a;N;$!ba;s/\n/ /g' /path/to/file
|
|||||||
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' /path/to/file
|
sed -e ':a' -e 'N' -e '$!ba' -e 's/\n/ /g' /path/to/file
|
||||||
```
|
```
|
||||||
|
|
||||||
- `:a` create a label 'a'
|
- `:a` create a label `a`
|
||||||
- `N` append the next line to the pattern space
|
- `N` append the next line to the pattern space
|
||||||
- `$!` if not the last line, ba branch (go to) label 'a'
|
- `$!` if not the last line, ba branch (go to) label `a`
|
||||||
- `s` substitute, `/\n/` regex for new line, `/ /` by a space, `/g` global match (as many times as it can)
|
- `s` substitute, `/\n/` regex for new line, `/ /` by a space, `/g` global match (as many times as it can)
|
||||||
|
|
||||||
Alternatives:
|
Alternatives:
|
||||||
@ -3269,7 +3285,7 @@ Example:
|
|||||||
shell> DomainResolve nmap.org
|
shell> DomainResolve nmap.org
|
||||||
nmap.org > 45.33.49.119
|
nmap.org > 45.33.49.119
|
||||||
|
|
||||||
shell> DomainResolve nmap.orgs
|
shell> DomainResolve nmap.org
|
||||||
Unsuccessful domain name resolution.
|
Unsuccessful domain name resolution.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user