Getting Output Terminal History on Ubuntu

Asked

Viewed 474 times

2

Is there any way to get Output History from the Ubuntu terminal? Like a log of everything that rolled into a terminal?

3 answers

1

Output from a terminal:

H1) define a long terminal history, and cut&paste the terminal to a file

H2) use command script file (keeps the session in file) -- script has several options that may be useful.

Editing in more detail:

H1) the terminal keeps a scroll-bar accessible history (by default 512 line, configurable in the terminal profile). If using the mouse we select the desired output we can make cut&paste inside your favorite editor.

H2) the Command script was created for issues such as that raised in this question. (see man script); experiment

script log
... executar alguns comandos
(CTR-D)
... e vê o conteudo do ficheiro log
  • I don’t understand anything, you can better elaborate your answer?

  • @jpklzm, see if editing helped. (what concretely is hard to understand?)

1


Well, it’s not very pleasant to read, but it works:

Before you start using the terminal (and assuming Voce uses bash, which is the default shell on Ubuntu):

bash | tee bash.output

At the end, you’ll have a file bash.output in his home with the exit, but all together, without showing where it came from.

  • The command history returns all inputs I made in the terminal. I don’t want inputs, I want outputs

  • Oops, I’m sorry. I read it wrong.

  • Now yes :P Sorry for the previous 'answer'.

  • But for example, I’m already using the terminal and I want to get his history. My current scenario, I’m trying to replicate a system error in python. This morning I managed to replicate the error but I did not save the traceback, I have to recover this traceback? I still have the terminal window open.

  • Ah, do you mean something that happened in the past? I don’t think there’s a way :(

  • 1

    =/ I’ll leave the thread open and see if any miracles appear around here.

  • 1

    @jpklzm was thinking today about a way to do what you would like (to get the result of commands from the past), but I came to the conclusion that it would not make sense. no matter how much Voce could make a script that would fix all the commands on .bash_history, some of these commands have no output, or will not work (something like a cd dir that say is not in the right place). ie, I think the miracle does not exist XD

  • It’s a shame, it would be something very useful.

Show 3 more comments

1

There is another way and I cannot help but comment. In the personal folder there is a file called . bash_history(/home/user/.bash_history). If you open from Nautilus, give a Ctrl+h to display the hidden files and you will find it. If you want to see it directly in the shell, type:

cat /home/username/.bash_history | more

Press enter to display the following.

  • this file only shows the inputs, the op wanted the output of the commands.

  • Really. I failed to look at the issue and some of the comments.

  • idem XD was basically my first answer class :)

  • I did a better search on this. To have the outputs saved it seems that one should configure this previously.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.