Re: how many Linux machines do you run?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



No worries.  You *can* just use

  $ dpkg --get-selections > all_packages.txt

for everything.  You'd just need to let the recipient know that
anything that doesn't have "install" for the status was likely a
package that was installed at one point but then uninstalled later.
Feel free to do that and explore the resulting "all_packages.txt"
file.  You'll find lines like

  npm      deinstall
  wget     install

By piping it through "awk" before sending it to the file, it filters
out the lines where that last column (the package status) is anything
other than "install" and then prints only the package's name of the
remaining lines (without the useless status info).

The results will have lots of system-type packages in it, but it
should at least let the recipient know what was installed on the
system.

However, if you send the whole file (or just the "install" lines),
someone with a Debian-based system can use that as input to
"dpkg --set-selections" to automatically mark them for install with:

  $ dpkg --set-selections < all_packages.txt

which can be handy.

-tim





On 2024-07-15 18:36, Karen Lewellen wrote:
> Tim,
> Sorry if I am being a moose feather, but I do not use Linux.
> as I am sharing the data, i. e. want it saved in a file, do I need the
> Install-print part of the command?
> 
> 
> 
> On Mon, 15 Jul 2024, Tim Chase wrote:
> 
> > $ dpkg --get-selections | awk '$NF == "install"{print $1}' > list_of_packages.txt
> >
> >The "dpkg --get-selections" lists all of the packages, then the
> >"awk" portion filters it to those that are currently installed, and
> >prints the package-name.  The results can be dumped to the screen,
> >sent to a file (as above) or piped to "less" for review, whichever
> >you prefer.
> >
> >-tim
> >
> >On 2024-07-15 17:53, Karen Lewellen wrote:
> >>Hi Tim,
> >>the goal would indeed be currently installed packages, seems to be Debian,
> >>as dpkg seems to be here.
> >>may I have the command for  installed packages again?
> >>here it starts with dkg, and I want to be sure this is not a typo.
> >>
> >>
> >>
> >>On Mon, 15 Jul 2024, Tim Chase wrote:
> >>
> >>>>>If the server is running an RPM-based distribution, then rpm -qa, but it
> >>>>>will likely print out a list of thousands of packages
> >>>>
> >>>>Is there a way to copy output into a file?
> >>>
> >>>The usual Unix way:
> >>>
> >>>$ rpm -qa > list_of_packages.txt
> >>>
> >>>and you can then review "list_of_packages.txt" as you see fit.
> >>>
> >>>If it's a Debian-based system, you can use "dpkg" to obtain similar
> >>>info:
> >>>
> >>>$ dpkg --get-selections > list_of_packages.txt
> >>>
> >>>which will include all installed and installed-but-then-uninstalled
> >>>packages.  If you only want the currently-installed packages, you
> >>>can use
> >>>
> >>>$ dpkg --get-selections | awk '$NF == "install"{print $1}' > list_of_packages.txt
> >>>
> >>>-tim
> >>>
> >>>
> >>>
> >>>
> >>>
> >>
> >
> 

To unsubscribe from this group and stop receiving emails from it, send an email to blinux-list+unsubscribe@xxxxxxxxxx.




[Index of Archives]     [Linux Speakup]     [Fedora]     [Linux Kernel]     [Yosemite News]     [Big List of Linux Books]