Share files from command line with transfer.sh: a simple cheatsheet

Transfer.sh is a website that helps users to share files from the command-line an efficient way.
It won’t required any additional software to work except cURL.

If your linux distribution doesn’t have cUrl (unlikely!), you can install it with

sudo apt install curl

The service is free and allows users to upload files up to 10 GB, that are deleted automatically from server after 14 days.

Here a brief cheatsheet.

Upload

$ curl --upload-file ./hello.txt https://transfer.sh/hello.txt

Encrypt & upload

$ cat /tmp/hello.txt|gpg -ac -o-|curl -X PUT --upload-file "-" https://transfer.sh/test.txt

Download & decrypt

$ curl https://transfer.sh/1lDau/test.txt|gpg -o- > /tmp/hello.txt

Upload and check with virustotal

$ curl -X PUT --upload-file nhgbhhj https://transfer.sh/test.txt/virustotal

Bash/Zsh alias

Add  to .bashrc or .zshrc:

transfer() {
# write to output to tmpfile because of progress bar
tmpfile=$( mktemp -t transferXXX )
curl --progress-bar --upload-file $1 https://transfer.sh/$(basename $1) >> $tmpfile;
cat $tmpfile;
rm -f $tmpfile;
}

alias transfer=transfer

Usage:

$ transfer test.txt

Boost your console productivity on tmux

With “ Oh My Tmux!”, a self-contained, pretty and versatile tmux configuration file

tmux is a tool that can be used to multiplex several virtual consoles, allowing a user to access multiple separate terminal sessions inside a single terminal window or remote terminal session.

It lets you switch easily between several programs in one terminal, detach them (they keep running in the background) and reattach them to a different terminal.

The commands are pretty simple to memorize, but if you need a quick reference, you can use this cheat sheet:

https://gist.github.com/afair/3489752

However, tmux may be very useful only if properly configured.

Regarding that, I want to share “Oh My Tmux!”, a configuration file edited by Gregory Pakosz, which expands the possibilities of tmux in a remarkable way.

Features

  • C-a acts as secondary prefix, while keeping default C-b prefix
  • visual theme inspired by Powerline
  • maximize any pane to a new window with <prefix> +
  • SSH aware username and hostname status line information
  • mouse mode toggle with <prefix> m
  • automatic usage of reattach-to-user-namespace if available
  • laptop battery status line information
  • uptime status line information
  • optional highlight of focused pane (tmux >= 2.1)
  • configurable new windows and panes behavior (optionally retain current path)
  • SSH aware split pane (reconnects to remote server, experimental)
  • copy to OS clipboard (needs reattach-to-user-namespace on macOS, xsel or xclip on Linux)
  • Facebook PathPicker integration if available
  • Urlview integration if available

Installation

Requirements:

  • tmux >= 2.1 running inside Linux, Mac, OpenBSD, Cygwin or WSL (Bash on Ubuntu on Windows)
  • outside of tmux, $TERM must be set to xterm-256color

To install, run the following from your terminal: (you may want to backup your existing ~/.tmux.conf first)

$ cd
$ git clone https://github.com/gpakosz/.tmux.git
$ ln -s -f .tmux/.tmux.conf
$ cp .tmux/.tmux.conf.local .

Then proceed to customize your ~/.tmux.conf.local copy.


More information and downloads

Check and Fix SD Card from the android terminal emulator

Your Android SD card gets “corrupted” and you don’t have a PC to connect the smartphone and make the check of SD card?

It’s possibile to make this operation directly from the smartphone? (rooted and with busybox installed, of course!)


“It Could Work!”

The binary to do the job is called fsck* (or fsck_msdos), and usually located in /system/bin.

First we need to find the device your SD card is bound to. If it’s mounted, the mount command will assist us:

mount | grep -i sdcard

Check the output and see where your SD card sits.

Output may include something like

mount | grep sdcard1

Now we can go for the repair job:

su
fsck_msdos -y /dev/block/vold/179:65
fsck output

And after simply reboot the phone!