Published Nov 17, 2023, 11:00 AM EST
David is a freelance writer based in the Pacific Northwest, but originally hailing from the Bay Area. A journalist by training who has been writing professionally since 2009, he discovered the power of Unix-like operating systems and the command-line interface while learning how to edit video on macOS. It also helped that he'd originally cut his computing teeth on MS-DOS in the '90s.
He has been using Linux regularly in some form since 2006. David has been able to combine his passion for computing and writing in his career as a freelance writer. His writing has appeared in Techopedia, TMCnet, and Walyou, among others.
David holds a B.A. in communication from California State University, East Bay. A dedicated lifelong learner, he's been using Linux-based CAS tools like SymPy and Sage on Linux to make sure he remembers what he learned in his math classes and maybe even pick up a few new concepts along the way. Linux and open source have allowed him to explore advanced topics like calculus and linear algebra more easily than he could with pencil and paper.
Sign in to your MakeUseOf account
You want to install some hot new program on Debian or Ubuntu. You find the package and use apt to install it. But when you try to run it on the command line, you get an error message from the shell saying, “Command not found.” Here’s how to find out where apt installed it.
You Just Installed That Package, but What’s the Command to Run It?
Most of the time, the name of the executable program corresponds with the name of the Debian or Ubuntu package. Sometimes, they’re different and you have to do a little work to figure out the executable's name. Often, this is because the package name conflicts with an existing package. Fortunately, it only takes one command to figure out the program's name.
Using dpkg to List Installed Files
To list the full pathnames of the installed files of a package, simply use the -L (capital L) option with the dpkg command. For example, to examine Firefox ESR:
dpkg -L firefox-esr
You’ll see the paths of each file the package installed, including the oh-so-important executable:
Where Are Executable Programs in Linux?
The executable you’re looking for is typically in a bin directory which stands for “binary”. In the Linux directory structure, /usr/bin is the primary location for executables you install:
Your shell uses a search path to look for programs in these directories when you enter a command. To see the directories in your search path, examine the $PATH environment variable:
echo $PATH
You’ll see the directories in your search path separated by a colon (:) character. Debian and Ubuntu typically install new programs in the /usr/bin or /usr/sbin directories. The latter are typically system administration programs that require you to run as root using sudo.
Now You Know Where apt Installed That Program
With a quick dpkg command and knowledge of Linux directory organization, it’s easy to figure out where apt installed your brand-new program. This process is especially useful when the name of a program doesn’t match the package name. You can also use the Apt Search Command to search for a package in Ubuntu.