As you may already know, when we run an unavailable or unrecognized command in Linux, we will get an error message - "bash: command not found". The problem is some of us don't know which packages provides that particular command. Not anymore! Today, I've come across an useful utility called "command-not-found" that helps you by suggesting installation of packages when running an unavailable command in Linux.
For instance, let us say you want to run a command named "leafpad", which is not available in your Linux system. You are not sure which packages provides this command. This is where "command-not-found" utility comes in help.
The command-not-found utility will automatically search the official repositories, when entering an unrecognized or unavailable command. It uses a cache of existing programs and their associated packages to help users in their day-to-day command line work.
Install command-not-found Utility in Linux
The 'command-not-found' utility is available in AUR. So, you can install it using AUR helpers such as Paru or Yay.
$ paru -S command-not-found
Or,
$ yay -S command-not-found
Also, pkgfile package provides command-not-found hook. Just install pkgfile to use command-not-found utility.
$ sudo pacman -S pkgfile
Once it is installed, edit your .bashrc file:
$ vi ~/.bashrc
Add the following line at the end to enable it.
source /usr/share/doc/pkgfile/command-not-found.bash
Update the changes made using command:
$ source ~/.bashrc
On Ubuntu and its derivatives, it comes pre-installed.
Just in case if it is not installed already, you can install it as follows.
$ sudo apt update $ sudo apt install command-not-found
The system-wide cache is empty. You may want to run 'apt-file update' as root to update the cache.
After installing it, you may need to run the following commands as root to update the system-wide cache.
$ sudo update-command-not-found $ sudo apt-file update
Suggest Package Installation When Command Not Found in Linux
Now, run any unavailable command, for example leafpad:
It will suggest you which package provides this command. Here is the output from my Arch Linux system.
<strong>$ leafpad</strong> Command 'leafpad' not found, but can be installed with: sudo snap install leafpad
As you see in the above output, the "leafpad" command is provided by leafpad-0.8.18.1-5 package.
Let us try another command on Ubuntu:
<strong>$ emacs</strong> The program 'emacs' can be found in the following packages: * emacs24 * emacs24-nox * e3 * emacs23 * emacs23-lucid * emacs23-nox * emacs24-lucid * jove Try: sudo apt-get install <selected package></selected>
This is just an example. This utility will suggest installation of packages when you run any unavailable command. Once you removed this utility, it won't suggest anything. It will simply display an output something like below.
"bash: emacs: command not found"
Hope this helps.
以上是命令 - 毫無根據:在Linux中為不可用的命令建議安裝程序包的詳細內容。更多資訊請關注PHP中文網其他相關文章!

創建圖形用戶界面(GUI)應用程序是使您的想法栩栩如生並使您的程序更加用戶友好的絕佳方法。 PygoBject是一個Python庫,允許開發人員使用Linux桌面上創建GUI應用程序

Arch Linux提供了靈活的尖端系統環境,是一種非常適合在小型非關鍵系統上開發Web應用程序的解決方案,因為是完全開源的,並且在內核上提供了最新的最新版本

由於其滾動釋放模型,該模型包含尖端軟件Arch Linux的設計和開發以作為服務器運行以提供可靠的網絡服務,因為它需要額外的時間進行維護,持續的升級和明智的FI
![12必備Linux控制台[終端]文件管理器](https://img.php.cn/upload/article/001/242/473/174710245395762.png?x-oss-process=image/resize,p_40)
Linux控制台文件管理器在日常任務,在本地計算機上管理文件時或連接到遠程時,可能非常有幫助。目錄的視覺控制台表示可以幫助我們快速執行文件/文件夾操作和SAV

Qbittorrent是一個受歡迎的開源Bittorrent客戶端,允許用戶通過Internet下載和共享文件。最新版本Qbittorrent 5.0最近發行了,並帶有新功能和改進。 本文將

以前的Arch Linux LEMP文章僅涵蓋了基本內容,從安裝網絡服務(NGINX,PHP,MYSQL和PHPMYADMIN)以及配置MySQL Server和PhpMyAdmin所需的最低安全性。 這個主題與形式嚴格有關

Zenity是一種工具,可讓您使用命令行在Linux中創建圖形對話框。它使用GTK,這是一種用於創建圖形用戶界面(GUI)的工具包,使您可以輕鬆地將視覺元素添加到您的腳本中。 Zenity可能非常

有些人可能將其描述為他們的激情,而另一些人可能認為這是緩解壓力或日常生活的一部分。在每種形式上,聆聽音樂已成為我們生活中不可分割的部分。音樂在我們的生活中扮演著不同的角色。 有時候


熱AI工具

Undresser.AI Undress
人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover
用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool
免費脫衣圖片

Clothoff.io
AI脫衣器

Video Face Swap
使用我們完全免費的人工智慧換臉工具,輕鬆在任何影片中換臉!

熱門文章

熱工具

WebStorm Mac版
好用的JavaScript開發工具

EditPlus 中文破解版
體積小,語法高亮,不支援程式碼提示功能

SecLists
SecLists是最終安全測試人員的伙伴。它是一個包含各種類型清單的集合,這些清單在安全評估過程中經常使用,而且都在一個地方。 SecLists透過方便地提供安全測試人員可能需要的所有列表,幫助提高安全測試的效率和生產力。清單類型包括使用者名稱、密碼、URL、模糊測試有效載荷、敏感資料模式、Web shell等等。測試人員只需將此儲存庫拉到新的測試機上,他就可以存取所需的每種類型的清單。

SublimeText3 Mac版
神級程式碼編輯軟體(SublimeText3)

Atom編輯器mac版下載
最受歡迎的的開源編輯器