In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "how to find the directory where the installation package is located under the Linux system". In the operation of the actual case, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. The which command finds out whether the relevant command is already in the search path. The example is as follows:
The code is as follows:
$which gcc / / shows the directory in which GNC's C compiler is installed
The returned result is:
The code is as follows:
/ usr/bin/gcc
Note: if which doesn't find the command you're looking for, try whereis, which searches for a wider range of system directories. The which command on some systems does not display files for which the user does not have execute permissions. For example
The code is as follows:
$which ipppd
/ usr/bin/which: no ipppd in (/ bin:/usr/ bin:/ sbin:/usr/sbin)
$whereis ipppd
Ipppd: / usr/sbin/ipppd
$ls-l / usr/sbin/ipppd
-rwx- 1 root root 124924 Feb 3 2000 / usr/sbin/ipppd
2. Locate command.
The locate command, which is used to find files, is faster than the find command, and it requires a database that is set up by a daily crontab program. When we have set up the database, we can easily search for the required documents.
That is, run it first: updatedb (no matter which directory it is, can be placed in crontab), and then generate a slocate.db database under / var/lib/slocate/ to quickly find it. Just execute the # updatedb command directly from the command prompt.
The code is as follows:
$locate signal.h
/ usr/include/asm/signal.h
/ usr/include/linux/signal.h
/ usr/include/signal.h
/ usr/include/sys/signal.h
3. Rpm
If users know the name of the package they want to find, they can use the following command directly. This command is valid only on linux versions that support rpm, such as redhat,centos,fedora and suse.
The code is as follows:
$rpm-Q python / / find and check if python is installed on the system
Python-1.5.2-27
Or:
The code is as follows:
$rpm-qa | grep python / / this is a combination of two commands
Other uses of rpm:
Rpm-qa (list all installed packages)
Rpm-e package (delete a package)
Rpm-qi package (query a package)
Rpm-qf command (query the package name according to the program)
Rpm-ql package (query all installation files of a package)
4.yum
Yum has a number of parameters, and the following is the command to find the package. But it only supports specific hairstyle versions, the most commonly used commands under centos.
The code is as follows:
$yum list / / lists the specified software package, followed by the name of the software package you want to find
$yum linst installed / / lists all installed software packages
$yum info installed / / lists all installed software packages
5.whereis
Whereis is the directory where files or commands are found
The code is as follows:
# whereis pwd / / find the directory where the pwd command is located
6. Find
This command can be used to find out whether the system has a specified package installed or, more importantly, to find a package whose name you don't remember clearly. And I think this is supported by all linux and unix. Find search range is very wide, powerful, coupled with regular expression, the effect is very good, but it is recommended to narrow the search scope as far as possible, reduce system pressure, after all, when there are more system files, the search takes time and resources.
The code is as follows:
$find /-name "python" / / start from the root directory to find files and folders that contain the character "python".
Examples of detailed use of find are as follows:
# find. -maxdepth 1-name * .jpg-print-exec convert looks in the current directory with a depth of one, finds files ending in .jpg, and converts them
# find /-name * .rpm-exec chmod 755'{}'\; search for files ending in '.rpm' and define their permissions
# find /-name file1 enters the root file system from'/'to search for files and directories
# find /-perm-Utility lists all files in a system that are controlled by SUID
# find /-user user1 searches for files and directories belonging to user 'user1'
# find /-xdev-name\ * .rpm searches for files ending in '.rpm' and ignores removable devices such as CD-ROMs and Agile drives
# find / home/user1-name'* .txt'| xargs cp-av-- target-directory=/home/backup/-- parents finds and copies all files ending in '.txt' from one directory to another directory
# find / home/user1-name\ * .bin searches for files ending with '.bin' in the directory'/ home/user1''
# find / usr/bin-type f-atime + 100 search for execution files that have not been used in the past 100 days
# find / usr/bin-type f-mtime-10 searches for files that have been created or modified within 10 days
# find / var/log-name'* .log'| tar cv-- files-from=- | bzip2 > log.tar.bz2 finds all files ending in '.log' and makes them into a bzip package
This is the end of the content of "how to find the directory where the installation package is located under the Linux system". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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.