No-Install public command-line file sharing services

Sometimes we might want to easily share a file or post it for later retrieval.

While this can be accomplished directly through websites like imgur or filedropper, 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.

Here I will share a few examples and how to use them.


Services and Examples:


transfer.sh is a service that will allow you to share files quickly.

curl --upload-file <filepath> https://transfer.sh


paste.c-net.org

curl --upload-file '<filepath>' 'http://paste.c-net.org/'


0x0.st can share files, shorten and post from remote URLs. Maximum file size 512MiB.

HTTP POST files here:
curl -F'file=@yourfile.png' http://0x0.st
You can also POST remote URLs:
curl -F'url=http://example.com/image.jpg' http://0x0.st
Or you can shorten URLs:
curl -F'shorten=http://example.com/some/long/url' http://0x0.st


anypaste.xyz is the 'big tuna' here. :fish: :fish: :fish: :fish:
While it is the most finnicky to use without installing, it technically supports pasting/sharing/posting to multiple services.



Aliases and other tricks:


To quasi-install transfer.sh file sharing service add the following to your bashrc or zshrc file:

transfer.sh bashrc/zshrc
transfer() { if [ $# -eq 0 ]; then echo -e "No arguments specified. Usage:\necho transfer /tmp/test.md\ncat /tmp/test.md | transfer test.md"; return 1; fi
tmpfile=$( mktemp -t transferXXX ); if tty -s; then basefile=$(basename "$1" | sed -e 's/[^a-zA-Z0-9._-]/-/g'); curl --progress-bar --upload-file "$1" "https://transfer.sh/$basefile" >> $tmpfile; else curl --progress-bar --upload-file "-" "https://transfer.sh/$1" >> $tmpfile ; fi; cat $tmpfile; rm -f $tmpfile; } 

Then you can use transfer <filepath> to share 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 don't abuse these services. They are made freely available, so don't knock a good thing.

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

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


9 Likes

Forum kindly sponsored by