찾다
시스템 튜토리얼리눅스명령-창립 : Linux에서 사용할 수없는 명령에 대한 패키지 설치 제안

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>

명령-창립 : Linux에서 사용할 수없는 명령에 대한 패키지 설치 제안

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 중국어 웹사이트의 기타 관련 기사를 참조하세요!

성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
pygobject를 사용하여 Linux에서 GUI 애플리케이션을 만드는 방법pygobject를 사용하여 Linux에서 GUI 애플리케이션을 만드는 방법May 13, 2025 am 11:09 AM

그래픽 사용자 인터페이스 (GUI) 응용 프로그램 작성은 아이디어를 활성화시키고 프로그램을보다 사용자 친화적으로 만들 수있는 환상적인 방법입니다. PygoBject는 개발자가

아치 리눅스에서 phpmyadmin으로 램프 스택을 설치하는 방법아치 리눅스에서 phpmyadmin으로 램프 스택을 설치하는 방법May 13, 2025 am 11:01 AM

Arch Linux는 유연한 최첨단 시스템 환경을 제공하며 소규모 비 크리티컬 시스템에서 웹 애플리케이션을 개발하는 데 강력하게 적합한 솔루션입니다.

Arch Linux에 Lemp (Nginx, Php, Mariadb)를 설치하는 방법Arch Linux에 Lemp (Nginx, Php, Mariadb)를 설치하는 방법May 13, 2025 am 10:43 AM

최첨단 소프트웨어를 수용하는 롤링 릴리스 모델로 인해 Arch Linux는 유지 보수, 지속적인 업그레이드 및 현명한 FI를위한 추가 시간이 필요하기 때문에 신뢰할 수있는 네트워크 서비스를 제공하기 위해 서버로 설계 및 개발되지 않았습니다.

12 Linux 콘솔 [터미널] 파일 관리자12 Linux 콘솔 [터미널] 파일 관리자May 13, 2025 am 10:14 AM

Linux 콘솔 파일 관리자는 일상적인 작업, 로컬 컴퓨터에서 파일을 관리 할 때 또는 원격 제품에 연결할 때 매우 도움이 될 수 있습니다. 디렉토리의 비주얼 콘솔 표현은 파일/폴더 작업 및 SAV를 신속하게 수행하는 데 도움이됩니다.

QBITTORRENT : 강력한 오픈 소스 비트 토렌트 클라이언트QBITTORRENT : 강력한 오픈 소스 비트 토렌트 클라이언트May 13, 2025 am 10:12 AM

QBITTORRENT는 사용자가 인터넷을 통해 파일을 다운로드하고 공유 할 수있는 인기있는 오픈 소스 비트 토렌트 클라이언트입니다. 최신 버전 인 QBITTORRENT 5.0은 최근에 출시되었으며 새로운 기능과 개선 사항이 제공됩니다. 이 기사는 할 것입니다

아치 Linux에서 Nginx Virtual Hosts, Phpmyadmin 및 SSL 설정아치 Linux에서 Nginx Virtual Hosts, Phpmyadmin 및 SSL 설정May 13, 2025 am 10:03 AM

이전 Arch Linux Lemp 기사는 네트워크 서비스 설치 (NGINX, PHP, MYSQL 및 PHPMYADMIN)와 MySQL Server 및 PhpmyAdmin에 필요한 최소 보안 구성에서 기본 사항을 다루었습니다. 이 주제는 엄격하게 Forme과 관련이 있습니다

Zenity : 쉘 스크립트에서 GTK 대화 상자 구축Zenity : 쉘 스크립트에서 GTK 대화 상자 구축May 13, 2025 am 09:38 AM

Zenity는 명령 줄을 사용하여 Linux에서 그래픽 대화 상자를 만들 수있는 도구입니다. 그래픽 사용자 인터페이스 (GUI)를 만들기위한 툴킷 인 GTK를 사용하여 스크립트에 시각적 요소를 쉽게 추가 할 수 있습니다. Zenity는 매우 u 일 수 있습니다

Linux를위한 22 명의 최고의 음악 플레이어Linux를위한 22 명의 최고의 음악 플레이어May 13, 2025 am 09:25 AM

어떤 사람들은 그것을 그들의 열정으로 묘사 할 수도 있고, 다른 사람들은 스트레스 해소 자나 일상 생활의 일부로 생각할 수도 있습니다. 모든 형태에서 음악을 듣는 것은 우리 삶의 분리 할 수없는 부분이되었습니다. 음악은 우리 삶에서 다른 역할을 수행합니다. 때때로 그것은

See all articles

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

Video Face Swap

Video Face Swap

완전히 무료인 AI 얼굴 교환 도구를 사용하여 모든 비디오의 얼굴을 쉽게 바꾸세요!

뜨거운 도구

에디트플러스 중국어 크랙 버전

에디트플러스 중국어 크랙 버전

작은 크기, 구문 강조, 코드 프롬프트 기능을 지원하지 않음

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

Atom Editor Mac 버전 다운로드

Atom Editor Mac 버전 다운로드

가장 인기 있는 오픈 소스 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse용 SAP NetWeaver 서버 어댑터

Eclipse를 SAP NetWeaver 애플리케이션 서버와 통합합니다.