<HTML ><HEAD ><TITLE >ASCII upload and cat</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.7"><LINK REL="HOME" TITLE="Remote Serial Console HOWTO" HREF="index.html"><LINK REL="UP" TITLE="Uploading files from a serial console" HREF="upload.html"><LINK REL="PREVIOUS" TITLE="Disable logging to console" HREF="upload-logging.html"><LINK REL="NEXT" TITLE="Xmodem, Ymodem and Zmodem" HREF="upload-zmodem.html"></HEAD ><BODY CLASS="SECTION" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE SUMMARY="Header navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >Remote Serial Console HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="upload-logging.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" >Appendix B. Uploading files from a serial console</TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="upload-zmodem.html" ACCESSKEY="N" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECTION" ><H1 CLASS="SECTION" ><A NAME="UPLOAD-CAT" ></A >B.2. <SPAN CLASS="ACRONYM" >ASCII</SPAN > upload and <B CLASS="COMMAND" >cat</B ></H1 ><P ><B CLASS="COMMAND" >cat</B > is available on every <SPAN CLASS="ACRONYM" >UNIX</SPAN >-like system. It copies the data received from the keyboard to a file. Minicom and other terminal emulators have an <SPAN CLASS="QUOTE" >"<SPAN CLASS="ACRONYM" >ASCII</SPAN > upload"</SPAN > facility that will send a file up the serial link as though it had been typed.</P ><DIV CLASS="INFORMALFIGURE" ><A NAME="AEN3384" ></A ><P ></P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><TT CLASS="PROMPT" >remote bash$</TT > <B CLASS="COMMAND" >cat > upload.txt</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><B CLASS="KEYCAP" >Alt</B >-<B CLASS="KEYCAP" >S</B > <SPAN CLASS="GUIMENU" >Upload</SPAN > <SPAN CLASS="GUIMENUITEM" >ascii</SPAN > <SPAN CLASS="GUILABEL" >[ascii upload - Press CTRL-C to quit]</SPAN ></PRE ></FONT ></TD ></TR ></TABLE ><P CLASS="LITERALLAYOUT" >Wait for upload to complete…</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><SPAN CLASS="GUILABEL" >ASCII upload of "upload.txt" 10.0 Kbytes transferred at 3900 CPS... Done. READY: press any key to continue...</SPAN ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><B CLASS="KEYCAP" >Ctrl</B >-<B CLASS="KEYCAP" >D</B > <TT CLASS="PROMPT" >remote bash$</TT ></PRE ></FONT ></TD ></TR ></TABLE ><P ></P ></DIV ><P >Without hardware flow control <SPAN CLASS="ACRONYM" >ASCII</SPAN > upload will drop the occassional character.</P ><P >To upload binary files encode them into <SPAN CLASS="ACRONYM" >ASCII</SPAN >, upload them, and then decode them into binary again.</P ><DIV CLASS="INFORMALFIGURE" ><A NAME="AEN3407" ></A ><P ></P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><TT CLASS="PROMPT" >localhost bash$</TT > <B CLASS="COMMAND" >uuencode upload.bin < upload.bin > upload.txt</B ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><B CLASS="KEYCAP" >Alt</B >-<B CLASS="KEYCAP" >S</B > <SPAN CLASS="GUIMENU" >Upload</SPAN > <SPAN CLASS="GUIMENUITEM" >ascii</SPAN > <SPAN CLASS="GUILABEL" >[ascii upload - Press CTRL-C to quit]</SPAN ></PRE ></FONT ></TD ></TR ></TABLE ><P CLASS="LITERALLAYOUT" >Wait for upload to complete…</P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><SPAN CLASS="GUILABEL" >ASCII upload of "upload.txt" 10.0 Kbytes transferred at 3900 CPS... Done. READY: press any key to continue...</SPAN ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><B CLASS="KEYCAP" >Ctrl</B >-<B CLASS="KEYCAP" >D</B > <TT CLASS="PROMPT" >remote bash$</TT ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><TT CLASS="PROMPT" >remote bash$</TT > <B CLASS="COMMAND" >uudecode < upload.txt</B ></PRE ></FONT ></TD ></TR ></TABLE ><P ></P ></DIV ><P >You can detect transmission errors by using a checksum program such as <B CLASS="COMMAND" >sum</B >, <B CLASS="COMMAND" >cksum</B > or <B CLASS="COMMAND" >md5sum</B >. Print the ckecksum of the file before it is sent from the local machine and after it is recieved upon the remote machine.</P ><DIV CLASS="INFORMALFIGURE" ><A NAME="AEN3433" ></A ><P ></P ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><TT CLASS="PROMPT" >localhost bash$</TT > <B CLASS="COMMAND" >cksum upload.bin</B > <TT CLASS="COMPUTEROUTPUT" >1719761190 76 upload.bin</TT ></PRE ></FONT ></TD ></TR ></TABLE ><TABLE BORDER="1" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><FONT COLOR="#000000" ><PRE CLASS="SCREEN" ><TT CLASS="PROMPT" >remote bash$</TT > <B CLASS="COMMAND" >cksum upload.bin</B > <TT CLASS="COMPUTEROUTPUT" >1719761190 76 upload.bin</TT ></PRE ></FONT ></TD ></TR ></TABLE ><P ></P ></DIV ><P >There are a number of checksumming programs. The <B CLASS="COMMAND" >sum</B > command should be used with caution, as there are versions for <SPAN CLASS="ACRONYM" >BSD</SPAN > and <SPAN CLASS="PRODUCTNAME" >System V <SPAN CLASS="ACRONYM" >UNIX</SPAN ></SPAN > which give differing results. <B CLASS="COMMAND" >cksum</B > is the attempt by the <SPAN CLASS="ACRONYM" >POSIX</SPAN > standards developers to correct that mess: it gives the same result for the same file on all <SPAN CLASS="ACRONYM" >POSIX</SPAN > machines.</P ><P >If the checksums of the original and uploaded files do not match then the file will have to be uploaded again. If the link is noisy and the file is big then you may never get a successful upload. What is needed in this case is to divide the file into many small parts, upload a part, check its checksum, and if it is fine proceed to the next part.</P ><P >This sounds like something that should be automated. Entering from stage left is <SPAN CLASS="APPLICATION" >Xmodem</SPAN >.</P ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE SUMMARY="Footer navigation table" WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="upload-logging.html" ACCESSKEY="P" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" ACCESSKEY="H" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="upload-zmodem.html" ACCESSKEY="N" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Disable logging to console</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="upload.html" ACCESSKEY="U" >Up</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><SPAN CLASS="APPLICATION" >Xmodem</SPAN >, <SPAN CLASS="APPLICATION" >Ymodem</SPAN > and <SPAN CLASS="APPLICATION" >Zmodem</SPAN ></TD ></TR ></TABLE ></DIV ></BODY ></HTML >