Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I need to know when a particular system i'm remotely connected to disconnected - so i'd like a way to prefix my terminal commands and output with a timestamp, preferably temporarily- i'd find it an annoyance in most other cases. currently i'm using yakuake/konsole with bash, but if need be, i can use something else.

share|improve this question

3 Answers 3

export PROMPT_COMMAND=date

will make bash print the date before issuing each prompt. That may be enough if the prompt returns on your local machine when the remote system disconnects.

share|improve this answer

You can add

export HISTTIMEFORMAT="%h/%d - %H:%M:%S "

to your .bashrc to add timestamps for used commands.

I haven't found any terminal emulator that supports timestamps.

You can try to patch bash to support syslog: http://www.juzzy.com/index.php/files/4-bash (but I'm not sure it works or is it good idea at all).

I think the best option is to wrap your program you use to connect into some bash script that will log date after disconnect.

Another option is to monitor your network traffic.

share|improve this answer

You can simply use command-to-connect-remote-shell; date and you will get time of disconnection.

To not forget to add date every time you can add these lines to your .bashrc

function connect {
 your-connect-cmd $@
 date
}

And then just type connect YOUROPTIONS

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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