SEARCH

Enter your search query in the box above ^, or use the forum search tool.

You are not logged in.

#1 2014-11-06 23:39:49

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Script: What Have I Installed So Far?

Something I threw together a while ago, may come in handy when Corenomial gets to work on Jessie....

A simple bash that lists everything you have installed from install date, with install date.

#!/bin/bash
#pkginstalls.sh
#creates text file with a list of all packages installed by date

#first append all info from archived logs

i=2
mycount=$(ls -l /var/log/dpkg.log.*.gz | wc -l)
nlogs=$(( $mycount + 1 ))

while [ $i -le $nlogs ]
do
if [ -e /var/log/dpkg.log.$i.gz ]; then
zcat /var/log/dpkg.log.$i.gz | grep "\ install\ " >> $HOME/pkgtmp.txt
fi
i=$(( $i+1 ))

done

#next append all info from unarchived logs

i=1
nulogs=$(ls -l /var/log/dpkg.log.* | wc -l)
nulogs=$(( $nulogs - $nlogs + 1 ))
while [ $i -le $nulogs ]
do
if [ -e /var/log/dpkg.log.$i ]; then
cat /var/log/dpkg.log.$i | grep "\ install\ " >> $HOME/pkgtmp.txt
fi
i=$(( $i+1 ))

done

#next append current log

cat /var/log/dpkg.log | grep "\ install\ " >> $HOME/pkgtmp.txt

#sort text file by date

sort -n $HOME/pkgtmp.txt > $HOME/pkginstalls.txt

rm $HOME/pkgtmp.txt

exit 0

Assumes you have log files! (Many may have switched them off if following SSD tutorials)

Offline

Help fund CrunchBang, donate to the project!

#2 2014-11-08 20:04:45

userx-bw
#! Die Hard
From: stuck in an unknown reality
Registered: 2013-11-19
Posts: 735

Re: Script: What Have I Installed So Far?

Joe90 wrote:

Something I threw together a while ago, may come in handy when Corenomial gets to work on Jessie....

A simple bash that lists everything you have installed from install date, with install date.

...
Assumes you have log files! (Many may have switched them off if following SSD tutorials)

ls: cannot access /var/log/dpkg.log.*.gz: No such file or directory

does that mean I got LOG FILES turned off?


"How can you learn how to fix it, if you don't break it first? :8
"the only way to get away with murder is - by killing time" swp 1997  8o
"A computer is only as smart as the person using it"
"Just plug it in and see if it blows up, if not then take it apart and figure out how it works."

Offline

#3 2014-11-08 22:42:49

Joe90
#! Junkie
Registered: 2013-10-10
Posts: 337

Re: Script: What Have I Installed So Far?

Possibly.

What does

ls -al /var/log | grep dpkg

return?

Offline

#4 2014-11-09 01:29:03

userx-bw
#! Die Hard
From: stuck in an unknown reality
Registered: 2013-11-19
Posts: 735

Re: Script: What Have I Installed So Far?

Joe90 wrote:

Possibly.

What does

ls -al /var/log | grep dpkg

return?

userx@rebanged-crunchbang:~$ ls -al /var/log | grep dpkg

-rw-r--r--  1 root root   36081 Nov  2 13:54 dpkg.log
-rw-r--r--  1 root root 1156436 Oct 31 18:45 dpkg.log.1

userx@rebanged-crunchbang:~$ 

that -

do I got a run that script sudo mode?

userx@rebanged-crunchbang:~$ sudo $HOME/./whatsInstalled
ls: cannot access /var/log/dpkg.log.*.gz: No such file or directory
userx@rebanged-crunchbang:~$ 

Nope sudo didn't work either -- Hum?   8)

Last edited by userx-bw (2014-11-09 01:32:45)


"How can you learn how to fix it, if you don't break it first? :8
"the only way to get away with murder is - by killing time" swp 1997  8o
"A computer is only as smart as the person using it"
"Just plug it in and see if it blows up, if not then take it apart and figure out how it works."

Offline

#5 2014-11-09 06:23:14

daggoth
Member
From: New Zealand
Registered: 2012-01-18
Posts: 39

Re: Script: What Have I Installed So Far?

A useful script for my toolkit. But I have redone it as a function for my /root/.bash_aliases.

 debhist()  { zgrep -h '\ install\ ' /var/log/dpkg.log* | sort -n | cut -d $' ' -f 1,2,4 | sed -r 's/:[0-9a-z]+$//' | column -t ; }
 
## To view installed debs by date
debhist | less

Offline

Board footer

Powered by FluxBB

Copyright © 2012 CrunchBang Linux.
Proudly powered by Debian. Hosted by Linode.
Debian is a registered trademark of Software in the Public Interest, Inc.
Server: acrobat

Debian Logo