1

I was looking to install a .deb file and found an answer here: How to install a deb file, by dpkg -i or by apt?

I just want to know the difference between using:

sudo apt install ./name.deb

and

sudo apt install /path/to/package/name.deb

Why isn't the second option:

sudo apt install ./path/to/package/name.deb

?

3

The two variants look for the package in different locations (unless the current directory is the root directory).

sudo apt install ./path/to/package/name.deb

looks for a package file named name.deb, in the subdirectories path, to, package, starting from the current directory (.). This only works if the current directory contains a directory named path, which itself contains a directory named to, which itself contains a directory named package, which contains the file name.deb.

sudo apt install /path/to/package/name.deb

looks for a package in the directory /path/to/package, i.e. the same sequence as above, but starting from the root directory, not the current directory.

Put another way, ./ isn’t part of the apt syntax, it’s part of the file’s path, and interpreted as usual for paths.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.