{"id":8178,"date":"2019-01-15T07:58:29","date_gmt":"2019-01-15T07:58:29","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=8178"},"modified":"2019-01-24T03:40:05","modified_gmt":"2019-01-24T03:40:05","slug":"easy-file-sharing-from-linux-commandline","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/15\/easy-file-sharing-from-linux-commandline\/","title":{"rendered":"Easy File Sharing from Linux Commandline"},"content":{"rendered":"<h1 class=\"post-title\">Transfer.sh \u2013 Easy File Sharing from Linux Commandline<\/h1>\n<p><strong>Transfer.sh<\/strong>\u00a0is a simple, easy and fast service for file sharing from the command-line. It allows you to upload up to\u00a0<strong>10GB<\/strong>\u00a0of data and files are stored for 14 days, for free.<\/p>\n<p>You can maximize amount of downloads and it also supports encryption for security. It supports the local file system (local); together with s3 (Amazon S3), and gdrive (Google Drive) cloud storage services.<\/p>\n<div id=\"attachment_31558\" class=\"wp-caption aligncenter\"><a href=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/Easy-File-Sharing-in-Linux-Terminal.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-31558\" src=\"https:\/\/www.tecmint.com\/wp-content\/uploads\/2019\/01\/Easy-File-Sharing-in-Linux-Terminal.png\" alt=\"Transfer.sh - Easy File Sharing in Linux Terminal\" width=\"670\" height=\"342\" data-lazy-loaded=\"true\" \/><\/a><\/p>\n<p class=\"wp-caption-text\">Transfer.sh \u2013 Easy File Sharing in Linux Terminal<\/p>\n<\/div>\n<p>It is designed to be used with the Linux shell. In addition, you can preview your files in the browser. In this article, we will show how to use transfer.sh in Linux.<\/p>\n<h3>Upload a Single File<\/h3>\n<p>To upload a file, you can use the\u00a0<a href=\"https:\/\/www.tecmint.com\/linux-curl-command-examples\/\" target=\"_blank\" rel=\"noopener\">curl program<\/a>\u00a0with the\u00a0<code>--upload-file<\/code>\u00a0option as shown.<\/p>\n<pre>$ curl --upload-file .\/tecmint.txt https:\/\/transfer.sh\/tecmint.txt\r\n<\/pre>\n<h3>Download a File<\/h3>\n<p>To download your file, a friend or colleague can run the following command.<\/p>\n<pre>$ curl https:\/\/transfer.sh\/Vq3Kg\/tecmint.txt -o tecmint.txt \r\n<\/pre>\n<h3>Upload Multiple Files<\/h3>\n<p>You can upload multiple files at once, for example:<\/p>\n<pre>$ curl -i -F filedata=@\/path\/to\/tecmint.txt -F filedata=@\/path\/to\/usernames.txt https:\/\/transfer.sh\/ \r\n<\/pre>\n<h3>Encrypt Files Before Transfer<\/h3>\n<p>To\u00a0<a href=\"https:\/\/www.tecmint.com\/tomb-file-encryption-and-backup-tool-for-linux\/\" target=\"_blank\" rel=\"noopener\">encrypt your files<\/a>\u00a0before the transfer, use the following command (you must have the gpg tool installed on the system). You will be prompted to enter a password to encrypt the file.<\/p>\n<pre>$ cat usernames.txt | gpg -ac -o- | curl -X PUT --upload-file \"-\" https:\/\/transfer.sh\/usernames.txt \r\n<\/pre>\n<p>To download and decrypt the above file, use the following command:<\/p>\n<pre>$ curl https:\/\/transfer.sh\/11Rnw5\/usernames.txt | gpg -o- &gt; .\/usernames.txt\r\n<\/pre>\n<h3>Use Wget Tool<\/h3>\n<p><strong>Transfer.sh<\/strong>\u00a0also supports the\u00a0<a href=\"https:\/\/www.tecmint.com\/10-wget-command-examples-in-linux\/\" target=\"_blank\" rel=\"noopener\">wget tool<\/a>. To upload a file, run.<\/p>\n<pre>$ wget --method PUT \u2013body-file=.\/tecmint.txt https:\/\/transfer.sh\/tecmint.txt -O --nv \r\n<\/pre>\n<h3>Create Alias Command<\/h3>\n<p>To use the short transfer command, add an alias to your\u00a0<strong>.bashrc<\/strong>\u00a0or\u00a0<strong>.zshrc<\/strong>\u00a0startup file.<\/p>\n<pre>$ vim ~\/.bashrc\r\nOR\r\n$ vim ~\/.zshrc\r\n<\/pre>\n<p>Then add the lines below in it (you can only choose one tool, either\u00a0<strong>curl<\/strong>\u00a0or\u00a0<strong>wget<\/strong>).<\/p>\n<pre>##using curl\r\ntransfer() {\r\n    curl --progress-bar --upload-file \"$1\" https:\/\/transfer.sh\/$(basename $1) | tee \/dev\/null;\r\n}\r\n\r\nalias transfer=transfer\r\n##using wget\r\ntransfer() {\r\n    wget -t 1 -qO - --method=PUT --body-file=\"$1\" --header=\"Content-Type: $(file -b --mime-type $1)\" https:\/\/transfer.sh\/$(basename $1);\r\n}\r\n\r\nalias transfer=transfer\r\n<\/pre>\n<p>Save the changes and close the file. Then source it to apply the changes.<\/p>\n<pre>$ source ~\/.bashrc\r\nOR\r\n$ source ~\/.zshrc\r\n<\/pre>\n<p>From now on, you upload a file using the transfer command as shown.<\/p>\n<pre>$ transfer users.list.gz\r\n<\/pre>\n<p>To setup your own sharing server instance, download the program code from the\u00a0<a href=\"https:\/\/github.com\/dutchcoders\/transfer.sh\/\" target=\"_blank\" rel=\"nofollow noopener\">Github repository<\/a>.<\/p>\n<p>You can find more information and sample use cases in the project homepage:\u00a0<a href=\"https:\/\/transfer.sh\/\" target=\"_blank\" rel=\"nofollow noopener\">https:\/\/transfer.sh\/<\/a><\/p>\n<p><strong>Transfer.sh<\/strong>\u00a0is a simple, easy and fast service for file sharing from the command-line.<\/p>\n<p><a href=\"https:\/\/www.tecmint.com\/file-sharing-from-linux-commandline\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Transfer.sh \u2013 Easy File Sharing from Linux Commandline Transfer.sh\u00a0is a simple, easy and fast service for file sharing from the command-line. It allows you to upload up to\u00a010GB\u00a0of data and files are stored for 14 days, for free. You can maximize amount of downloads and it also supports encryption for security. It supports the local &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2019\/01\/15\/easy-file-sharing-from-linux-commandline\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Easy File Sharing from Linux Commandline&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8178","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/8178","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=8178"}],"version-history":[{"count":2,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/8178\/revisions"}],"predecessor-version":[{"id":8670,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/8178\/revisions\/8670"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=8178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=8178"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=8178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}