redhat_ Shortcut keys and shell command operations md

Time:2022-5-8
Tab key command automatic completion
history
! N execution history article n
!! Execute the previous command
! L last command starting with L
Alias the alias of the create command
Alias command alias = “command line”
Unlias cancel alias
CTRL + U command before cutting or deleting cursor
CTRL + y copy
Standard output redirection
Command > file} write the execution result of the command to a file by overwriting
Command > > File > writes the execution result of the command to a file in the form of append
Standard error output redirection
The command # 2 > file writes the command error execution result to the file in the mode of overwriting
Command 2 > > File > writes the command error execution result to the file in the form of append
Save command & > file at the same time command & > > saves the command execution results to the same file at the same time
Command 2 > > File > & 1: save standard output and standard error into a file
Command 1 | Command 2 the correct execution result of command 1 is the operation object of Command 2
Command 1; Command 2 multiple commands are executed in sequence, and there is no logical relationship between them
Command 1 & & Command 2 logic and command 1 are executed correctly, and Command 2 will be executed
Command 1 | Command 2 will be executed only if the logic of command 1 or command 1 is not executed correctly
Echo outputs the variable name of $and adds $when calling the variable
In Bash, the} variable is string by default
Superposition of variables AA = 123
          aa=”$aa”456       123456
          aa={aa}1111       1234561111
” is equivalent to $()
Setting environment variables
Export declares variables for access
Unset delete (cancel) variable
Env query variable
\U displays the current user name
\W displays the last directory of the current directory
\H displays the abbreviated host name
\$prompt
\W displays the full name of the current directory
Read input

Recommended Today

The map function of the implementation object is similar to array prototype. map

//Implement a map function const targetData = { a:2, b:3, c:4 } const objMap = (obj,fn)=>{ if(typeof fn !==”function”){ throw new TypeError(`${fn} is not a function !`); } return JSON.parse(JSON.stringify(obj,fn)); } const tempArr = objMap(targetData,(key,value)=>{ if(value%2===0){ return value/2 } return value }) console.log(tempArr)//{a: 1, b: 3, c: 2, d: 5} JSON.stringify() JSON. Stringify (value, replace, […]