Skip to content

Instantly share code, notes, and snippets.

@samarpanda
Last active December 10, 2015 17:38
Show Gist options
  • Save samarpanda/4469034 to your computer and use it in GitHub Desktop.
Save samarpanda/4469034 to your computer and use it in GitHub Desktop.
Upload image to server and copy the link to clipboard using bash!

Bash tips

Copy these functions to .bash_profile or .bashrc

Upload file to server using curl

function curlp(){
  curl -u username:password -T $1 ftp://domain.com/dir/$1;
	echo "http://domain.com/dir/$1" | pbcopy;
	echo "Copied to clipboard: http://domain.com/dir/$1"
}

Usage curlp file_name

Upload file to server using ssh

function scpp(){
  scp "$1" username@domain.com:dir;
	echo "http://domain.com/dir/$1" | pbcopy;
	echo "Copied to clipboard: http://domain.com/dir/$1"
}

Usage scpp file_name

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment