ssh trick – ssh to remote host with bastion host

Lot of times, you have to ssh to a server with bastion host. If you dont know what is bastion host then see this:

bastion host


Now, in such cases, either you add an entry in “~/.ssh/config” to route the ssh through the bastion host or do ssh to bastion host and then ssh from there to the actual host. But wait, there is always a better way:


ssh -t <bastion host> ssh -t <actual host>

You can use the usernames as required for the 2 hosts and then you will have to enter passwords, first for the bastion host and then the actual host.

BTW, you can use tunneling options as well with the above command.

View xml files like a pro

Viewing XML files can be daunting with tracking mentally where the tag starts and where it ends. So, I ended up with the following alias to help me view xml files

xmllint --format - | pygmentize -f 16m -O style=native -g

Add files to dropbox with single curl command

I have been thinking of posting this for sometime now. This is very useful, when you are working on a different Linux box and want to upload a file to dropbox.


So, before you run this command, you need to create your auth token in Dropbox developer API page. Once that is done, need to change the 2 parameters in command below. Export your Access token and run the below command.

Here is the command:

tar cvzf /tmp/backup.tgz <folder of your choice>
curl -X POST \
    --header "Authorization: Bearer $OAUTH_ACCESS_TOKEN" \
    --header "Dropbox-API-Arg: {\"path\": \"/<dropbox path>/$(hostname -s)/$NOW.tgz\"}" \
    --header "Content-Type: application/octet-stream" \
    --data-binary @/tmp/backup.tgz