List all apps linux

How do I list all installed programs?

Hm, I’m interested in Red Hat, Ubuntu, and cygwin. Is there a distribution-free way to list the programs with some command line argument?

4 Answers 4

That depends on your distribution.

  • Aptitude-based distributions (Ubuntu, Debian, etc): dpkg -l
  • RPM-based distributions (Fedora, RHEL, etc): rpm -qa
  • pkg*-based distributions (OpenBSD, FreeBSD, etc): pkg_info
  • Portage-based distributions (Gentoo, etc): equery list or eix -I
  • pacman-based distributions (Arch Linux, etc): pacman -Q
  • Cygwin: cygcheck —check-setup —dump-only *
  • Slackware: slapt-get —installed

All of these will list the packages rather than the programs however. If you truly want to list the programs, you probably want to list the executables in your $PATH , which can be done like so using bash’s compgen :

Or, if you don’t have compgen :

#!/bin/bash IFS=: read -ra dirs_in_path "; do for file in "$dir"/*; do [[ -x $file && -f $file ]] && printf '%s\n' "$" done done 

It would be better to distinguish between package managers instead of «distributions». NetBSD’s pkgsrc runs on any Linux, and some package managers can be used on multiple Uinces.

Answering the second part of the question (nothing really to be added to Chris’ answer for the first part):

There is generally no way of listing manually installed programs and their components. This is not recorded anywhere if you didn’t use a package manager. All you can do is find the binaries in standard locations (like Chris suggested) and in a similar way, guess where some libraries or some manual pages etc. came from. That is why, whenever possible, you should always install programs using your package manager.

Programs should be reachable via the PATH, so just list everything in the path:

Expect a result of about 3k-4k programs.

To exclude a probable minority of false positives, you may refine the approach:

