Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would love figuring out how much time I actually have spent in shell performing administrative duties. For billing of course, this information is not sufficient, but it would be helpful to figure out how much time I have actually spent in shell.

My question is:

  • How anyone got tips on how to calculate time spent in shell (in hours + minutes), let's say per user account?
  • Could anyone recommend a software that could be used to analyze this time?
  • Optionally I would like to know about ways how to categorise time spent (e.g. 1 hour for Apache, 2 hours for Samba, etc.)

Also, your takes on how you monitor your admin time, are also much appreciated!

To narrow down the problem, I am specifically interested in ways of tracking time spent in shell for Linux system administration


locked by HopelessN00b Jan 21 '15 at 20:35

This question exists because it has historical significance, but it is not considered a good, on-topic question for this site, so please do not use it as evidence that you can ask similar questions here. This question and its answers are frozen and cannot be changed. More info: help center.

closed as primarily opinion-based by HopelessN00b Jan 21 '15 at 20:35

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

up vote 4 down vote accepted

Hmm theres a few ways from creating a file on login and logout to fully featured tracking software take a look here:

Or google for 'audited shell'

If you use Emacs Org mode is used by a lot of people for this.

Historically, process accounting has been used for billing (ya' know, back when "the machine" cost a bazillion dollars an hour to run). Tools that log the tasks performed are going to have a hard time divining the user's intent out of the log. "So... ya' spend 25 mintues in 'vi', eh? Working on /etc/samba.conf, eh? Oh-- you were in the restroom for 15 mintutes of that..." – Evan Anderson Jan 28 '10 at 14:01
@evan-that's a common problem. I think Joel just addressed that in the latest StackOverflow podcast, where tracking work time and estimating programming tasks is an issue because a task you think will take 15 minutes takes hours or days because of not only "issues" but you have people web browsing or dreaming or doing other life-gets-in-the-way things that...well, makes us somewhat human. That's why I didn't really give suggestions here. What counts as "administrating from the shell"? Time scratching your head, time actually running commands? The better question is, what is he aiming to do? – Bart Silverstrim Jan 28 '10 at 14:17
"Process Accounting" are the key words from @Evan Anderson's comment. His point about difficulty in divining intent from the list of time spent in each command remains. – mpez0 Jan 28 '10 at 14:17
(to what end, that is) – Bart Silverstrim Jan 28 '10 at 14:17
Process accounting seems to be the stuff I'm looking for! Thank you!! Also sorry for a bit badly spoken out question. I want to emphasise I am not talking about billing aspect here, I just want to figure out how much time I roughly spent in shell working with different software and on which day. – Jaakko Jan 28 '10 at 14:18

If you just want to see how much time you spend logged-on why not look at the output of "last"? I suspect you want more detail than this, though.

Your statement "...ways of tracking time spent in shell for Linux system administration." gives me pause. That almost sounds like you're looking for some kind of automatic method of identifying what you're working on and logging the time.

I'd hypothesize that the amount of time you'd spend building and maintaining some kind of "AI" to analyze your commands and track time would dwarf the amount of time you actually spend on sysadmin duties. How does that tool know why you're tailing "/var/log/messages" today?

I work time-and-materials for all my Customers and have to keep fairly detailed logs of my activities and times. If there's a shortcut out there I'd certainly love to find it, but my methodology is, I expect, the only one that makes realistic sense:

  • Log start and stop times for given activities
  • Try to minimize interruptions to those activites and, when interrupted, log myself off that activity (and hopefully on to something else billable)
  • Categorize time associated with a given activity and write notes
  • Repeat ad infinitum (billing, where possible and appropriate!)

Lately I've been using an iPhone app on my iPod, HoursTracker, but previously I used such software as Notepad and Pieces of Paper with Writing on Them(tm). I don't see any reason why you couldn't use a simple shell script to append times and log details to a database, flat file, etc. You could probably su to different accounts prior to starting different admin activities so that you had a record of start / stop times on activities. Whatever you do, the usage methodology is a lot more important than the tool you use to gather data.

If you want to get good per-task times you're going to have to have the discipline to log when you start and stop working on a given task. If you want to get a good handle on your Samba-related admin time, you'll have to be sure to log yourself off of that task when you're doing Apache work, playing Server Fault, etc.

Like I said-- I'd love to find a shortcut. Some kind of brain-computer--GPS-telephone interface would be awesome, but it just doesn't exist that I've been able to find.

Thank you for a detailed answer. I'm pretty much aligned with what you say that there is and - most likely - will not be a tool that automatically knows what I am working on based on mere command-line history. However, information on any tools to that direction is still much appreciated. – Jaakko Jan 28 '10 at 14:15
Evan, could you work on inventing your brain-computer-GPS-telephone interface? I've been in the market for one. – Dave Drager Jan 28 '10 at 14:20
@Dave Drager: Right there with you. Something like MyLifeBits ( might get close, admittedly. – Evan Anderson Jan 28 '10 at 14:22

Time tracking can be as simple or difficult as you (or whomever you report to) wants to make it.

Personally what I do is I have a process running on my hosted server that has is connected to a google talk account. I then make notes to that process through the google talk which is running on my laptop, which gives me a time-stamped record of what I did. This, combined with my sent-items mail folder, helps a great deal when I am trying to figure out what I spent my (customer's) time on.

I picked Google Talk because it uses a SSL connection and therefore cannot be trivially snooped.


If you need to charge your hours against a particular project or customer, you should look at time tracking software used by lawyers, accountants, consultants, etc. We use some enterprisy godawful package at work for charging against projects.

For Linux, there's an app called Project Hamster which is a great tool for this sort of thing. For a knowledge worker like a sysadmin, automatic tracking isn't going to work in most situations.


Not the answer you're looking for? Browse other questions tagged or ask your own question.