No-Install public command-line pastebin services

Sometimes we might want to easily share terminal output.

While this can be accomplished directly in the forums or manually through websites like pastebin, there also exist a number of open services that allow you to paste and share directly from the command line by using tools you already have installed.

This is great for many situations, including troubleshooting from a non-graphical boot, or simply very large outputs. Here I will share a few examples and how to use them.


Services and Examples:


ix.io

<command> | curl -F 'f:1=<-' ix.io


sprunge.us

<command> | curl -F 'sprunge=<-' http://sprunge.us


paste.c-net.org

<command> | curl -s --data-binary @- 'https://paste.c-net.org/'



Aliases and other tricks:


To quasi-install ix.io pasting service add the following to your bashrc (zshrc not tested):

ix.io bashrc
ix() {
    local opts
    local OPTIND
    [ -f "$HOME/.netrc" ] && opts='-n'
    while getopts ":hd:i:n:" x; do
       case $x in
            h) echo "ix [-d ID] [-i ID] [-n N] [opts]"; return;;
            d) $echo curl $opts -X DELETE ix.io/$OPTARG; return;;
            i) opts="$opts -X PUT"; local id="$OPTARG";;
           n) opts="$opts -F read:1=$OPTARG";;
        esac
    done
    shift $(($OPTIND - 1))
    [ -t 0 ] && {
        local filename="$1"
        shift
        [ "$filename" ] && {
            curl $opts -F f:1=@"$filename" $* ix.io/$id
            return
        }
        echo "^C to cancel, ^D to send."
    }
    curl $opts -F f:1='<-' $* ix.io/$id
}

Then open a new shell and type ix -h


To quasi-install sprunge.us pasting service add the following to your bashrc (zshrc untested):

sprunge.us bashrc
sprunge() {
  if [[ $1 ]]; then
    curl -F 'sprunge=<-' "http://sprunge.us" <"$1"
  else
    curl -F 'sprunge=<-' "http://sprunge.us"
  fi
}

Then you can use <command> | sprunge to share output.
Or sprunge <filepath> to share the contents of a file.


To quasi-install paste.c-net.org pasting and sharing add the following to your bashrc (zshrc untested):

paste.cnet.org bashrc
pastebin()
{
    local url='https://paste.c-net.org/'
    if (( $# )); then
        local file
        for file; do
            curl -s \
                --data-binary @"$file" \
                --header "X-FileName: ${file##*/}" \
                "$url"
        done
    else
        curl -s --data-binary @- "$url"
    fi
}
pasteget()
{
    local url='https://paste.c-net.org/'
    if (( $# )); then
        local arg
        for arg; do
            curl -s "${url}${arg##*/}"
        done
    else
        local arg
        while read -r arg; do
            curl -s "${url}${arg##*/}"
        done
    fi
}

Then you can use 'pastebin' and 'pasteget' a few ways:
<command> | pastebin to share output.
pastebin <filepath> <filepath2> to share file(s). 50M limit.
pasteget https://paste.c-net.org/<exampleurl> to download paste.c-net shared content.



Notes and Warnings


  • There is more detailed info at each host, including options like setting expiration time and more.

  • Please dont abuse these services. They are made freely available, so dont knock a good thing.

  • Further stipulations, user and privacy clauses and the like can be found at each project host.

  • Avoid sharing personal information. Example - if sharing inxi make sure to use something like:
    inxi -Fxxxza --no-host

  • Also see this related page: No-Install public command-line file sharing services


15 Likes

Forum kindly sponsored by