Pb - ArchWiki

# Pb

From ArchWiki

Related articles

- Copying text from a terminal
- Pastebin

pb is a lightweight pastebin and URL shortener built, written in Python using Flask. The official instance is https://ptpb.pw/.

Warning: A pastebin should not be used for sharing confidential or private information.

## Installation

### Server

Install the nodejs-gruntAUR and pb-gitAUR packages, and enable `pb.service`.

To configure the server, edit the `/etc/uwsgi/pb.ini` file.

### Client

Any download manager supporting HTTP POST requests may be used, such as curl. Alternatively, a native client may be used:

- pbpst — https://github.com/HalosGhost/pbpst pbqst

  A pb client written in C. || pbpst pbpst-gitAUR

## Usage

This article or section needs expansion.

Reason: Add information about server usage/configuration (Discuss in Talk:Pb#)

A paste may be created with a POST request as follows: [1] [2]

    curl -F c=@- https://ptpb.pw < file

See https://ptpb.pw and API specification for more information.

Note: pb also provides an HTML form at the `/f` path, for example https://ptpb.pw/f.

### pbpst

See pbpst(1) and pbpst_db(5) for usage details.

Note:

- When taking standard input from a terminal, press `Ctrl+D` twice to process the data. [3]
- The provider may be configured with `--provider`. (defaults to https://ptpb.pw)
- By default pbpst only prints the URL at which the paste is available. The full output may be retrieved with `--verbose`.

### Expiration

This article or section needs language, wiki syntax or style improvements. See Help:Style for reference.

Reason: Not specific to pbpst, duplication with pbpst(1) (Discuss in Talk:Pb#)

By default pastes are created with no expiration time. They'll last as long as the service's operator let them. `-x` option may be used to set the number of seconds after which a paste should be removed:

    $ thePaste="$(cat /dev/urandom | tr -cd [:print:] | head -c 32)"
    $ echo "$thePaste"
    cnf[HiC%Ybe't]4aSeIruw5hkB.h~i^B

    $ echo "$thePaste" | pbpst -S -m 'A test message that expires after 60s' -x 60
    https://ptpb.pw/scrubbed

    $ date; curl 'https://ptpb.pw/scrubbed'
    Tue Apr 12 19:11:41 CEST 2016
    cnf[HiC%Ybe't]4aSeIruw5hkB.h~i^B

    $ date; curl 'https://ptpb.pw/scrubbed'
    Tue Apr 12 19:13:06 CEST 2016
    status: not found

The expired pastes, while no longer available from the remote service, are still listed in the local database:

    $ pbpst -Dq expires
    deadbeef-dead-beef-dead-1111111111	https://ptpb.pw/scrubbed	A test message that expires after 60s	1460481140

To prune them `-Dy` should be used:

    $ pbpst -Dy
    $ pbpst -Dq expires

Category:

- Web applications

Hidden categories:

- Pages or sections flagged with Template:Expansion
- Pages or sections flagged with Template:Style