Nash
Nash

Reputation: 1073

Git - how to verify if and where Git is installed on Ubuntu

I am new to Ubuntu and Git. How I can verify that I have installed git on my machine? When I tried apt-get I got:

root@ubuntu:/home/nebojsa# apt-get install git
Reading package lists... Done
Building dependency tree       
Reading state information... Done
git is already the newest version.
The following packages were automatically installed and are no longer required:
  linux-headers-3.13.0-24 linux-headers-3.13.0-24-generic
  linux-headers-3.13.0-39 linux-headers-3.13.0-39-generic
  linux-headers-3.13.0-40 linux-headers-3.13.0-40-generic
  linux-headers-3.13.0-43 linux-headers-3.13.0-43-generic
  linux-image-3.13.0-24-generic linux-image-3.13.0-39-generic
  linux-image-3.13.0-40-generic linux-image-3.13.0-43-generic
  linux-image-extra-3.13.0-24-generic linux-image-extra-3.13.0-39-generic
  linux-image-extra-3.13.0-40-generic linux-image-extra-3.13.0-43-generic
Use 'apt-get autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 133 not upgraded.

but I don't know where are the packages installed.

Thanks for your help!

Upvotes: 41

Views: 102423

Answers (6)

Kevin Seifert
Kevin Seifert

Reputation: 3572

Type which git. It should return the path to the executable

If you want to see more details see: List of files installed from apt package

Upvotes: 70

Keith Thompson
Keith Thompson

Reputation: 263177

Like most executables, git is installed in /usr/bin/git.

To see where all the files that are part of the git package are located, you can type:

dpkg -L git

You'll want to pipe the output through less or your favorite page; I get 591 664 lines of output on my system.

(Not all systems use the same package manager that Ubuntu does. You might need to use some command other than dpkg, perhaps rpm, yum or dnf.)

If you had installed git from source rather than via the package manager, the git executable could be anywhere, depending on how you installed it. If it's in your $PATH, typing

type git

or

type -a git

would tell you where it is. (That's assuming you're using the default bash shell.)

Upvotes: 8

TEDDY
TEDDY

Reputation: 821

which git is the command to use , this gives the location where git is installed if it is already installed , usually /usr/bin/git .If git isn't installed u wont be getting any thing.when git is already installed

Upvotes: 4

Kaur
Kaur

Reputation: 1

Yup, git is installed. As for your question about the location of the package, this is most likely rather irrelevant for you. If you find yourself browsing a linux filesystem just to execute a program that has been installed system-wide, something is off. You don't usually need to do that at all.

As for git, opening the terminal and typing 'git' will give you the basics. More can be read typing 'man git' (man command is good for finding additional info on a package).

If you want a graphical front-end for git, see this https://askubuntu.com/questions/227554/what-are-some-gui-clients-for-git

Upvotes: 0

Messa
Messa

Reputation: 25181

It tells you

git is already the newest version.

so everything should be OK.

Tip: to see files installed by a package, run

dpkg -L git

It will list a lot of files, but the most important one is /usr/bin/git. Another command, which git, returns what file exactly is being run when you run git - it should be the same.

Upvotes: 1

curlybracket
curlybracket

Reputation: 433

Just call the git --version. It should return something like this:

$ git --version
git version 1.9.3 (Apple Git-50)

Upvotes: 26

Related Questions