-1

I don't know how to best describe this, but I am looking for a way to capture everything that's happening on one terminal, onto a file.

For example, I have this on my terminal screen:

yes@yes:/dev/pts$ echo "asdfasdf"
asdfasdf
yes@yes:/dev/pts$ sadsad
sadsad: command not found
yes@yes:/dev/pts$ tail /etc/passwd
lxd:x:105:65534::/var/lib/lxd/:/bin/false
uuidd:x:106:110::/run/uuidd:/usr/sbin/nologin
dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
landscape:x:108:112::/var/lib/landscape:/usr/sbin/nologin
sshd:x:109:65534::/run/sshd:/usr/sbin/nologin
pollinate:x:110:1::/var/cache/pollinate:/bin/false
yes:x:1000:1000:,,,:/home/yes:/bin/bash
rtkit:x:111:115:RealtimeKit,,,:/proc:/usr/sbin/nologin
usbmux:x:112:46:usbmux daemon,,,:/var/lib/usbmux:/usr/sbin/nologin
pulse:x:113:116:PulseAudio daemon,,,:/var/run/pulse:/usr/sbin/nologin
yes@yes:/dev/pts$ testing terminal yohoho
testing: command not found
yes@yes:/dev/pts$ 

And I want this, exactly as it is (with all the information here, including the commands I run and the output of the terminal), to be exported into a file.

What I tried was something pretty naive, which obviously failed, was to run this from another terminal:

cat /dev/pts/0 > ~/testfile

The reason I want to know how to do this is because I often have to work with files that are very large on remote machines with no ftp available, so being able to "cat" the files on the terminal, and have the output of the terminal automatically be exported on a file on my machine would be really useful.

0

1 Answer 1

1

Use the script command, like so:

script filename.txt

Whatever you enter in the terminal or whatever gets displayed on the terminal will be stored in filename.txt.

To stop the process press CtrlD in the terminal where you have started script.

Not the answer you're looking for? Browse other questions tagged .