1

I'm trying to understand the following in Linux. In windows we have the services that run or "startup". When we install an application it could be installed as a service so that it starts automatically.

But if an application is not installed as a service we usually can see it in the Start -> Programs menu. So we know what applications are installed.

In Linux what is the equivalent? I understand that the equivalent services are in /etc/init where the services start/stop. But I assume that if I install a package it does not necessarily create a startup script in /etc/init right?

So how does one know what has been installed and is available in Linux (like we can in Windows from Start -> Programs)?

Note: I'm asking about CLI mode. I guess in a desktop version one can see the relevant icons in the various menus (e.g in Kubuntu from Application -> Internet -> Firefox).

  • You can use the package manager to list all installed packages (that the package manager knows about). The details depend on the manager. For Debian-based systems, dpkg -l. For rpm-based systems something like rpm -ql. – Faheem Mitha Feb 4 '14 at 23:23
  • You find this out through the package manager. Different distributions use different package managers. Are you using (K)Ubuntu? – Gilles Feb 4 '14 at 23:54
5

Many questions. Let's take a couple and see if we can't clear things up.

Q1

I understand that the equivalent services are in /etc/init where the services start/stop. But I assume that if I install a package it does not necessarily create a startup script in /etc/init right?

No when you install applications on Linux distros (ones that make use of package managers such as dpkg/APT, RPM/YUM, pacman, etc.), as part of the software being installed the package manager has a scripting "feature" similar to those found in Windows that can add scripts, create scripts, add users to the system, and start services after they're installed.

Q2

So how does one know what has been installed and is available in Linux (like we can in Windows from Start -> Programs)?

Easy. The same package managers that I mentioned above have commands you can use to query the system to find out what applications have been installed, what files are related to these packages etc. etc.

Example

On Red Hat based distros you can use the command rpm to find out information about the packages installed.

$ rpm -aq | head -5
libgssglue-0.4-2.fc19.x86_64
pygame-1.9.1-13.fc19.x86_64
perl-HTML-Parser-3.71-1.fc19.x86_64
ibus-libs-1.5.4-2.fc19.x86_64
libnl-1.1-17.fc19.x86_64

To find out what files are part of a package:

$ rpm -ql pygame | head -5
/usr/lib64/python2.7/site-packages/pygame
/usr/lib64/python2.7/site-packages/pygame-1.9.1release-py2.7.egg-info
/usr/lib64/python2.7/site-packages/pygame/LGPL
/usr/lib64/python2.7/site-packages/pygame/__init__.py
/usr/lib64/python2.7/site-packages/pygame/__init__.pyc

How can it show me just the executable pieces to that are included in the package (the applications)? Most of the time executables are installed in certain locations on Linux, /usr/bin or /bin are 2 such directories. I usually search the RPM packages like so for these:

$ rpm -ql pygtk2 | grep "/bin"
/usr/bin/pygtk-demo

$ rpm -ql httpd | grep -E "bin/|sbin/" | head -10
/usr/sbin/apachectl
/usr/sbin/fcgistarter
/usr/sbin/htcacheclean
/usr/sbin/httpd
/usr/sbin/rotatelogs
/usr/sbin/suexec
2

If you look in /var/log there should be a log of your package manager. For example, arch linux has a log file for pacman and all of the installed, removed, and upgraded programs are listed with a timestamp. This log is a text file.

The specific programs in unix based OSes are saved in /bin, /sbin, /usr/bin, and /usr/sbin; however, they can be saved in a variety of locations.

See this thread for some other locations programs are saved in a unix filesystem. https://askubuntu.com/questions/27213/what-is-the-equivalent-to-the-windows-program-files-folder-where-do-things-g

1

I do not think there is any CLI equivalent to GUI to discover programs the way they jump at you. It is more exploratory. When I get on to a new linux system, I look at the /opt directory to find what all optional packages are installed other than the standard utilities. If I am looking for a specific utility, I use apropos, locate, which and/or whereis.

If admins have already installed certain utilities then I would expect them in my env and system path so I look into these. Additionally, I also look into system-wide aliases if any.

Some large scale systems have modules and/or softenv installed. In such cases, I look into module avail or softenv. On systems with package managers like apt or yum, you can use them to list installed packages: yum list installed and with rpm: rpm -q myfavtool.

0

You can run

cat /var/log/dpkg.log | grep -i <search_text> to see if your desired package name <search_text> is already installed.

Works for me in Ubuntu.

Regards,

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.