Thursday, February 20, 2020

You never had a friend like me - script is my bestie sometimes

PROBLEM:
If I do anything of interest in my home lab, I like to use the script command to create a typescript file that I can refer to later if I need to reproduce the results.

SOLUTION:

use the script command:

server1:~l$ script what_i_am_doing_typescript.txt
Script started, output file is what_i_am_doing_typescript.txt
server1:~ $ date
Thu Feb 20 10:42:24 CST 2020
server1:~ $ exit
exit

Script done, output file is what_i_am_doing_typescript.txt

FUN FACT:
If I later want to remove the carriage returns (CONTROL M) from the typescript, file use this command in vi to remove them and save (you will have to add a CONTROL V before the CONTROL M to have it work)

:^s/^M//g
ZZ


Of course, I do like
:set list
:set number 

in vi sometimes also.

No comments:

Post a Comment

Solve your own problems! - rubber duck problem solving

If you get stuck on an issue, googling the answer is not the only way to solve the problem.   Get yourself a rubber duck, use a cardboard...