0

I am a heavy Vim user and I also use a ton of tmux and a load of bash in my everyday computer activities.

In order to optimize my work flow, even more, I would like a way to get a log of all key presses, I do during my computer sessions.

What I am looking for is a program that would work something like this:

keylogger -o log.txt | bash

And then everything I type in my bash session gets logged, to log.txt. Where log.txt ends up something like this:

tmux<cr>
vi wefwef.c<cr>
iHello, world!<esc>
VUoHAHAHAHAHAHA hahahah!<esc>hhllb
:!grep -a 66 /usr/bin/vi | aplay<cr>
:x<cr>
cat wefwef.txt<cr>
make war<cr>
echo vivivi is the editor of the beast!!<cr>
yes | rm -rf /<cr>
ps -A | grep '[0-9]\+' -o | xargs kill -9<cr>
exit 666<cr>

… And then I can use this information to optimize my workflow even more!

Is there an Unix tool similar to the one I described?

ctrl-alt-delor
  • 27,473
  • 9
  • 58
  • 102
wefwefa3
  • 1,345
  • 5
  • 15
  • 27

1 Answers1

0

From zsh, you could do something like:

cmd="stty rows $LINES cols $COLUMNS; stty '$(stty -g)'; bash"
STTY='raw -echo' cat > typescript.in | script -c "$cmd"

Then you'd have what you typed in typescript.in and the output in typescript.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501