In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
I. Foundation of shell
II. History of orders
The commands we have used, that is, the command history, are stored in the system home directory / root/.bash_history history command can view the command history used. The system defaults to 1000.
History-c clears the command history in memory, but not the commands in / root/.bash_history
Note: only when you exit the terminal normally, the typed command will be saved to / root/.bash_history.
The environment variable HISTSIZE can customize the number of command history entries in / etc/profile. You can find the HISTSIZE parameter by vi / etc/profile, modify it, and execute the command source / etc/profile.
Modify the command history format and add time options to view it more intuitively.
HISTTIMEFORMAT= "Y/%m/%d H:%M:%S"
This format is only valid on the current terminal. If you want to apply it to other terminals, you need to edit the configuration file vi / etc/profile and add HISTTIMEFORMAT= "% Y/%m/%d% H:%M:%S" to the configuration file.
If you want to keep the history of the command permanently, it will not be deleted by others. Chattr + a ~ / .bash_history can only be appended, not deleted.
!! Indicates the execution of the last command
! N (represents a number)
! History, you will find the last command that begins with history in the command history
III. Command completion and aliases
Press the tab key once to complete a command, a file, or a directory. If you press the tab key twice in a row, all commands or file names will be listed. The parameters are automatically completed in centos7. You need to install the package bash-completion; and restart the system to take effect.
We can use alias to set an alias for a commonly used but long command. If you don't want to use it, you can use unalias to cancel the alias, and execute alias directly to view all aliases.
Alias storage path:
The first one is stored in the home directory .bashrc file.
The second is stored in the colorgrep.sh colorls.sh in the / etc/profile.d directory, customized in these scripts.
Unalias cancel alias, format unalias alias_name
IV. Wildcard characters
Wildcard *, which indicates zero or more characters
Wildcards? That represents any character
Brackets [] ls [0-9] .txt denotes any .txt file within the range of 0-9.
Curly braces {}, ls {1pm 2je 3} denotes any txt file in parentheses
Input and output redirection
Cat 1.txt > 2.txt, greater than sign > means to input the output of the previous command directly into the following file. Here, the content of 1.txt is redirected to 2.txt. The content of 2.txt will be deleted before.
Cat 1.txt > > 2.txt. Two greater than signs indicate appending. The contents of the previous 2.txt will not be deleted, but the contents of the 1.txt will be appended to the 2.txt.
The ls asas 2 > a.txt greater than sign indicates that the error message generated by the command is entered into a file.
Ls asdfgh 2 > > a.txt, which means that the error message is appended and redirected
Ls {1 a.txt 2} .txt bc.txt & > txt 2 > b.txt indicates that correct and incorrect information is entered into the a.txt
Ls {1 bc.txt 2} .txt bc.txt & > a.txt, which means that both correct and incorrect output information is appended to the a.txt
Ls {1 a.txt 2} .txt bc.txt > txt 2 > b.txt means that the correct output information is input into a.txt, and the wrong output information is input into b.txt.
Wc-l
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.