Merge pull request #353 from caverav/master

added shell cleaning trick
This commit is contained in:
Michał Ży 2022-02-28 21:34:27 +01:00 committed by GitHub
commit 945e21b6a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,8 +114,9 @@ Only main chapters:
- **[Hacking/Penetration Testing](#hackingpenetration-testing-toc)** - **[Hacking/Penetration Testing](#hackingpenetration-testing-toc)**
- **[Your daily knowledge and news](#your-daily-knowledge-and-news-toc)** - **[Your daily knowledge and news](#your-daily-knowledge-and-news-toc)**
- **[Other Cheat Sheets](#other-cheat-sheets-toc)** - **[Other Cheat Sheets](#other-cheat-sheets-toc)**
- **[One-liners](#one-liners-toc)** - **[Shell One-liners](#shell-one-liners-toc)**
- **[Shell functions](#shell-functions-toc)** - **[Shell Tricks](#shell-tricks-toc)**
- **[Shell Functions](#shell-functions-toc)**
## :trident:  The Book of Secret Knowledge (Chapters) ## :trident:  The Book of Secret Knowledge (Chapters)
@ -1669,7 +1670,7 @@ _Encoding_
text :arrow_right: encoded<br> text :arrow_right: encoded<br>
text :arrow_left: encoded text :arrow_left: encoded
#### One-liners &nbsp;[<sup>[TOC]</sup>](#anger-table-of-contents) #### Shell One-liners &nbsp;[<sup>[TOC]</sup>](#anger-table-of-contents)
##### Table of Contents ##### Table of Contents
@ -2327,6 +2328,7 @@ ___
```bash ```bash
vimdiff file1 file2 vimdiff file1 file2
``` ```
###### Compare two JSON files ###### Compare two JSON files
```bash ```bash
@ -2334,8 +2336,9 @@ vimdiff <(jq -S . A.json) <(jq -S . B.json)
``` ```
###### Compare Hex dump ###### Compare Hex dump
```bash ```bash
d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1|cut -d' ' -f3-|tr -s ' ';}; d ~/bin1 ~/bin2 d(){ vimdiff <(f $1) <(f $2);};f(){ hexdump -C $1 | cut -d' ' -f3- | tr -s ' ';}; d ~/bin1 ~/bin2
``` ```
###### diffchar ###### diffchar
@ -4352,6 +4355,17 @@ perl -p -i -e 's/\t/ /g' filename
perl -lne '$i++; $in += length($_); END { print "$i lines, $in characters"; }' filename perl -lne '$i++; $in += length($_); END { print "$i lines, $in characters"; }' filename
``` ```
#### Shell Tricks &nbsp;[<sup>[TOC]</sup>](#anger-table-of-contents)
When you get a shell, it is generally not very clean, but after following these steps, you will have a fairly clean and comfortable shell to work with.
1) `script /dev/null -c bash`
2) Ctrl-Z (to send it to background)
3) `stty raw -echo; fg` (returns the shell to foreground)
4) `reset` (to reset terminal)
5) `xterm` (when asked for terminal type)
6) `export TERM=xterm; export SHELL=bash`
#### Shell functions &nbsp;[<sup>[TOC]</sup>](#anger-table-of-contents) #### Shell functions &nbsp;[<sup>[TOC]</sup>](#anger-table-of-contents)
##### Table of Contents ##### Table of Contents