telnet
This is an old revision of the document!
Table of Contents
Telnet Tips
Tee Telnet Output to a Unique File
Note the use of $@ vs “$*” in the next function that automatically saves an archive of a telnet session. Also note that I remove spaces and colons. (Colons because they screw with opening files directly at line numbers).
telnet_log() { curtime=$(date -Iseconds | tr : .) args=$(echo "$*" | tr ' ' '_') telnet $@ | tee $HOME/telnetlog/$args\_${curtime::-5}.log } last_telnet_log() { ls -d1t $HOME/telnetlog/* | head -n 1 }
Of course if you do that, you'll want to occasionally (via cronjob?) delete old archives.
find $HOME/telnetlog/ -type f -mtime +6 -delete
Transfer a file by issuing a Remote Telnet Command
function flash-roku { target=$1 filename=$2 port="8081" nc -w 5 $target $port < $filename & { echo \ "cd /tmp && nc -l -p $port > tempfile.txt && " \ "tail tempfile.txt"; \ sleep 10; } | telnet $target }
telnet.1577037019.txt.gz · Last modified: 2023/04/12 20:44 (external edit)