/usr/bin/time: No such file or directory
Categories:
Resolving '/usr/bin/time: No such file or directory' on Linux
Encountering the '/usr/bin/time: No such file or directory' error can be confusing. This article explains why it happens, how to diagnose it, and provides solutions for various Linux distributions, focusing on Fedora.
The /usr/bin/time: No such file or directory
error message typically appears when you try to execute the time
command in your Linux terminal. While it seems straightforward, the root cause is often a misunderstanding of how the time
command works, especially the difference between the shell built-in time
and the external /usr/bin/time
utility. This article will guide you through diagnosing and resolving this common issue, with a particular focus on Fedora systems.
Understanding the 'time' Command Variants
Linux systems, and specifically your shell (like Bash or Zsh), often provide two versions of the time
command:
Shell Built-in
time
: This is a feature directly integrated into your shell. It's used to measure the execution time of a command that follows it. For example,time ls
will measure how long thels
command takes. This version is almost always available and doesn't rely on an external executable.External
time
Utility (/usr/bin/time
): This is a standalone program that provides more detailed timing statistics, often including memory usage, I/O operations, and more granular time breakdowns (real, user, sys). It's a separate executable file located, by convention, at/usr/bin/time
.
The error /usr/bin/time: No such file or directory
specifically refers to the external utility. This means your system cannot find or execute the /usr/bin/time
program, even if the shell built-in time
works perfectly fine.
flowchart TD A[User executes 'time command'] --> B{Is 'time' a shell built-in?} B -- Yes --> C[Shell built-in 'time' executes 'command'] B -- No --> D{Is 'time' aliased or in PATH?} D -- Yes --> E[External 'time' utility executes 'command'] D -- No --> F{Is '/usr/bin/time' explicitly called?} F -- Yes --> G{Does '/usr/bin/time' exist?} G -- Yes --> E G -- No --> H["Error: '/usr/bin/time: No such file or directory'"]
Decision flow for 'time' command execution
Diagnosing the Problem
Before attempting a fix, it's crucial to confirm which time
command you're trying to use and why it's failing. Here are some diagnostic steps:
Check for the shell built-in
time
: This command will tell you iftime
is a shell built-in.Check for the external
time
utility: This command attempts to locate the externaltime
executable in your system's PATH.Verify the existence of
/usr/bin/time
: This directly checks if the file/usr/bin/time
exists on your filesystem.
If which time
returns nothing or a path other than /usr/bin/time
, and ls /usr/bin/time
also fails, then the external time
utility is indeed missing or not in your PATH.
type time
which time
ls -l /usr/bin/time
Commands to diagnose the 'time' utility issue
time
utility even if a shell built-in exists, you can use command time <your_command>
or specify the full path: /usr/bin/time <your_command>
.Solutions for Missing '/usr/bin/time' on Fedora
The external time
utility is usually provided by a package named time
or util-linux
. On Fedora, it's typically part of the time
package. If you're encountering the 'No such file or directory' error, it's highly likely that this package is not installed or has been inadvertently removed.
Here's how to resolve it on Fedora and other RPM-based systems:
Install the
time
package: Use thednf
package manager to install thetime
package. This will place the/usr/bin/time
executable on your system.Verify the installation: After installation, confirm that
/usr/bin/time
is now present and executable.
For Debian/Ubuntu users, the package is also called time
and can be installed using sudo apt install time
. For Arch Linux, it's part of util-linux
and should be present by default.
1. Install the 'time' package
Open your terminal and run the following command to install the time
package using dnf
:
2. Verify the installation
After the installation completes, check if the /usr/bin/time
utility is now available and working correctly:
sudo dnf install time
Installing the 'time' package on Fedora
ls -l /usr/bin/time
/usr/bin/time ls
Verifying the 'time' utility after installation
sudo
with caution when installing or modifying system packages. Ensure you understand what you are installing.