Linux is great
Linux can be customized

Welp, not so much. Simple things are not possible to do.

After 1H research I can't have timestamp near each line over SSH.

I'm not talking "history", i'm talking live.

basiclly I want to see timestamp on every single output line.

Basiclly this :


But running automaticly for each command ever.

To be fair, same problem exists in PowerShell on windows

And no, I don;'t want to switch to some random halfbaked teminal.

  • 6
    Did you try piping the output linewise through some xargs wizardry echoing time and line? Or maybe awk even has a feature to do this.
  • 1
    @nitwhiz Look at links I provided

    I don't want to pipe it. I want it beeing by default.

    Sure I can do that :

    bash |ts

    And it works !

    But I want it by default withfout adding a line of code.

    Or maybe there is a way to do it on sign in ?
    EDIT : Actually it doesn't work. It works only for "sucess" commands.
  • 3
    Compile your own ssh client?
    Or a script that pipes stuff to and fro and modifies it the way you want
  • 2
  • 0

    Why ? As fun as it seems, too much work :)
  • 2
    @IntrusionCM nah, it's about the output.

    something like cat backup.log | xargs -I % -n1 sh -c 'echo $(date) %' or bash | ts

    imo, proper rant. you want something specific, you don't get it - that's when you should write a rant..:D
  • 1

    Works for BASH lines, but not output.

    But thanks ! That's one step closer

    Example in a picture
  • 3
    @NoToJavaScript if you *REALLY* want this, modify the exectued shell via:

  • 1

    A bit overkill, but I think I'll try.

    Thank you
  • 2
    @nitwhiz okay. It took me a while to grok it, mostly because it's weird in more than one way.

    This is usually what you would achieve by using a logging system inside the application.

    Everything outside will not have an "ms" exact timestamp.

    If you want to log everything, you will have to send it to an syslog daemon.

    I'm not 100 % sure if this is what he truly desires, but it's possible I guess.

    You can use logger to redirect the output to eg rsyslog and use rsyslog to redirect it to a specific TTY.
  • 2
    Sounds like you need zsh for me
  • 1
    @IntrusionCM Hmm nop

    It's just a fucking display. Some too,s are not loging timestamps. Sometime I run a 30 mins script and I want to know where is it ?

    I just want to have a timestamp in front of each line. We have 4K screens now, we have pleanty of space even for SSH output.

    The idea of recompiling SSH client seems better and better lol
  • 1

    Never heard of it and google search doesn't point to it on first page. (Only derivative things "Oh my z" or stuf like that)

    So I'll pass
  • 4
    @NoToJavaScript yes.

    And what you describe is exactly what a logging system does. Enriching output with helpful information.

    When you run a command, it gets directly printed to a specific TTY. Usually the TTY you're connected to.

    That's what your program does.

    You can either capture the programs output and enrich it by sending it to a logging daemon...

    Or you'll have to change the output directly.

    You could eg use Paramiko / Python, and instead of simply outputting each output line add additional content.

    Or use a simple C exec wrapper...or bash script (logging might be far easier)

    Either "capture" it and process it, or "wrap" it.

    Bash or ZSH can start a program, but they cannot modify the output stream of an process.
  • 2
    @NoToJavaScript “Z shell” https://en.wikipedia.org/wiki/...

    My dayli driver. Nothing required to get started, just pick a theme from the “oh my zsh” (theming) community and you’re off to go!

    Then, feel free to extend your theme using plugins! Add the Spotify plugin to NEVER LEAVE THE TERMINAL TO CHECK THE SONG NAME EVER AGAIN!

    Sounds good? You’ll love it. Time stamps are just the beginning.
  • 0
    @IntrusionCM I’m still switching between both, because he clearly posted a pic with the time stamp before typing the command.

    But yes, any reasonable okay language can make a good std wrapper. Look, I’ll quickly make one in node...
  • 0
    @010001111 yes.

    Although - when you have rsyslog and spare time - you can really do insane stuff that you wouldn't want to do manually.

    Multiplexing of many streams, eg.

    And you have a fuckton of possibilities to output the stream...
  • 1
    Read about screen and read about this https://unix.stackexchange.com/ques...
  • 1
    "Simple", yet no other OS has it anyway.
  • 0

    This maybe but then with custom piping commands?

    Otherwise @FrodoSwaggins might now!
  • 0
    Does anyone not use zsh?
  • 0

    Do you want the time stamp at the beginning of each line, or each prompt?

    Each line requires some magic.
    Each prompt is trivial.

    Prompt: modify your prompt. Derp.
    Line: piping your ssh output into awk/sed should be enough.
  • 0
    Sounds like an XY problem
  • 0
    can't you just change the .bashrc or .profile to include the timestamp?
  • -1
    ⦁ Academic Jobs Europe is a free job board for Academic and Research jobs in Europe. Find all kind of jobs, find it jobs in europe, academic position in a quick and efficient way
    For more details
    visit our
  • 3
    OhMyZSH is literally made for things like this.
  • 0
    @Root Done for promt and pipe is workin with | ts. Would love it to be automaticlly aded to each command
  • 1
    Did you try piping it through some command?
    Because we recommended this only like 5 times even though you do not want this.
  • 2
    I guess even he doesn’t know what he wants...
  • 0
    @010001111 @nitwhiz

    Piping WORKS, I’ve already told that. Now I want it to be automagic.
    So basically when I to “ls” it executes “ls | ts”
    Output is perfectly what I want. But I don’t want to write | ts every time
  • 0
    @010001111 @nitwhiz

    Here is an example. If I can get THIS without adding | ts I will love my setup so much !
  • 2
    It kind of feels like what you're searching for isn't a terminal prompt modification as much as a logging trap.

Add Comment