In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
The basic concept of 1FHS
FHS file system hierarchy standard, why do we have to respect this standard, why does windows not have this standard? Because windows has a registration list, it can help windows locate the location of the program. Linux doesn't have a registration list, so how do we find our running program? Well, we define a standard installer directory and the location of the various parts of the program.
How do you define it?
/ boot placement bootstrap
/ lib places 32-bit library files
/ lib64 installs 64-bit library files
/ bin executable file
Directory of / etc configuration file
Location of / dev device file
/ usr some large program placement locations
/ usr/local is generally used to put compilers
/ usr/bin executable file
/ usr/share/man man document
/ var system running temporary files and logs and some program data storage location
/ data file of srv service program
/ proc pseudo file, memory simulates the configurable part into a file
/ sys new memory simulation file
/ tmp junk file
This is more suitable for system administrators than placing files like windows, so the permissions of files are easier to manage, because similar files in the same directory, the files with the same attributes are placed in the same directory to the maximum extent, which is more convenient to limit permissions.
Note: with the popularity of microservices today, I feel that the way windows manages files is more suitable for servers, because each server runs only one service, so we are more likely to compile and install software, squeezing computer computing resources to the maximum extent, and compiling and installing files will be in the same directory.
Characteristics of 2bash and human-computer interaction 1) the flow of commands used by bash
I typed a command on the command line. Why did I reply to our results so quickly? how did bash find the command? Let me introduce how bash finds the command.
First of all, we have to understand that when bash runs, it is all in memory. At this time, when bash receives a command, bash is like a person, first of all, to see if one of his own people has qualified to check the functions embedded in himself, and then call those who are not his own. At this time, external orders began to compete for this position. When there are so many people, which one we choose, of course, we choose the one that is close to us. OK, we define people who are intimate with me in $PATH, and people who are not in close relationships must not be used, in case Lao Song comes to us how dangerous it is.
Closeness is generally divided into several layers. Well, we define multiple person selection paths for $PATH. Execute the following command to check the order in which $PATH is called. The priority is from front to back:
# echo $PATH
/ usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
And alias, this is even more amazing, just like the president of the party school must be the next generation of leaders. It takes precedence over internal commands. To sum up, the order in which commands are executed is alias- > built-in commands-> external commands.
2) Hash command path cache
The rich second generation is always around us, and the official second generation is NB. People are not in harmony with each other at all. Tsinghua and Peking University have left a place for them. Since we can no longer be the second generation, we will open a sectarian school to become the first generation. The same is true of Linux. There is a hash mechanism in linux. When we execute a command, bash saves the path where we execute the program.
Execute the bash command to view the commands that have been cached:
# hash
Hits command
1 / usr/bin/tty
1 / usr/bin/abrt-cli
1 / usr/bin/date
1 / usr/bin/mv
1 / usr/bin/mkdir
The execution result of this command may vary from person to person, and the above is the result of my execution of the hash command. Since it is caching, then there will be a problem, why? Because after alleviating the contradiction, the contradiction still exists, but it is sugar-coated, and half of the candy will be scratched into the mouth.
When the command I execute changes position and the cache does not change, I can't find the command. What to do, cold salad. Manually delete the cache yourself.
Hash-d Name deletes a cache
Hash-r Name clear cache
Note: the Name here is an alias for the command.
3) history command history
Now many browsers record browsing records, and what's worse, they can find their earlier history on the Internet, which is terrible. Our actions have been recorded, and we can't delete them. Google's artificial intelligence uses these data to train machines, and now the one at the forefront of artificial intelligence is not alphago's google, but ibm. While alphago is still trying to earn enough attention, ibm's Watson has already made a lot of money for Tencent. Every year, Tencent has Watson to analyze each game, place reasonable advertisements and charge members' fees. NBA is familiar to all of you, and an organization began to use Watson to arrange the daily training volume of each player. For example, one day of James, James needs to go home to visit his grandmother today. Watson will help James buy the plane and ticket, and then arrange his meals according to James's muscle state and the type of exercise today. And arrange for James to do what he needs to do before departure, and then evaluate the amount of exercise James may have in the days when he gets home. A coach will be arranged to accompany him to ensure that his training volume and the player's motivation to continue training must be done after the game, which is also included in Watson's calculation and specifies the scope to go. Maximum protection of players' safety, 23333. Otherwise, most of the players go bankrupt soon after they don't play, because Watson is gone (a wave of conspiracy theories). There is also an artificial intelligence history in Linux.
Executing the history command directly displays the entire command history of the current system.
If we do not exit the terminal History normally, our command history will not be saved, because when we execute the command, the command history will be saved in memory by default, and set the number of entries in memory to save the command history in $HISTSIZE, and specify the number of entries in the command save file in $HISTFILESIZE.
With the command history, we can easily invoke the previous command:
!! Execute the previous order
! # execute Article # command
History-c emptying command history
History-a saves commands from the command history to a file
In addition, we define the format in which history is saved in the user's home directory.
HISTSIZE: number of command history entries
HISTFILE: specify a history file. Default is ~ / .bash_history
HISTFILESIZE: the number of entries recorded in the command history file
HISTTIMEFORMAT= "% F% T" display time
HISTIGNORE= "str1:str2: …" Ignore string1,string2 history. Glob is supported here.
Controls how command history is recorded:
Environment variable: HISTCONTROL
Ignoredups defaults to ignore duplicate commands, and "repeat" is consecutive and identical.
Ignorespace ignores all commands that start with white space
Ignorebothignoredups, ignorespace
Erasedups removes duplicate commands
4) the commonly used shortcut keys of bash
Press table if you have nothing to do, press it to be healthier.
Ctrl+c forcibly interrupts the execution of the command
Ctrl+d interrupts command execution
Ctrl+l screen cleaning
Ctrl+z puts the command process in the background to execute.
Ctrl+a moves the cursor to the beginning of the line
Ctrl+e moves the cursor to the end of the line
Ctrl+k deletes the characters after the cursor
Ctrl+u deletes the character before the cursor
3 Summary
Bash calls command order alias- > built-in commands-> external commands. Bash caches the command execution path with hash, records the command history with history, the command history is saved in memory, when we exit the terminal, the command history is saved to a file, and bash also has some shortcuts.
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.