Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to redirect the telnet console logs to a file Linux

Tags:

linux

shell

tcl

I want to redirect the telnet console logs to a file in Linux.

For example:

telnet $someIp > someFile
#ls
#exit

I want the console logs to be saved in the filename someFile. I am using tcl for automating this. As of now, I am doing spawn telnet $someIp in tcl.

This will not capture the console logs and save it to a file.

Can this be done?

like image 287
Saran Avatar asked Feb 03 '15 06:02

Saran


People also ask

How do I redirect output to a file and screen in Linux?

Redirecting output to a single file and screen: You can also append the redirected output by utilizing the “-a” or “–append” option with the tee command. -a or –append option allows tee command to append files rather than overwriting the file's content.


1 Answers

You can do it by using the tee command:

telnet $someIp | tee -a -i someFile
like image 85
Laser Avatar answered Sep 22 '22 11:09

Laser