Information about linux software

Пять терминальных программ для вывода информации о дистрибутиве Linux

Мы уже говорили с вами о том, как смотреть информацию о дисках и оперативной памяти в дистрибутивах Линукс. Но подобные утилиты и команды более пригодны для использования на серверах и имеют узкую сферу использования, тесно связанную с системным администрированием.

Что делать обычным пользователям, если они хотят получить определенную информацию о своем дистрибутиве, но не имеют желания смотреть на все эти Memory, Swap и прочие «человекоудобные выхлопы»?

Если вы еще не подписались на обновления канала Просто Код в Телеграме, то самое время сделать это. Для чего? После подписки вы будете получать уведомления о выходе новых материалов быстрее, чем их присылает Дзен.

Правда в терминале

Терминал все равно придется использовать, так как именно с него вывод информации выглядит красивше и прям по-хакерски. Кроме того, все утилиты, про которые дальше пойдет речь нужно отдельно устанавливать, так как они не идут «из коробки». Правда мы с вами уже знаем, как на дистрибутивах с различной пакетной базой устанавливать программы из терминала или собирать их из исходного кода. Значит с последующей установкой проблем не возникнет, правда?

Neofetch

Первой в нашем списке идет простая утилита, написанная на Bash и предназначенная для вывода информации о программном и аппаратном обеспечении вашего дистрибутива. «Выхлоп» приятен взгляду: выводится логотип вашего дистрибутива в формат ASCII и краткая информация о дистрибутиве. После первого запуска утилиты создается конфигурационный файл, в котором можно поменять логотип и вывод информации. «Выхлоп» утилит прост и понятен для любого пользователя.

Источник

How to query files, packages, and repositories in Linux

How to query files, packages, and repositories in Linux

Having some experience with Linux, you probably know that you can’t just share a command or a utility between systems. The reason that you can’t simply copy an executable from one system to another is because of dependencies, such as libraries and other supporting packages. Some utilities certainly can be copied but this isn’t universally so. If you’ve forgotten which package you installed that included the nslookup command, for example, you need a way to find it.

Читайте также:  Создать бэкап системы linux

Great Linux resources

Furthermore, once you find the package that a command belongs to, you might want to find out from which repository you installed the package. The basic repositories of AppStream, BaseOS, and Extras contain a lot, but certainly not all of the packages you might need or encounter. In this article, I explore some methods of querying the system to find related repositories, packages, and commands.

  • Packages contain commands, utilities, and libraries
  • Packages have dependencies
  • Repositories contain, store, and provide packages

Classifying the file type

Is the utility you’re using a script, plain text, or a command? Is it compiled? What is the file’s location? You might want some basic information about the utility. The which command locates a file if it’s in your path. You will need to locate a file before you can further identify it.

To display file type information, the file command is indispensable.

$ file mtr mtr: cannot open `mtr' (No such file or directory) $ file /usr/sbin/mtr /usr/sbin/mtr: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=d34479cefafe7299b65d8375769c63978c6c453f, stripped, too many notes (256) 

The first attempt failed because the file command doesn’t know the location of the mtr command. After the full path is given to file , the information is displayed.

Here is an example of an executable file that is not compiled.

$ file /usr/sbin/ifcfg /usr/sbin/ifcfg: POSIX shell script, ASCII text executable

As you can see, the file command is an important one to know and one which you’re sure to use throughout your career.

Finding the package

The nslookup command is one that you use frequently but it isn’t installed on any of the systems at your new job. You want to install it but you can’t remember which package contains it and attempting to install it as nslookup fails.

# dnf -y install nslookup Last metadata expiration check: 2:44:51 ago on Tue 10 Nov 2020 03:27:27 PM CST. No match for argument: nslookup Error: Unable to find a match: nslookup

To find the package that contains nslookup , you can perform a «reverse» lookup using the rpm command.

# rpm -qf nslookup error: file /root/nslookup: No such file or directory

What’s wrong here? The rpm command can’t find nslookup but it’s installed because you’ve used it. Wait. Look at the path: /root/nslookup . There’s no nslookup command in your current (root’s home) directory. Locate nslookup using the which command and then issue the rpm command.

# which nslookup /usr/bin/nslookup # rpm -qf /usr/bin/nslookup bind-utils-9.11.13-6.el8_2.1.x86_64

You see that nslookup is part of the bind-utils package. Now you can copy it to your other systems and use it as you normally would.

 # nslookup google.com /opt/nslookup: error while loading shared libraries: libdns.so.1107: cannot open shared object file: No such file or directory

The error tells you that the nslookup command has dependencies that haven’t been met on the new system you’ve copied it to. The solution is to install it individually onto each system using DNF/YUM.

Читайте также:  Права доступа 600 linux

Revealing package dependencies

You really like the nslookup command, and you’d like to have it available on all of your systems. You realize after a failed attempt that you can’t simply copy it to another system and expect it to work. After much research, you discover that the nslookup command has several dependencies that must be met. What are those dependencies?

# dnf deplist nslookup Last metadata expiration check: 3:00:24 ago on Tue 10 Nov 2020 03:27:27 PM CST.

Does this mean there are no dependencies for nslookup ? No. It means that you attempted to find dependencies for a command rather than for a package.

# dnf deplist bind-utils Last metadata expiration check: 0:00:14 ago on Tue 10 Nov 2020 06:29:37 PM CST. package: bind-utils-32:9.11.13-6.el8_2.1.x86_64 dependency: /usr/libexec/platform-python provider: platform-python-3.6.8-23.el8.i686 provider: platform-python-3.6.8-23.el8.x86_64 dependency: bind-libs(x86-64) = 32:9.11.13-6.el8_2.1 provider: bind-libs-32:9.11.13-6.el8_2.1.x86_64 *** longer list of dependencies *** dependency: rtld(GNU_HASH) provider: glibc-2.28-101.el8.i686 provider: glibc-2.28-101.el8.x86_64 

Remember that packages have dependencies. Listing dependencies can be valuable if you want to satisfy them manually or if you think that new dependencies might interfere with or be incompatible with packages and dependencies already installed on your system.

Identifying the repository

You saw a fellow sysadmin using the hardware information tool ( hwinfo ) command on her system. You try the command on your system but you receive a «command not found» error. You then attempt to install it.

# dnf -y install hwinfo Last metadata expiration check: 0:09:34 ago on Tue 10 Nov 2020 06:42:15 PM CST. No match for argument: hwinfo Error: Unable to find a match: hwinfo

You ask your coworker to tell you where she got the hwinfo package. She performs the following query to find its source.

# dnf list hwinfo Last metadata expiration check: 0:11:17 ago on Tue 10 Nov 2020 06:42:15 PM CST. Installed Packages hwinfo.x86_64 21.47-9.el8 @epel 

You note that the source appears to be a repository identified as epel . You further ask her to tell you how to set up the epel repository. She remembers that epel is actually an installable RPM package but doesn’t remember its full name. She performs the following query to identify it.

# rpm -qa |grep epel epel-release-8-8.el8.noarch

Now you can install the epel-release package and then install the hwinfo package.

Читайте также:  Synchronize folders in linux

Note: The epel-release repository is the Extra Packages for Enterprise Linux repository configuration and is the first thing I install on any new system I encounter that doesn’t have it.

Wrapping up

Linux provides its administrators with a lot of handy utilities and commands to find information about the system and its components. You need to add these commands and utilities to your sysadmin toolbox. As you can see from this article, you don’t need to know a command’s every obscure option to get what you need. Use man pages for those.

Источник

Оцените статью
Adblock
detector