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

Linux의 주요 용도에는 다음이 포함됩니다. 1. 서버 운영 체제, 2. 임베디드 시스템, 3. 데스크탑 운영 체제, 4. 개발 및 테스트 환경. Linux는이 분야에서 뛰어나 안정성, 보안 및 효율적인 개발 도구를 제공합니다.

인터넷은 단일 운영 체제에 의존하지 않지만 Linux는 이에 중요한 역할을합니다. Linux는 서버 및 네트워크 장치에서 널리 사용되며 안정성, 보안 및 확장 성으로 인기가 있습니다.

Linux 운영 체제의 핵심은 명령 줄 인터페이스이며 명령 줄을 통해 다양한 작업을 수행 할 수 있습니다. 1. 파일 및 디렉토리 작업 LS, CD, MKDIR, RM 및 기타 명령을 사용하여 파일 및 디렉토리를 관리합니다. 2. 사용자 및 권한 관리는 UserAdd, Passwd, CHMOD 및 기타 명령을 통해 시스템 보안 및 리소스 할당을 보장합니다. 3. 프로세스 관리는 PS, Kill 및 기타 명령을 사용하여 시스템 프로세스를 모니터링하고 제어합니다. 4. 네트워크 운영에는 Ping, Ifconfig, SSH 및 기타 명령이 포함되어 있으며 네트워크 연결을 구성하고 관리합니다. 5. 시스템 모니터링 및 유지 관리 Top, DF, Du와 같은 명령을 사용하여 시스템의 작동 상태 및 리소스 사용을 이해합니다.

소개 Linux는 유연성과 효율성으로 인해 개발자, 시스템 관리자 및 전원 사용자가 선호하는 강력한 운영 체제입니다. 그러나 길고 복잡한 명령을 자주 사용하는 것은 지루하고 응급실이 될 수 있습니다.

Linux는 서버, 개발 환경 및 임베디드 시스템에 적합합니다. 1. 서버 운영 체제로서 Linux는 안정적이고 효율적이며 종종 고 대전성 애플리케이션을 배포하는 데 사용됩니다. 2. 개발 환경으로서 Linux는 효율적인 명령 줄 도구 및 패키지 관리 시스템을 제공하여 개발 효율성을 향상시킵니다. 3. 임베디드 시스템에서 Linux는 가볍고 사용자 정의 가능하며 자원이 제한된 환경에 적합합니다.

소개 : Linux 기반의 윤리적 해킹으로 디지털 프론티어 보안 점점 더 상호 연결된 세상에서 사이버 보안이 가장 중요합니다. 윤리적 해킹 및 침투 테스트는 취약점을 적극적으로 식별하고 완화하는 데 필수적입니다.

기본 Linux 학습 방법은 다음과 같습니다. 1. 파일 시스템 및 명령 줄 인터페이스 이해, 2. LS, CD, MKDIR, 3. 파일 생성 및 편집과 같은 파일 작업 배우기, 4. 파이프 라인 및 GREP 명령과 같은 고급 사용법, 5. 연습 및 탐색을 통해 지속적으로 기술을 향상시킵니다.

Linux는 서버, 임베디드 시스템 및 데스크탑 환경에서 널리 사용됩니다. 1) 서버 필드에서 Linux는 안정성 및 보안으로 인해 웹 사이트, 데이터베이스 및 응용 프로그램을 호스팅하기에 이상적인 선택이되었습니다. 2) 임베디드 시스템에서 Linux는 높은 사용자 정의 및 효율성으로 인기가 있습니다. 3) 데스크탑 환경에서 Linux는 다양한 사용자의 요구를 충족시키기 위해 다양한 데스크탑 환경을 제공합니다.


핫 AI 도구

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

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

Undress AI Tool
무료로 이미지를 벗다

Clothoff.io
AI 옷 제거제

AI Hentai Generator
AI Hentai를 무료로 생성하십시오.

인기 기사

뜨거운 도구

ZendStudio 13.5.1 맥
강력한 PHP 통합 개발 환경

PhpStorm 맥 버전
최신(2018.2.1) 전문 PHP 통합 개발 도구

드림위버 CS6
시각적 웹 개발 도구

VSCode Windows 64비트 다운로드
Microsoft에서 출시한 강력한 무료 IDE 편집기

Dreamweaver Mac版
시각적 웹 개발 도구
