4

I downloaded VS Code's .deb file for Ubuntu. I renamed it to vs.deb.

Then I go to my downloads directory:

cd ~/Downloads

And now that I'm here, I try to install it:

sudo apt install vs.deb

And here's what I get:

Reading package lists... Done   
Building dependency tree          
Reading state information... Done   
E: Unable to locate package vs.deb   
E: Couldn't find any package by glob 'vs.deb'

But when I install it using ./vs.deb, then it gets installed:

sudo apt install ./vs.deb

Why doesn't Linux accept the name of the file inside the same directory without requiring the relative path?

Zanna
  • 72,312

1 Answers1

20

What you experience is not related to the shell, but to how the apt command interprets the arguments on the command line.

It is primarily aimed at installing packages from the software repositories. By default, an argument to apt means the name of a package in the software sources. The message:

E: Unable to locate package vs.deb

clearly indicates that a package vs.deb does not exist in the software sources.

Still, apt allows you to directly install a downloaded .deb package file and resolve dependencies for it. You must give an explicit file path to indicate you want to install a .deb file. ./vs.deb already indicates a file path: ./ means the current directory, so apt will find the vs.deb file in the current directory.

Actually, it is never the shell that "finds" a file. The shell just passes arguments to the application, and it is up to the application to interpret these arguments. At most, the shell does expansion (e.g. replacing * with all filenames or ~ with the full path of your home folder) or variable substitution (e.g. $HOME is replaced by the content of that variable).

vanadium
  • 97,564