In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
System user
PS1 defines the format of the prompt, for example:
The current user name of PS1=XXX will be temporarily modified.
Echo $PS1
[\ u@\ h\ W]\ $/ / u represents the user, h hostname W current folder
# Administrator
$ordinary user
Command type: when we enter a command, it will pass it to kernel,kernel through shell to determine the type of command
Internal instructions: the kernel that comes with the kernel has its own
External directives: files installed by GUN file
Check the location where internal instructions are stored
Ll vmlinuz-3.10.0-327.el7.x86_64-h
/ / h indicates that it is in line with the human way of viewing, and it is convenient to view the size of the data. This kernel is only 4.1m. All the built-in commands are included here
Comparison of type which commands
Type: used to display the type of specified command and to determine whether the instruction given is an internal instruction or an external instruction. From the above picture, we can see that who is an external instruction and type is an internal instruction.
The which command is used to find and display the absolute path of a given command, and the environment variable PATH holds the directory that needs to be traversed to find the command. The which command looks for files that match the criteria in the directory set by the environment variable $PATH. That is, using the which command, you can see whether a system command exists and where the command is being executed.
By comparison, we can know that which can only find external instructions, not internal instructions.
Add:
Which view the location of the executable file
Whereis view the location of the file
Locate works with database to view file location
Find actually searches the hard disk to query the file name
Which: find the executable file in this path through the PATH environment variable, so the basic function is to find the executable file
Whereis
Parameters.
-b: only look for binaries
-m: only look for files under the manual path of the description file
-s: only look for source source files
-u: a file with no documentation
For example: whereis passwd
Passwd: / usr/bin/passwd / etc/passwd / usr/share/man/man1/passwd.1.gz / usr/share/man/man5/passwd.5.gz / / find out all the files related to the passwd file
Compared with find, whereis search is very fast, this is because the linux system will record all the files in the system in a database file, when using whereis and the following locate, it will look for data from the database, instead of traversing the hard disk to find, as the find command does, it will naturally be very efficient.
However, the database file is not updated in real time, and by default it is updated once a week, so when we look for files with whereis and locate, we sometimes find the data that has been deleted, or the file has just been created, but cannot find it, because the database file has not been updated.
Locate
Locate file or directory name
For example: locate passwd
/ home/weblogic/bea/user_projects/domains/zhanggongzhe112/myserver/stage/_appsdir_DB_war/DB.war/jsp/as/user/passwd.jsp
/ home/weblogic/bea/user_projects/domains/zhanggongzhe112/myserver/stage/_appsdir_admin_war/admin.war/jsp/platform/passwd.jsp
/ lib/security/pam_unix_passwd.so
/ lib/security/pam_passwdqc.so
/ usr/include/rpcsvc/yppasswd.x
.
Find
Parameter description:
Time lookup parameters:
-atime n: list the files accessed within 24 hours
-ctime n: list the files or directories that have been changed or added within 24 hours
-mtime n: list the files or directories that have been modified within 24 hours
-newer file: list files that are newer than file
Name lookup parameters:
-gid n: find files with group ID n
-group name: look for files with group name name
-uid n: find the file whose owner ID is n
-user name: look for a file with the user name name
-name file: look for a file named file (wildcards can be used)
For example: find /-name who
Supplementary summary: when we can not find the files we need with whereis and locate, we can use find, but find is traversing the hard disk, so it consumes a lot of hard disk resources, and the efficiency is also very low, so it is recommended that we give priority to using whereis and locate.
Locate is searched in the database, which is so large that it is updated once a day.
Whereis can find executable commands and man page
Find is to find files based on conditions.
Which can find executable files and aliases (alias)
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.