Logging every time a command is run

Posted by Tom D on Ask Ubuntu See other posts from Ask Ubuntu or by Tom D
Published on 2012-10-03T01:33:50Z Indexed on 2012/10/03 3:50 UTC
Read the original article Hit count: 233

Filed under:
|
|
|
|

I want to log every time I run a certain type of command in the terminal. For example, every time I run:

sudo apt-get install [something]

I want to add [something] to a log file in my home directory that will look like the following:

[timestamp] [something]
2012-10-02 mysql-server
2012-10-03 ruby1.9.1
2012-10-06 gedit-plugins
2012-10-07 gnome-panel synaptic

What's the easiest way to make this happen automatically?

© Ask Ubuntu or respective owner

Related posts about 12.04

Related posts about command-line