3

I downloaded google-chrome for Linux, it got downloaded as a .deb file in downloads folder. I changed the current directory to the downloads folder and ran "google-chrome" in terminal. It started google chrome, but the issue is that .deb file is not a script(as I understand). Then how did the terminal understand that the 'google-chrome' command meant to start it? Commands like emacs...etc are already built-in. What about this command which is new to bash? How did it recognise it?

Jorge Castro
  • 71,754
nitishch
  • 705
  • 3
    One of the answers starts with "You probably already had google-chrome installed on your computer." Otherwise, there's no way that running google-chrome from a terminal would do what you feel it did. –  Apr 18 '13 at 11:14

3 Answers3

7

First a few basics:

When you run a command on your terminal, you enter the name of a file, (which should be executable): if you enter a simple name e.g. emacs, the system searches a number of directories for a file with such name. This list of directory is your PATH (i.e. it is stored in a variable named PATH). you can see its contents by typing echo $PATH. (As a side note, these commands are not built-in like you said in your question... but some are, for instance ls, which don't have any executable file, but is directly executed by the shell)

Alternatively, you can enter a more complex filename, which include the directory : /usr/bin/emacs, or event relative pathnames ! For instance, if you want to run the program in the file myprog, residing in your user directory, enter ./myprog (. meaning current directory)

Now back to your question:

When installing software, the system has to take care of putting everthing in the right place, so you can find it later on... It is what the package manager does : it takes an archive (.deb file), open it, and basically, put the files in the right places.

In conclusion, you have to open your .deb file with the package manager.

cd ~/Downloads
dpkg -i google-chrome.deb

or, event better, install it through the software center.

Rémi
  • 945
6

You probably already had google-chrome installed on your computer.

A deb file contains all the necessary files to install it with dpgk (as root):

dpkg -i <your-google-chrome-deb-file>.deb

dpkg will copy binaries to you binary files location and then the command google-chrome will be available in your shell. If you didn't do this nor used an apt-get to install google chrome, I guess it means that google chrome was already present on your system.

If you want to see what the deb fils contains, you can use:

dpkg --contents <file>.deb
yco
  • 225
0

There are chromium and chrome if I'm not mistaken! It could be any one of those you already install.