推薦一款 GitHub 星標 11.5K 的命令行文件傳輸神器(開源免費,支持 10GB 大文件)
在工作和生活中,我們經(jīng)常需要在不同設(shè)備之間傳輸文件,但往往會遇到需要安裝第三方軟件、文件大小限制、傳輸速度慢等問題。安裝第三方軟件還好,但是限制傳輸速度和文件大小就非常惡心了,用著用著就得逼得你充值付費了。不然緊急需要傳輸一個東西,就非常花費時間和精力了。

1軟件介紹
Easy and fast file sharing from the command-line.
當然,我們可以也使用,老牌的 百度云盤(非會員限速)、Dropbox(速度非常之慢)和 Google Drive(需要科學(xué)上網(wǎng)),新進的 阿里云盤(雖然不限速但上傳不能加速)、奶牛快傳(有文件大小總量限制)。但是這里我們要介紹的是一個基于命令行的文件傳輸工具 —— transfer.sh。
Made for use with shell Share files with a URL For free Upload up to 10 GB Files stored for 14 days Encrypt your files Maximize amount of downloads
2使用方式
Sample use cases
[1] 命令行使用
# 將shell函數(shù)添加到.bashrc或.zshrc文件中
transfer() {
if [ $# -eq 0 ]; then
echo "No arguments specified."
echo "Usage: "
echo " transfer <file|directory> ... | transfer <file_name>"
return 1
fi
if tty -s; then
file="$1"
file_name=$(basename "$file")
if [ ! -e "$file" ]; then
echo "$file: No such file or directory"
return 1
fi
if [ -d "$file" ]; then
file_name="$file_name.zip"
(cd "$file" && zip -r -q - .) | curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
else
cat "$file" | curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name" | tee /dev/null
fi
else
file_name="$1"
curl --progress-bar --upload-file "-" "https://transfer.sh/$file_name"|tee /dev/null
fi
}
# 現(xiàn)在可以使用函數(shù)來上傳文件
$ transfer hello.txt
[2] 簡單上傳文件 - 官方支持界面上傳
# 使用curl命令上傳文件
$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt
https://transfer.sh/66nb8/hello.txt
# 上傳文件設(shè)定最大下載次數(shù)和過期時間
$ curl -H "Max-Downloads: 1" -H "Max-Days: 5" --upload-file ./hello.txt https://transfer.sh/hello.txt
https://transfer.sh/66nb8/hello.txt
# 下載文件
$ curl https://transfer.sh/66nb8/hello.txt -o hello.txt
# 還支持wget上傳文件
$ wget --method PUT --body-file=/tmp/file.tar https://transfer.sh/file.tar -O - -nv
# 還支持HTTPie上傳文件
$ http https://transfer.sh/ -vv < /tmp/test.log
# 還支持PowerShell上傳文件
PS H:\> invoke-webrequest -method put -infile .\file.txt https://transfer.sh/file.txt
[3] 一次上傳多個文件
# 使用filedata執(zhí)行文件地址
$ curl -i -F filedata=@/tmp/hello.txt -F filedata=@/tmp/hello2.txt https://transfer.sh/
# 將下載合并為zip或tar存檔
$ curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello.txt).tar.gz
$ curl https://transfer.sh/(15HKz/hello.txt,15HKz/hello.txt).zip
[4] 傳輸前使用加密您的文件
# 使用gpg加密文件
$ cat /tmp/hello.txt | gpg -ac -o- | curl -X PUT --upload-file "-" https://transfer.sh/test.txt
# 下載并解密
$ curl https://transfer.sh/1lDau/test.txt | gpg -o- > /tmp/hello.txt
# 使用openssl加密文件
$ cat /tmp/hello.txt | openssl aes-256-cbc -pbkdf2 -e | curl -X PUT --upload-file "-" https://transfer.sh/test.txt
# 下載并解密
$ curl https://transfer.sh/1lDau/test.txt | openssl aes-256-cbc -pbkdf2 -d > /tmp/hello.txt
# 從keybase導(dǎo)入key
$ keybase track [them]
# 加密文件
$ cat somebackupfile.tar.gz | keybase encrypt [them] | curl --upload-file '-' https://transfer.sh/test.txt
# 解密下載
$ curl https://transfer.sh/sqUFi/test.md | keybase decrypt
[5] 掃描惡意軟件
# 使用Clamav掃描惡意軟件或病毒
$ wget http://www.eicar.org/download/eicar.com
$ curl -X PUT --upload-file ./eicar.com https://transfer.sh/eicar.com/scan
# 上傳惡意軟件到VirusTotal并獲得永久鏈接
$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal
[6] 加密傳輸備份 mysql 數(shù)據(jù)庫
# 備份+加密+傳輸
$ mysqldump --all-databases | gzip | gpg -ac -o- | curl -X PUT --upload-file "-" https://transfer.sh/test.txt
[7] 發(fā)送帶有傳輸鏈接的電子郵件
# 傳輸和發(fā)送帶有鏈接的電子郵件
$ transfer /tmp/hello.txt | mail -s "Hello World" [email protected]
[8] 傳輸日志文件
# grep syslog for pound and transfer
$ cat /var/log/syslog | grep pound | curl --upload-file - https://transfer.sh/pound.log
3參考鏈接
transfer.sh 官方網(wǎng)站 transfer.sh 的 Github 倉庫地址
文章作者: Escape
原文:https://tinyurl.com/5chzpk9w
轉(zhuǎn)自:奇妙的Linux世界
往期推薦
有收獲,點個在看
評論
圖片
表情

