Tag Archives: Ssh

Change password on UNIX machine

I needed to change my password on a UNIX machine. After logging in over ssh you type:


You’re welcome!

Automatically upload screenshots

I take a lot of screenshots and was looking for a way to to the following:

  1. take a screenshot
  2. copy that screenshot with a unique name to my webserver
  3. put the full url to the screenshot in my clipboard

See the method below.

	# create a directory 'screenshot' on the desktop
        mkdir ~/Desktop/screenshot;

	# go to that directory
        cd ~/Desktop/screenshot &&

	# capture a selected part of the screen
        screencapture -ix ~/Desktop/screenshot/$(date +%Y-%m-%d-%H-%M-%S).png &&

	# copy this screenshot to my hosting through ssh with scp
        scp ~/Desktop/screenshot/$(ls | xargs | awk '{print $1}') spoon@crsolutions.be:www.spoon-library.be/screenshots/$(ls | xargs | awk '{print $1}') &&

	# add the url to my clipboard
        echo "http://www.spoon-library.be/screenshots/$(ls | xargs | awk '{print $1}')" | pbcopy &&

	# get rid of this directory
        rm -rf ~/Desktop/screenshot;

Thanks to @davelens for his help. You can also follow his blog

SSH completion

I hate it when I need to type the entire host I want to connect to. So I’ve added this to my ~/.bash_profile which autocompletes the ssh command based on my ~/.ssh/config

complete -W “$(awk ‘/^\s*Host\s*/ { sub(/^\s*Host /, “”); print; }’ ~/.ssh/config)” ssh

Thanks to @janmoesen for fixing the error.