Find the FFmpeg Binary Location in Linux
Finding the exact location of the FFmpeg binary on a Linux filesystem
is a straightforward process that can be accomplished using several
built-in terminal commands. Whether you need to reference the path in a
script, verify a manual installation, or troubleshoot environment
variables, commands like which, whereis,
type, and find offer different levels of
detail to locate the executable file. This article will guide you
through these methods, explaining how each tool works and when to use
it.
Using the which
Command
The most common and quickest way to find the FFmpeg binary is by
using the which command. This tool searches the directories
listed in your system’s $PATH environment variable and
returns the path of the executable that runs when you type
ffmpeg.
To use it, open your terminal and run:
which ffmpegIf FFmpeg is installed and in your PATH, the command will output a
direct path, typically looking like /usr/bin/ffmpeg or
/usr/local/bin/ffmpeg.
Using the whereis
Command
If you want a more comprehensive look that includes not just the
binary, but also the source files and manual pages associated with
FFmpeg, the whereis command is the best choice. It searches
a broader, hardcoded list of standard Linux directories.
Run the following command in your terminal:
whereis ffmpegThe output will display multiple paths separated by spaces, clearly
showing the location of the binary alongside its documentation paths
(usually under /usr/share/man/).
Using the type Command
The type command is a built-in shell utility that
describes how a command would be interpreted if typed into the terminal.
It is highly reliable because it accounts for shell aliases and built-in
functions that tools like which might miss.
To check FFmpeg with this utility, type:
type -p ffmpegUsing the -p flag forces the command to specifically
return the path to the disk file that would be executed, giving you the
clean, direct path to the binary.
Using the find Command
If FFmpeg was compiled manually or installed in a non-standard
directory that is not included in your system’s $PATH, the
previous commands might fail to locate it. In this scenario, you can
search the entire filesystem using the find command.
To search the system, execute the command with root privileges:
sudo find / -type f -name "ffmpeg"This command tells the system to start at the root directory
(/), look specifically for files (-type f),
and match the exact name “ffmpeg”. Because it scans the entire drive,
this method may take a few moments to complete, but it will uncover the
binary regardless of where it is hidden.