PBEasy (ppb) is a Bash script that streamlines the process of creating,
uploading, and commenting on PrivateBin
pastes directly from your terminal. It provides an interactive interface
for replying to comments, supports attachments, and integrates with your
preferred text editor.
NOTE:
Unfortunately I get the same error message, if the Paste has expired, Comments are off or it just temporary fails to get the JSON data (which can happen).
So if you're sure, the Paste hasn't expired and Comments are turned on, simply try again to fetch the Comments of the Paste.
You also have to delete expired Pastes manually if you don't want your cache be cluttered with old Pastes. There is no easy way to determine if a Paste has expired, so you have to do it manually. If you're not sure, try to use the "Open" function, to see if the Paste is still available.
You can also delete the current cache file and start with a clean one (use with care!).
- Interactive use of the
ppbcommand, when used without parameters and pipe - Create new PrivateBin pastes from files or stdin. These are automatically added to a local cache for easy access.
- Upload attachments (images, files) with optional comments. Also automatically added to the cache.
- Interactive comment/reply selection using
dialog. - Reply to nested comments with preview and editing.
- Clipboard integration: Automatically copies resulting URLs using
xclip. - Uses your
$EDITORfor editing comments and replies. - Customizable defaults via a config file.
Make sure the following tools are installed:
pbcli(PrivateBin CLI client written in rust)jq(JSON processor)dialog(terminal UI)xclip(clipboard utility)fold,mktemp,diff,cat,tee(coreutils)- A text editor set in your
$EDITORenvironment variable (e.g.,nvim,vim,nano)
-
Download the script:
Save the
ppbscript to a directory in your$PATH, for example:mkdir -p ~/bin cp ppb ~/bin/ chmod +x ~/bin/ppb
Ensure
~/binis in your$PATH(addexport PATH="$HOME/bin:$PATH"to your shell config if needed). -
Create initial configuration:
Run:
ppb -i
This creates a config file at
$XDG_CONFIG_HOME/pbeasy/config.sh(defaults to~/.config/pbeasy/config.sh). Edit this file to change default server, format, or discussion settings.
ppb [-i] | [ -u <FILE> | -c <URL> ] [ -d | -D ] [-f <FORMAT> ] [-s <HOST URL>] [-n <name>] | [-h]-
-i
Create a default config file at$XDG_CONFIG_HOME/pbeasy/config.shwith default settings. -
-u <FILE>
Upload a paste from command line as an Attachment. Images will be shown. Plaintext, Markdown and Source Code must be piped in, otherwise they'll be shown only as an attachment! If no URL is provided, sends to your configured PrivateBin instance. -
-c <URL>
Comment or reply to a comment on a PrivateBin paste. If a URL is provided, fetches comments and allows replying by choosing a comment/reply from a list (with preview). The content you reply to is copied into your edit file in your$EDITOR. If no comment is selected, creates a new comment. Uses the--comment-as=namefrom yourpbcliconfig file by default as your pseudonym. If not set, it's anonymous. -
-d
Enable discussion/comments for the paste, discussion is on by default. -
-D
Disable discussion/comments for the paste, discussion is on by default. -
-s <HOST URL>
Specify the PrivateBin server. Defaults tohttps://privatebin.net/. -
-f <FORMAT>
Specify the paste format:markdown,plaintext, orsyntax. Default isplaintext. -
-n <name>
Specify Name for the Paste, otherwise the actual date will be used as name in the cache. -
-hShow help message.
-
Run without arguments or piping to enter interactive mode and browse stored URLs:
ppb
This lets you open, comment/reply, or delete pastes in the cache. Note: There is no easy way to determine if a paste has expired, so you must delete them manually if they no longer work. You can also delete the whole cache file and start with a clean one (use with care!).
-
Send a file as a new PrivateBin paste in markdown format:
ppb -f markdown < file.mdThe link will automatically be added to your cache (and needs to be deleted later).
-
Comment or reply to a comment on a given paste:
ppb -c "https://your.privatebin/paste#key"The link to the paste will be automatically added to your cache.
-
Send a new paste with comments enabled in plaintext format using piping:
cat political_statement.txt | ppb -d -f plaintextThe paste will be added to your cache.
-
Send an image with a comment and a custom name:
echo "My nice picture" | ppb -u image.png -n 'Nice Image'
This sends image.png with the comment "My nice picture" as a new paste. The paste will be added to your cache with the name "Nice Image" (names are just short identifiers to help you find them).
Edit $XDG_CONFIG_HOME/pbeasy/config.sh to set:
HOST(default PrivateBin server)FORMAT(default paste format)DISCUSSION(enable/disable comments by default)
Other options (like --comment-as=<name>) are read from your pbcli config file.
If you have any problems with ppb, use the Issue tracker:
This script is licensed under the GPL-3.0-only license. See LICENSE for details.

