The “file” command is a utility that allows you to determine the type of a file based on its contents, rather than its name or extension. If you are getting the “bash: file: command not found” error, it means that the “file” package is not installed on your system.
To install the “file” package on Ubuntu 20.04 LTS, you can use the apt-get
command. Here are the steps to install the “file” package:
- Open a terminal window and run the command
sudo apt-get update
to update the package lists. - Next, run the command
sudo apt-get install file
to install the “file” package. - Once the installation is complete, you should be able to use the “file” command without getting the “command not found” error.
If you are using another Linux distribution, the package manager command may differ, but the package name should be the same.
It’s also good to note that, the file command is usually a part of the file package, which is present by default on most Linux distributions. If you are unable to install the package, it is possible that it is already installed and the error message is caused by a different issue, such as a missing or incorrect PATH variable. (contentbeta.com)