1

Does some sort of command like:

echotonet "this"

or

cat file.txt > echonet

that could allow one to easily paste text document data to a service like paste.debian.net ?

I often use paste.debian.net in order to retrieve on some machines pieces of scripts too long to be written in shell and edited in a visual environment like windows or ubuntu.

I download them with a classic wget:

wget -O namefile.sh https://paste.debian.net/some_path_to_the_paste_in_raw_format

Very often, however, there's the need to retrieve data too, like for debugging purposes or when I have to paste lot of log lines on here or on boards.

A easy to post command that upload a full txt file or zip a directory and gives back a short url would be gold.

To my mind the wetransfer command could be maybe a solution but maybe there are other options like a proper debian package for it.

1
  • pastebinit is the one I've used the most, but several exists - you might have to configure them to use the pastebin you prefer. Commented Apr 30, 2024 at 15:51

1 Answer 1

2

I mean, for your mentioned paste.debian.net, there's several clients linked to from the website.

The debian repos carry pastebinit, which you can use, it's nice enough. I typically don't care enough to install it; what it does is "small" enough that curl does it well enough;

curl -F file=@myfile https://0x0.st

to upload myfile, or command | curl -F file=@- https://0x0.st to upload the output of command.

Of course, if you need that more often, adding the following to your .bashrc or .zshrc (depending on which shell you use) would give you convenient tool:

function share() {
  if [[ $# -eq 1 ]]; then
    local output="$(curl --progress-bar -F "file=@$1" https://0x0.st)/$(basename "$1")"
  else
    local output="$(curl --progress-bar -F "file=@-" https://0x0.st)/stdout"
  fi

  # check whether we run in a terminal and whether we have the qrencode tool
  if [[ -t 1 ]] && command -v qrencode >/dev/null; then
    # show QR code
    qrencode -t ANSIUTF8 "${output}"
  fi

  printf "%s\n" "${output}"
}

Note that you might simply use scp to copy your files of interest to an SSH server under your control; or put them on a cloud file bucket; there's many low-cost providers. Not all logs and files are safe to be publicly uploaded!

3
  • You name pastebinit, can you provide an example of this command with debian paste for reference? Thank you so much. Regarding the other options maybe it could work also wput but I didn't tried yet. Commented May 1, 2024 at 5:56
  • @user3450548 you're right, there was a recent bug report that paste.debian.net stopped working for unknown reasons: bugs.launchpad.net/pastebinit/+bug/1925245 Commented May 1, 2024 at 6:50
  • @user3450548 so, stick with what I propose :) Commented May 1, 2024 at 6:50

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.