Get the App
SLTechnology News&Howtos  ›  Servers  › 

Transfer.sh: simply create file sharing from the command line

Shulou Source: shulou.com Published: 2022-06-02 05:02:09 10月14日 Update

Brief introduction

Through a command, the file can be encrypted and transferred to the remote server on the terminal, providing the function of external file sharing.

Transfer.sh this is a file sharing service that I often use on terminals and can replace the sz or scp command in some ways. Through configuration, a command on the terminal can encrypt the file and transfer it to the remote server for easy download. Regular use requires a linux command line basis, although the domestic access is a little slow. In foreign VPS, single-thread download can almost run full bandwidth, it can be said that there is no speed limit. It can't be any better with some terminal command lines that don't have a gui interface.

Installation

Just add the following code to the configuration file of the interactive shell. I'm using zsh, so compile ~ / .zshrc, add this script, write and save, and then perform a refresh of "source ~ / .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; fitmpfile=$ (mktemp-t transferXXX); if tty-s; then basefile=$ (basename" $1 "| sed-e's / [^ a-zA-Z0-9.percent -] /-/ 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;} use

It is also very easy to use. Just execute the "transfer" command on the files that need to be uploaded and shared. For example, there is a BDW.sh script in the current directory that executes "transfer BDW.sh".

After the file is uploaded successfully, it will return a link address, which is the network address of the currently uploaded file. The file will be saved for 14 days by default, and then automatically deleted.

This set of programs is also an open source https://github.com/dutchcoders, and you can also find the server side and deploy it to your own server.

Tags: File command service server terminal address script transmission encryption configuration success next code function foundation that is bandwidth common general aspect Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Shulou Tech Info Redmi OPPO Reno Shulou Technology