for d in $ ; do for f in $d/* ; do test -x $f && test -f $f && echo $f done done 

It didn’t make a difference for me.

Источник

Showing all installed programs in Ubuntu

In Ubuntu, where to see all programs just like the «program files» in windows, from which I can launch a program from a list of all program installed?

3 Answers 3

Just for fun

Since OP mentioned: from which I can launch a program from a list of all program installed?

Below a small script that lists all (globally) installed GUI applications. Choose one to launch it, or type a few of its characters and press Return to run the application:

enter image description here

To use

  • Copy the script below into an empty file, save it as list_apps.py
  • Test- run it by the command (open a terminal window, type the command and press Return ):
python3 /path/to/list_apps.py 

The script

#!/usr/bin/env python3 import subprocess import os dr = "/usr/share/applications" apps = [] for f in [f for f in os.listdir(dr) if f.endswith(".desktop")]: try: content = open(dr+"/"+f).read() if not "NoDisplay=true" in content: lines = content.splitlines() name = [l for l in lines if l.startswith("Name=")][0].replace("Name=", "") command = [l for l in lines if l.startswith("Exec=")][0].replace("Exec=", "") apps.append([name, command]) except: pass apps.sort(key=lambda x: x[0]); apps = sum(apps, []) displ_list = '"'+'" "'.join(apps)+'"' try: chosen = subprocess.check_output([ "/bin/bash", "-c", 'zenity --list '+\ '--column="Applications" '+\ '--column="commands" '+\ '--hide-column=2 --height 450 '+\ '--width 300 '+\ '--print-column=2 '+displ_list ]).decode("utf-8").split("|")[-1].strip() chosen = chosen[:chosen.rfind(" ")] if "%" in chosen else chosen subprocess.Popen([ "/bin/bash", "-c", chosen ]) except subprocess.CalledProcessError: pass 

How it works

The script lists all .desktop files in /usr/share/applications , and checks if the line NoDisplay=true is in the file (which means it is not meant to be used as a GUI). Then it looks into the files, looks up the application name and the command to run it.

Читайте также:  Fstab file in linux

The result is listed in a zenity list, to choose from. If you pick one, the corresponding command is executed.

Extended version

If you also would like to have a short description on the application, As mentioned in the Comment= line of its .desktop file, use the version below:

enter image description here

#!/usr/bin/env python3 import subprocess import os dr = "/usr/share/applications" apps = [] for f in [f for f in os.listdir(dr) if f.endswith(".desktop")]: try: content = open(dr+"/"+f).read() if not "NoDisplay=true" in content: lines = content.splitlines() name = [l for l in lines if l.startswith("Name=")][0].replace("Name=", "") command = [l for l in lines if l.startswith("Exec=")][0].replace("Exec=", "") comment = [l for l in lines if l.startswith("Comment=")] comment = comment[0].replace("Comment=", "") if comment else "No description" apps.append([name, command, comment]) except: pass apps.sort(key=lambda x: x[0]); apps = sum(apps, []) displ_list = '"'+'" "'.join(apps)+'"' try: chosen = subprocess.check_output([ "/bin/bash", "-c", 'zenity --list '+\ '--column="Applications" '+\ '--column="commands" '+\ '--column="Description" '+\ '--hide-column=2 --height 450 '+\ '--width 500 '+\ '--print-column=2 '+displ_list ]).decode("utf-8").split("|")[-1].strip() chosen = chosen[:chosen.rfind(" ")] if "%" in chosen else chosen subprocess.Popen([ "/bin/bash", "-c", chosen ]) except subprocess.CalledProcessError: pass 

Источник

How to list user installed applications (not packages)?

Not packages and not all applications. Just the applications user installed by himself from whatever source (Software Center, manually added PPA, etc.).

If the above is not possible — a list of all installed applications or at least a GUI which lists the applications so I can take screenshots of it. I’ve read a dozen of similar questions and people posting answers usually don’t even get close to OP question merit. Please note that my question includes ‘user installed’. Answer: It is not currently possible in Ubuntu Linux. (choosing tijybba’s answer as the closest one though)

4 Answers 4

You can actually use the Ubuntu Software Centre, as shown in the screenshot here:

Ubuntu Software Center:

Also you can see it in Synaptic Bottom left list selections.

By cd /etc/apt/sources.list.d/ && cat *.list you will get list of all repositories in your system.

You can also you Y PPA manager to backup and update your repositories.

[Since this method involves installing all the packages , but if we think that newly Installed OS will already have those 90 % packages , so it will ignore the present ones and install the new manually added ones , which will be only your manually installed applications]

sudo dpkg --get-selections > installed-applications.txt 

it will generate a list of installed applications in txt file in home folder.

Читайте также:  Linux intel uhd 630

To use this file to install the same applications you will have to do ( But before this please also add all the Third party Repositories as was present in older one)

This is also possible through Gui way

sudo add-apt-repository ppa:webupd8team/mintbackup && sudo apt-get update sudo apt-get install mintbackup 

enter image description here

I guess image almost speaks itself, backup your selection, then in New installation restore it.

Cannot add PPA: ‘ppa:~webupd8team/ubuntu/mintbackup’. The team named ‘~webupd8team’ has no PPA named ‘ubuntu/mintbackup’

dpkg: warning: package not in status nor available database at line 1574: wireshark and so on for all applications.

apt-mark showmanual will give you a list of «manually installed» packages. This includes packages installed by the installer, which is most of them. But if you run this after installation and compare the output again later, you’ll get a list of packages which the user has specifically requested, excluding automatically installed dependencies.

$ # Save the current list of manually installed packages $ apt-mark showmanual | sort > original-package-list # . time passes. $ # Compare the old list with the current list $ # (this will output a list of packages that have been installed by the user since the last command) $ apt-mark showmanual | sort | comm -13 - original-package-list 

Note that applications are packages as far as Software Center and manually added PPAs are concerned. Differentiating between packages specifically requested and packages brought in to satisfy dependencies is I think the best you can do.

Or to just see a list of all packages installed, run dpkg-query -W -f’$\n’ .

only root can install packages under Ubuntu, the user that can do that is just only 1, the sudoers are just user with equivalent rights.

However you can get a lot of information looking at the logs, you can look at

the apt log under /var/log/apt/ the dpkg log under /var/log/

and you can get the list of the installed packages with just a command:

You can rephrase my question anyway you want unless the original meaning remains. If it’s called ‘sudoers installed applications’ then so be it 🙂 Naturaly I could rephrase my question to ‘How to list applications installed after system installation’. «and you can get the list of the installed packages» — for what purpose?

+1 for /var/log/apt. If you’ve installed everything with apt-get, searching for ‘Command line:’ in this log gives you a nice list of stuff you installed manually.

Actually, per your question I see that this following command does what you need dpkg -l | grep ii. This listed every installed package as it should for me. Now it does not say user A or user B but again this is a limitation not of sudo but of software center logs. EVEN using sudo the user who called sudo is passed so you could still have any app log who called sudo to run a command. Now of course you can get around this rather easily because part of sudo is the ability to login as any user [who has access to sudo] if you know their password, hack it, or change it if you have those rights on the system.

Читайте также:  Kali linux хранитель экрана

If you are concerned about what a user has installed in that it may put you or your system at risk you may want to review why you gave them sudo access and along with that the ability to install packages, but that’s just a side note.

I have a feeling you are asking for yourself which packages you have installed since system install so you can either clean up or mirror the setup to a new machine. Answers here already cover the backup/restore so we’ll skip that.

Since there is no easy straight forward way to find which user called the install of a package a better approach may be to use the command as listed both above and by another user to list all installed packages and have a browser window open to Google and run Google searched to figure out which packages are required to keep your system operational and which ones are not.

Skip to here to skip most of the fluff and get to the answer more directly.

You could also review your sudoers logs to see who called for the install of what let me give an example line

May 15 11:26:30 sudo: : TTY=unknown ; PWD=/home/pariah (pwd file or auth method used to verify user) ; USER=root (User they were running as) ; COMMAND=/usr/bin/thunar (the command they ran) 

So this tells me at this time and date this user called for a sudo [actually in this case gksu was used btw], what user sudo let them have permissions as and the big one the command they ran!

Now if you were to grep for apt-get or similar within the sudo log [/var/log/auth.log] and older ones will have .0 .1 etc appended to the end.

You could piece together which installs the user called for on the command line itself. If they used software-center I am not sure if the relevant terminal command would get an auth line here, but you get to use the software center logs found at:

/var/log/apt/history.log and older logs are in .gz compressed archives

Now the software center log does not provide the user who authed the installs as far as I have ever seen within that log, but it lists EVERY add, modify, or remove software center performs. Again this log also has time and date stamps as well so easy enough to find ackages after base system install go to oldest log go to top or if you remember the time and date of when the base install completed and you are good to go.

Both of those log files mentioned are in plaintext and you can use any gedit, mousepad, leafpad whatever text editor your Ubuntu flavor uses for it’s default to view and or print them.

Источник

Оцените статью
Adblock
detector