apt-get log?

Whether you are using Linux on the desktop or as a server, it's still good that you're using Linux. Linux related questions go here.

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

apt-get log?

Post by alex.barylski »

I've Googled and only found something sorta like what I would like ideally.

Basically I have been slowly configuring my server with all the nessecary daemons, etc and would like to print out a log so the next time I have to setup a server I can simply goes through a list so I'm sure not to miss anything.

I have tried:

Code: Select all

cat /var/log/dpkg.log
However this seems to dump more than what I need. Really I'm interested in apt-get commands issued at the CLI. I believe the commands you execute are cached (I can quickly recall previous commands using the arrow keys) so I'm wondering if I could run a grep on that cache file and only show the apt-get install commands I've executed???

Can someone show me how, please. :)
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Re: apt-get log?

Post by VladSun »

There is a file called .bash_history in every user's home directory - that's the "cache" file for shell commands.

Code: Select all

grep "apt-get install" /root/.bash_history
Keep in mind that only the last 500 (by default for Debian) CLI lines are saved.

Code: Select all

wc -l /root/.bash_history
PS: You owe me a beer ... no! two beers :)
There are 10 types of people in this world, those who understand binary and those who don't
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: apt-get log?

Post by alex.barylski »

PS: You owe me a beer ... no! two beers
I'll buy you a whole case when everything is setup and configured and working. :P
Post Reply