In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail how to use aliases and binaries in Linux. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Binary system
The term general binary sounds unfathomable, but when you understand it, it's not complicated. Data is usually processed by binary in a computer.
Usually we count in the base of 10, for example, counting 1, 2, 3, 4, 5, 6, 7, 8, 9. Counting to 10:00 will cause the individual bit to become 0 and the ten bits into 1, because 9 / 1 has to be one into ten digits. The decimal system means that each digit of the number is the minimum of 0 and the maximum of 9. By the same token, binary means that each bit of a number is a minimum of 0 and a maximum of 1. How is a decimal 2 represented in binary? 1 to 1 means to enter a bit, and for binary, 1 to 1 to 10, pay attention! The ten here is not a decimal ten. Of course, the principle of binary subtraction is the same as decimal subtraction, 10-1-1, because 0 minus 1, so you have to borrow a bit to complete this operation. We all know that there are two states in 0 and 1, and there are two states in one person. If there are two, there are four kinds of states: 00, 01, 10, 11, and 11. Then the relationship between several bits and several states is to the power of 2 (2 ^ n), for example:
The power of 0 of 2 is 1 (the power of 0 of any number is meaningless to the power of 0 of 0)
The power of 2 is 2.
The second power of 2 is 4.
The third power of 2 is 8.
The fourth power of 2 is 16.
The fifth power of 2 is 32
The sixth power of 2 is 64.
The seventh power of 2 is 128
The eighth power of 2 is 256
The ninth power of 2 is 512.
The tenth power of 2 is 1024.
N represents the number of bits in binary
2 ^ N combinations
The maximum is: 2 ^ N-1.
Of course, you can use the calculator under bc,Linux if you really don't know how to do the math. Can support binary conversion.
Linux alias
1. Define
Alias, English alias. It means just like our nickname, it is also a command nickname. Of course, in the Linux system, there is also a tool called alias, which allows us to take a nickname for a command that is a nickname, that is, an alias, that is, a command that is often used, which allows us to use its alias to operate some complex commands or longer commands in the future.
For example: a file we often use, the cd / etc/sysconfig/network-scripts/ command is very long. Is it a waste of time if you have to type this long every time you want to enter this file? Then we can define an alias for it, such as cdnet (of course, you can choose to remember this by yourself). Of course, we can first check whether there is any repetition of the alias or command "cdnet". The alias we define had better not conflict with the alias already defined by the system and some commands of the system. We can enter the name you want to set. Now I want to set cdnet. You can enter cdnet and enter enter. See if there is this command, prompt that you can not find this command, then you can use cdnet to define this alias, of course, we can also enter the command "alias", we can see which aliases we have defined, and the permanent aliases we add in the future will also be saved in this. Now that we are prompted that there is no cdnet command or alias, we can use this to create an alias with alias cdnet='cd / etc/sysconfig/network-scripts/', and then you type cdnet, which is exactly the same command as you type cd / etc/sysconfig/network-scripts/. Isn't that much more convenient?
As shown in the figure:
two。 Save
Of course, it is OK now, but if you quit, it will be gone. If you want to keep it permanently, you also need to write this command into the text, usually defined in your own home directory, because everyone's personal habits are different and the aliases defined are different, so you can create your own habitual aliases. You can see a directory, .bashrc, with ls-a. We need to just create the alias command into the .bashrc directory, enter the command nano .bashrc into this text, copy the newly created command in its order or in its order, CTRL+o save, and then exit CTRL+x, generally just define the alias will not take effect immediately, generally direct exit exit can take effect immediately, you can also use. To take effect immediately, enter. The .bashrc takes effect, and then you can use alias to view the alias you just created.
As shown in the figure:
3. cancel
And if you need to cancel an alias, or do not want the alias, you can use the unalias command to delete it, such as the alias we just created, I don't want it, you can type unalias plus the alias you want to delete, unalias cdnet, and then make sure, the alias you just created is gone, you can check it by typing alias, and another command is to delete all aliases The command unalias-a deletes all aliases. Of course, this deletion must only be a temporary deletion. If you quit, you will restore it. If you really want to delete it, just as you did when you first created it, go to the nano .bashrc directory, delete the aliases you don't want directly, and then save them. There will be no more when you check out.
As shown in the figure:
Use the command
Alias view all aliases
Unalias delete alias
Alias + name = commands that want to change aliases modify aliases
Unalias-a deletes all aliases
Nano text editing
Ls to view the file name under the directory
Ls-a view hidden names
Cd changes directories
Exit exit
Bc calculator
Scale=3 decimal point
Ibase=10 represents the base in which you enter numbers
Obase=2 represents the base in which you output numbers.
This is the end of the article on "how to use aliases and binaries in Linux". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, please share it for more people to see.
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.