低质量的社交,不如高质量的独处

curl cht.sh

[root@master ~]# curl cht.sh/sed
# To replace all occurrences of "day" with "night" and write to stdout:
sed 's/day/night/g' file.txt

# To replace all occurrences of "day" with "night" within file.txt:
sed -i 's/day/night/g' file.txt

# To replace all occurrences of "day" with "night" on stdin:
echo 'It is daytime' | sed 's/day/night/g'

# To remove leading spaces
sed -i -r 's/^\s+//g' file.txt

# To remove empty lines and print results to stdout:
sed '/^$/d' file.txt

# To replace newlines in multiple lines
sed ':a;N;$!ba;s/\n//g'  file.txt

# Insert a line before a matching pattern:
sed '/Once upon a time/i\Chapter 1'

# Add a line after a matching pattern:
sed '/happily ever after/a\The end.'

[root@master ~]# curl cht.sh/grep
# Search a file for a pattern grep pattern file # Case insensitive search (with line numbers) grep -in pattern file # Recursively grep for string <pattern> in folder: grep -R pattern folder # Read search patterns from a file (one per line) grep -f pattern_file file # Find lines NOT containing pattern grep -v pattern file # You can grep with regular expressions grep "^00" file #Match lines starting with 00 grep -E "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" file #Find IP add # Find all files which match {pattern} in {directory} # This will show: "file:line my research" grep -rnw 'directory' -e "pattern" # Exclude grep from your grepped output of ps. # Add [] to the first letter. Ex: sshd -> [s]shd ps aux | grep '[h]ttpd' # Colour in red {bash} and keep all other lines ps aux | grep -E --color 'bash|$' [root@master ~]#

[root@master ~]# curl https://cht.sh/awk
# sum integers from a file or stdin, one integer per line:
printf '1\n2\n3\n' | awk '{ sum += $1} END {print sum}'

# using specific character as separator to sum integers from a file or stdin
printf '1:2:3' | awk -F ":" '{print $1+$2+$3}'

# print a multiplication table
seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'

# Specify output separator character
printf '1 2 3' | awk 'BEGIN {OFS=":"}; {print $1,$2,$3}'

# search for a paragraph containing string
awk -v RS='' '/42B/' file

# display only first column from multi-column text
echo "first-column second-column third-column" | awk '{print $1}'
[root@master ~]#

 

[root@master ~]# curl cht.sh
      _                _         _    __                                        
  ___| |__   ___  __ _| |_   ___| |__ \ \      The only cheat sheet you need    
 / __| '_ \ / _ \/ _` | __| / __| '_ \ \ \     Unified access to the best       
| (__| | | |  __/ (_| | |_ _\__ \ | | |/ /     community driven documentation   
 \___|_| |_|\___|\__,_|\__(_)___/_| |_/_/      repositories of the world        
                                                                                
+------------------------+ +------------------------+ +------------------------+
| $ curl cheat.sh/ls     | | $ cht.sh btrfs         | | $ cht.sh lua/:learn    |
| $ curl cht.sh/btrfs    | | $ cht.sh tar~list      | | Learn any* programming |
| $ curl cht.sh/tar~list | |                        | | language not leaving   |
| $ curl https://cht.sh  | |                        | | your shell             |
|                        | |                        | | *) any of 60           |
|                        | |                        | |                        |
+-- queries with curl ---+ +- own optional client --+ +- learn, learn, learn! -+
+------------------------+ +------------------------+ +------------------------+
| $ cht.sh go/f<tab><tab>| | $ cht.sh --shell       | | $ cht.sh go zip lists  |
| go/for   go/func       | | cht.sh> help           | | Ask any question using |
| $ cht.sh go/for        | | ...                    | | cht.sh or curl cht.sh: |
| ...                    | |                        | | /go/zip+lists          |
|                        | |                        | | (use /,+ when curling) |
|                        | |                        | |                        |
+---- TAB-completion ----+ +-- interactive shell ---+ +- programming questions-+
+------------------------+ +------------------------+ +------------------------+
| $ curl cht.sh/:help    | | $ vim prg.py           | | $ time curl cht.sh/    |
| see /:help and /:intro | | ...                    | | ...                    |
| for usage information  | | zip lists _            | | real    0m0.075s       |
| and README.md on GitHub| | <leader>KK             | |                        |
| for the details        | |             *awesome*  | |                        |
|            *start here*| |                        | |                        |
+--- self-documented ----+ +- queries from editor! -+ +---- instant answers ---+
                                                                                
[Follow @igor_chubin for updates][github.com/chubin/cheat.sh]                   
[root@master ~]# 

 

posted @ 2019-07-26 13:20  Eren.li  阅读(276)  评论(0编辑  收藏  举报
liweiming0611@163.com
等待有三大特征:
清晰的目的、努力达成的过程、充满不确定性的结果
因上努力,果上随缘
求其上,得其中;求其中,得其下;求其下,无所得