Home Operation and Maintenance Linux Operation and Maintenance Solution to the problem that the command cannot be found under Linux

Solution to the problem that the command cannot be found under Linux

Dec 18, 2019 am 09:17 AM
linux hint Solution

Solution to the problem that the command cannot be found under Linux

Sometimes when we execute a command on the Linux command line, a command not found error will be reported. The reason for this error is that when executing the command, the system will Search for it in the environment variables. If it is found, execute it. If it is not found, it will report that the command is not found.

Let’s take the example of command not found reported when executing mysql or mysqladmin under Linux to explain the solution.

Check the current environment variables of the system

Solution to the problem that the command cannot be found under Linux

After the mysql program is installed, when directly executing mysql or mysqladmin, the system will first go to /usr/bin Search for the command. If it is not in this directory, of course it will not be found. At this time, we need to create a link file for these unfound commands and link to /usr/bin.

Free online video tutorial sharing: linux video tutorial

First we check whether this command exists in the environment variable. The operation is as follows:

[root@admin bin]# which mysqladmin
Copy after login

or

[root@admin bin]# where is mysqladmin
Copy after login

If the command exists in the environment variable, the specific path will be output, as shown below:

Solution to the problem that the command cannot be found under Linux

If it does not exist, it will prompt The command was not found, as shown below:

Solution to the problem that the command cannot be found under Linux

Before linking, we must know the full path of this command, such as mysqladmin
Look for the full path of this command

[root@admin bin]# find / -name mysqladmin
Copy after login

The results can be seen that there are two places where mysqladmin exists. We don’t need to worry about the first one, that is his original path. The next thing you need to do is to link the following path directly to /usr/bin. The operation is as follows:

[root@admin bin]# ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
Copy after login

After the link is successful, execute this command again and it will be ok.

Solution to the problem that the command cannot be found under Linux

Recommended related articles and tutorials: linux tutorial

The above is the detailed content of Solution to the problem that the command cannot be found under Linux. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
2 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Repo: How To Revive Teammates
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Hello Kitty Island Adventure: How To Get Giant Seeds
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to solve the problem of busy servers for deepseek How to solve the problem of busy servers for deepseek Mar 12, 2025 pm 01:39 PM

DeepSeek: How to deal with the popular AI that is congested with servers? As a hot AI in 2025, DeepSeek is free and open source and has a performance comparable to the official version of OpenAIo1, which shows its popularity. However, high concurrency also brings the problem of server busyness. This article will analyze the reasons and provide coping strategies. DeepSeek web version entrance: https://www.deepseek.com/DeepSeek server busy reason: High concurrent access: DeepSeek's free and powerful features attract a large number of users to use at the same time, resulting in excessive server load. Cyber ​​Attack: It is reported that DeepSeek has an impact on the US financial industry.

The simplest DeepSeek local deployment strategy for the entire network: Create an exclusive AI assistant The simplest DeepSeek local deployment strategy for the entire network: Create an exclusive AI assistant Mar 12, 2025 pm 01:09 PM

This article provides a super simple tutorial for DeepSeek local deployment to help you easily create an exclusive AI assistant. No need to rely on cloud services, installation and configuration can be completed on Windows, macOS and Linux systems in just a few steps. DeepSeek has certain hardware requirements (16GB memory and solid state drive are recommended). The installation process is simple and intuitive, and you can easily get started even without technical background. Tutorials cover preparation, installation, configuration, operation and optional continuous learning steps, allowing you to quickly experience the powerful features of DeepSeek's text generation, code writing, and translation. Start your hands now and have your exclusive AI!

What should I do if the okx device is restricted? What should I do if the okx device is restricted? Mar 12, 2025 pm 06:12 PM

OKX device restrictions Solution: Are your OKX account devices restricted? This article provides detailed self-service solutions. First, contact OKX official customer service to provide your account information and restricted device details. Customer Service may ask you to provide authentication information and explain any abnormal activities. Then you need to wait for OKX to review, which can take several days. After the audit is completed, take corresponding measures based on the reasons for the restrictions (such as abnormal login or violation), such as changing the password, enabling two-factor verification, or stopping the violation. If the restrictions are caused by system errors, please wait patiently for the system to recover and follow the official announcement of OKX.

How to use binance security validator How to use binance security validator Mar 27, 2025 pm 04:48 PM

Want to keep your Binance account safe? This article details how to use Binance security authenticator (such as Google Authenticator), including downloading and installing, enabling settings, backup keys, and daily usage tips to effectively prevent theft of the account.

How to solve the problem of 'Undefined array key 'sign'' error when calling Alipay EasySDK using PHP? How to solve the problem of 'Undefined array key 'sign'' error when calling Alipay EasySDK using PHP? Mar 31, 2025 pm 11:51 PM

Problem Description When calling Alipay EasySDK using PHP, after filling in the parameters according to the official code, an error message was reported during operation: "Undefined...

How to solve the problem of third-party interface returning 403 in Node.js environment? How to solve the problem of third-party interface returning 403 in Node.js environment? Mar 31, 2025 pm 11:27 PM

Solve the problem of third-party interface returning 403 in Node.js environment. When we use Node.js to call third-party interfaces, we sometimes encounter an error of 403 from the interface returning 403...

How to set binance into Chinese How to set binance into Chinese Mar 27, 2025 pm 04:45 PM

Want to use the Chinese interface on Binance? This article teaches you how to handle it easily! Whether it is the web or the app, you can set the language to Simplified Chinese or Traditional Chinese in just a few simple steps, saying goodbye to the troubles of English and enjoy a smoother and more convenient transaction experience.

How to solve the problem of cURL error 77 when connecting to Elasticsearch 8 using ThinkPHP6 and elasticsearch-php clients? How to solve the problem of cURL error 77 when connecting to Elasticsearch 8 using ThinkPHP6 and elasticsearch-php clients? Mar 31, 2025 pm 11:36 PM

Using the ThinkPHP6 framework combined with elasticsearch-php client to operate Elasticsearch...

See all articles