grep

Grep [-acinv] [–color=auto]

  • -a: Search binary files in text format
  • -c: counts the number of times the ‘search string’ is found
  • -i: ignores the difference of case, so case is regarded as the same
  • -n: Outputs the line number
  • -v: reverse selection, that is, show the line that has no ‘search string’ content!
  • –color=auto: you can add color to the keyword part of the display!

awk

awk ‘{pattern + action}’ {filenames}

sed

Sed [-nefr] [action]

Options and parameters:

  • -n: The mode is silent. In normal sed usage, all data from STDIN is generally listed on the terminal. With the -n argument, however, only sed lines (or actions) will be listed.
  • -e: Directly edits sed action in command line mode.
  • -f: writes the sed action in a file. -f filename runs the sed action in filename.
  • -r: The action of sed supports the syntax of extended normal notation. (Default is basic normal syntax)
  • -i: directly modifies the read file content rather than output it to the terminal. [n1[,n2]]function
  • For example, if my action is between 10 and 20 lines, then “10,20[action behavior]” function:
  • A: New, a can be followed by a string, which will appear on a new line (the current next line) ~
  • C: replace, c can be followed by a string, these string can replace n1,n2 line!
  • D: Delete. D: Delete.
  • I: insert, I can be followed by a string, which will appear on a new line (currently the previous line);
  • P: Print, or print out selected data. Normally p is run with the sed-n argument ~
  • S: Replace, can directly replace the work! Usually the action of this S can be paired with the formal notation! 1,20s/old/new/g

lsof

Default: no options, lsof lists all combinations of open files for active processes: you can group options together, such as -abc, but be careful which options require arguments

  • -a: Results are “and” (not “or”)
  • -l: displays the user ID instead of the user name
  • -t: Obtains only the process ID
  • -u: obtains the ADDRESS of the UNIX socket interface
  • -f: formats the output for other commands. Can be formatted in a variety of ways, such as -f PCFN (for process ID, command name, file descriptor, file name, and null-terminated)

curl

The debug class

  • -v, –verbose Displays information
  • -q, –disable. Curlrc is invalid after the first parameter is set. This parameter affects -k, — config-a, — user-agent-e, –referer
  • -k, –config FILE Specifies the configuration FILE
  • -l, –location Trace redirection (H)

CLI Display Settings

  • -s, –silent Silent mode. No task content is output
  • -s, –show-error Displays an error. In the -s option, curl is displayed when there is an error
  • -f, –fail Does not display HTTP error information when the connection fails
  • -i, –include Display response header (H/F)
  • -i, –head Displays only the response document header
  • -l, –list-only Lists only the names of FTP directories (F)
  • -#, –progress-bar Displays the transfer progress with the progress bar

Data transfer class

  • – X – request [GET | POST | PUT | DELETE |… Use the specified HTTP method, such as -x POST

  • -H, –header

    -h “Content-type: application/json”

  • -e, –referer Set referer (H)

  • -d, –data: Content-Type Application /x-www-form-urlencoded (H)

    — DATA-raw HTTP POST data (H)

    HTTP POST data (H)

    — data-urlenCode HTTP POST data (H)

  • -g, –get Send -d data using HTTP get method (H)

  • -f, –form <name=string>

    –form-string <name=string>

  • -u, –user user:password Specifies the user name and password, for example, admin:password

  • -b, –cookie Cookie file (H)

  • -j, –junk-session-cookies read files but ignore session cookies (H)

  • -a, –user-agent User-agent Settings (H)

Transmission set

  • -c, –continue-at OFFSET Indicates that the OFFSET is continued
  • -x, –proxy [PROTOCOL://]HOST[:PORT] Uses the proxy on the specified PORT
  • -u, –proxy-user user [:PASSWORD] Proxy user name and PASSWORD

File operations

  • -t, –upload-file Uploads a file
  • -a, –append Adds the file to be uploaded (F/SFTP)

Output Settings

  • -o, –output writes output to a file instead of stdout
  • -o, –remote-name writes the output to a remote file
  • -d, –dump-header writes header information to the specified file
  • -c, — The file location of the Cookies to be written after the cookie-jar operation is complete
wget

File parameters

  • -o,–output-file= file Saves software output information to a file;
  • -a,–append-output=FILE Appends software output information to a FILE;
  • -d,–debug Displays output information.
  • -q,–quiet Displays no output information.
  • -i,–input-file= file Fetch URL from file;

Download parameters

  • -t,–tries=NUMBER
  • -o –output-document=FILE Specifies the download directory and FILE name
  • -nc, –no-clobber Do not overwrite existing files
  • -n,–timestamping only downloads new files than local
  • -t,–timeout=SECONDS Sets the timeout period
  • -y,–proxy=on/off To disable the proxy

tail

  • Tail -n flilename Views the last few lines of a file
  • Tail -f filename Indicates the real-time monitoring file updates
  • Tail -f -s Checks file updates at an interval

head

Head displays the first 10 lines by default. Head-n displays the first N lines of the file. Head-n-line displays the first n lines except the line line

less

Page display -g only marks the last search keyword -i search is case-insensitive -m displays the percentage similar to more -n displays the line number of each line

find

Find [parameter] [path] [Search and search scope] -name Search by name -size Search by size -user Search by attribute -type Search by type -iname Ignore case

kill

Kill [parameter][process id PID]

  • -l Lists signals supported by the system

Common signals are as follows:

  • HUP 1 terminal is disconnected
  • INT 2 interrupt (same as Ctrl + C)
  • QUIT 3 QUIT (same as Ctrl + \)
  • 15 termination TERM
  • KILL 9 Forcibly terminate
  • CONT 18 continues (as opposed to STOP, fg/bg command)
  • STOP 19 Pause (same as Ctrl + Z)
  • -s Indicates sending signals to the process
  • -a The mapping between the command name and process NUMBER is not restricted when processing the current process
  • -p Indicates that the kill command prints only the process ids of related processes but does not send any signal

Regular expression

  • ^ what does it begin with, ^ BQH begins with BQH
  • What does $end with
  • ^$represents an empty line.
  • Example. Just represent the dot itself, escape the symbol, let the character with a special identity move, remove the vest, restore the prototype $
  • ^.* starts with any number of characters.
  • .*$Ends with any number of characters.
  • (.*) from the first character to the space stop,
  • [ABC] Matches any character in the set of characters
  • [^ ABC] matches any character that does not include ^; The ^ in brackets is the opposite of… The beginning difference.
  • A {n,m} repeated n to m times, the previous repeated character. Remove the slash if you use egrep/sed -r.
  • {n,} repeats the previous character at least n times. Remove the slash if you use egrep/sed -r.
  • {n} repeated n times, the previous repeated character. Remove the slash if you use egrep/sed -r.
  • ①^word search starts with word; I have enough vi ^ line open
  • ② Word search ends with word; Vi Search for words ending in word; Vi Search for words ending in word; Vi The beginning of a line
  • ③^$indicates blank line.

Extended regular expression: ERP (egrep or grep -e)

    • Repeat one or more preceding characters
  • ? A compound of zero or characters before a zero
  • | or ways to find more in line with the string
  • () Find the user Group string