Changes between Initial Version and Version 1 of terminal_transcripts


Ignore:
Timestamp:
Dec 3, 2010, 8:06:45 PM (13 years ago)
Author:
Daniel Kahn Gillmor
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • terminal_transcripts

    v1 v1  
     1= Best practices for transcripts from a computer terminal =
     2
     3When using command-line computer utilities (like a shell or a database client), it is sometimes useful to e-mail a transcript of your session to other people, or to post a transcript to [http://paste.debian.net/ a public pastebin] or a ticketing system.
     4
     5This page attempts to document some suggestions for making sure that transcript is clear and useful.
     6
     7[[PageOutline]]
     8
     9== Preserve as plaintext ==
     10
     11some e-mail and web-based systems like to treat things as fancy markup.  a transcript is basically plain text, and should remain as such.  For example, when entering a transcript on this ticketing system, your transcript will be better-preserved and more readable if you prefix it with `{{{` and put `}}}` after it concludes (the docs call this [wiki:WikiFormatting#PreformattedText Preformatted Text].
     12
     13== Avoid linewrapping ==
     14
     15If at all possible, try to preserve the format of you transcript without line-wrapping.  Many popular webmail services enforce line-wrapping, limiting the text to 80 columns wide.  This makes it hard for the people reading your e-mail to know what you actually saw.  If your webmail service or mail user agent does this and you can't figure out how to make it stop, you could paste the transcript into a text file (also without linewrapping!) and attach it to your e-mail.
     16
     17== Include your prompt, and the command you ran! ==
     18
     19You might think people are just interested in the output that the computer shows you.  But they don't know what you ran to generate the output.  They also don't know where you started from.
     20
     21Most shell prompts give a clue about where you started from, so include them, along with the command that you actually ran.
     22
     23== Include the trailing prompt ==
     24
     25It's also very useful to show people where the end of the computer's output is.  You can do this easily by including the trailing prompt that you are returned to.
     26
     27== Include the return code ==
     28
     29If you're using a shell (or other command-line interface that has return codes for each command), modify your shell prompt to include the return code if possible ''before'' generating your transcript.  That adds an extra hint for your readers about what happened, and will be useful for you.
     30
     31If you use bash as your shell, make sure there is a literal `$?` in the prompt someplace.  For a one-off transcript, you can add the return code to the beginning of your prompt with:
     32{{{
     33export PS1='$? '$PS1
     34}}}
     35If you want this permanently, you can do it in `~/.bashrc`, or wherever where the `PS1` environment variable is described.  So if your `~/.bashrc` contains this line:
     36{{{
     37PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
     38}}}
     39you can change it by just adding a `$?` ''inside'' the single-quotes:
     40{{{
     41PS1='$? ${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
     42}}}
     43
     44= Example transcripts =
     45
     46== Bad ==
     47
     48(no bad examples at the moment -- if you have a nice bad example, feel free to add it!)
     49
     50== Good ==
     51
     52{{{
     530 dkg@pip:~$ time wget -O/dev/null http://nytimes.com
     54--2010-12-03 15:05:34--  http://nytimes.com/
     55Resolving nytimes.com... 199.239.136.200
     56Connecting to nytimes.com|199.239.136.200|:80... connected.
     57HTTP request sent, awaiting response... 301 Moved Permanently
     58Location: http://www.nytimes.com/ [following]
     59--2010-12-03 15:05:34--  http://www.nytimes.com/
     60Resolving www.nytimes.com... 199.239.136.200
     61Reusing existing connection to nytimes.com:80.
     62HTTP request sent, awaiting response... 200 OK
     63Length: unspecified [text/html]
     64Saving to: “/dev/null”
     65
     66    [  <=>                                  ] 133,240      623K/s   in 0.2s   
     67
     682010-12-03 15:05:35 (623 KB/s) - “/dev/null” saved [133240]
     69
     70
     71real    0m0.298s
     72user    0m0.004s
     73sys     0m0.004s
     740 dkg@pip:~$
     75}}}