Blog links

Record the session of commands in a Linux


 How to record the session of commands in a LinuxYou may use lots and lots of commands in LInux. The command line in very powerful. They say “You can do almost anything from the command line in Linux!”, and I agree. Yes, you can do each and everything in Linux using the commands very quickly. If you are unfamiliar with the Linux commands check out our various beginner tutorials in Linux. Let’s focus on this one. We will record all the command we will type in the terminal and save it in a text file.

How to start the recording session?

First of all,  we will start the session that will record or store every commands we will type on the Terminal. Go to terminal and type:
script recordfile.txt
After you hit enter the script has been started.
recordingsession How to record the session of commands in a Linux
Here, recordfile.txt is the file name where our sessions is going to be stored. You can type the filename whatever you want.
The recording has begun. Whatever you type, it is stored in recordfile.txt.

How to stop the session?

To stop the session or the script hit Ctrl+D in your keyboard.
Now, you can see you textfile and find out the commands that has been recorded.

To view the text file:

cat recordfile.txt
How to append the session in the same file?
You have stopped the session, now what if you want to continue the session in that same text file. It’s easy go to terminal and type
script -a recordfile.txt
To stop and view the file, follow the same step.

0 comments:

Post a Comment

2leep.com