Pastebin: Difference between revisions

From OLPC
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 27: Line 27:
(and Enter). You should see something like:
(and Enter). You should see something like:


-bash-3.2# wget sprunge.us/sprunge; chmod +x sprunge
-bash-3.2# cd /usr/local/bin; wget sprunge.us/sprunge; chmod +x sprunge
--23:03:27-- http://sprunge.us/sprunge
--23:03:27-- http://sprunge.us/sprunge
=> `sprunge' Resolving sprunge.us... 205.196.221.74
=> `sprunge' Resolving sprunge.us... 205.196.221.74
Line 39: Line 39:
If all goes well you now have a script called sprunge, that can be accessed anywhere, that will send text input to a pastebin service.
If all goes well you now have a script called sprunge, that can be accessed anywhere, that will send text input to a pastebin service.


Here is an explanation of the command (which is actually 3 commands separated by semicolons):
Here is an explanation of that last command (which is actually 3 commands separated by semicolons):

The first part, 'cd /usr/local/bin' takes you to a special directory, where everything in that directory will be globally available as a command even if you are not in the directory.
* The first part, 'cd /usr/local/bin' takes you to a special directory, where everything in that directory will be globally available as a command even if you are not in the directory.
The second part, 'wget sprunge.us/sprunge' downloads the 'sprunge' script to your current directory.
The third part, 'chmod +x sprunge', makes the script executable. Without this step, the script would be treated as a plain text file, and wouldn't actually run.
* The second part, 'wget sprunge.us/sprunge' downloads the 'sprunge' script to your current directory.
* The third part, 'chmod +x sprunge', makes the script executable. Without this step, the script would be treated as a plain text file, and wouldn't actually run.


== USE ==
== USE ==

Latest revision as of 23:41, 9 January 2008

A pastebin, also known as a nopaste, is a web application which allows its users to upload snippets of text, usually samples of source code, for public viewing. Among other things, pasting the full (often long) output of (often cryptic) commands entered in the terminal to a pastebin can help community members debug peoples problems with much less typing and frustration.

Getting the text into a webpage can be difficult however, especially on an olpc, as users may not have access to a browser or reliable method of copy/paste while attempting to fix their issues.

The following attempts to provide a relatively easy method to enable painless pasting for olpc users in need of asistance. In fact, you may have been pointed here to install this script, so that someone on IRC can more easily fix your problem. Be sure to complain at them if these instructions are broken or mystifying, so they can make it better!

We will download a small script that we can pipe text into, and the script will output a short url where that text can be viewed.

INSTALLATION

First we need to open the Terminal Activity and you should see a prompt, like:

bash-3.2$

Type at the prompt:

su -

(and Enter) and the prompt should now look something like:

bash-3.2#

The important thing is that the prompt ends in '#'. This means you are now the user 'root', and you have the power to install things. Next type:

cd /usr/local/bin; wget sprunge.us/sprunge; chmod +x sprunge

(and Enter). You should see something like:

-bash-3.2# cd /usr/local/bin; wget sprunge.us/sprunge; chmod +x sprunge
--23:03:27-- http://sprunge.us/sprunge 
           => `sprunge' Resolving sprunge.us... 205.196.221.74
Connecting to sprunge.us|205.196.221.74|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1,137 (1.1K) [text/plain]
100%[==============================================>] 1,137 --.--K/s
23:03:28 (141.28 KB/s) - `sprunge' saved [1137/1137]
-bash-3.2#

If all goes well you now have a script called sprunge, that can be accessed anywhere, that will send text input to a pastebin service.

Here is an explanation of that last command (which is actually 3 commands separated by semicolons):

  • The first part, 'cd /usr/local/bin' takes you to a special directory, where everything in that directory will be globally available as a command even if you are not in the directory.
  • The second part, 'wget sprunge.us/sprunge' downloads the 'sprunge' script to your current directory.
  • The third part, 'chmod +x sprunge', makes the script executable. Without this step, the script would be treated as a plain text file, and wouldn't actually run.

USE

Here is the normal output of the df -h command:

bash-3.2$ df -h
Filesystem            Size  Used Avail Use% Mounted on
mtd0                  1.0G  610M  415M  60% /
tmpfs                  35M     0   35M   0% /dev/shm

Here is how you would send it to the pastebin:

bash-3.2$ df -h | sprunge
http://sprunge.us/jywp         # plain text
http://sprunge.us/?jywp        # guess lang and highlight
http://sprunge.us/?jywp&<lang> # force lang and highlight

All we really care about is the first, URL, where the output of the command will now be available for your helper person to look at.