Skip to content
DeeNewcum edited this page Jun 28, 2012 · 5 revisions

Whenever possible, I prefer to work with URLs instead of other ways of referring to files.

URLs save you time if you work across many different machines. This is because URLs can be copy-n-pasted from one terminal to another very easily, while transferring files between machines (without using URLs) is a much more cumbersome process.

Below are specific types of URLs that I deal with:

SCP

    [user@]host:[file]

SCP URLs are useful when transferring files between hosts. This is particularly true if you have public keys, SSH agent, and agent-forwarding setup and working properly, since that provides a secure way to transfer files between lots of boxes, without having to enter a password for each file-transfer, and without hard-coding passwords anywhere.

Specific ways I use SCP URLs:

  • shell prompt — my shell prompt doubles as a SCP URL to the current directory, neatly displaying the current user+host+directory at the same time
  • scpp — map a local file⇒SCP URL
  • goscp — runs xdg-open on the specified scp path, making it easy to display remote documents on your local machine

HTTP

HTTP URLs are useful when you have files that are available on a website.

Specific ways I use HTTP URLs:

  • url — map a local file⇒HTTP URL
  • rurl — map a HTTP URL⇒local file

The url tool is especially useful if your terminal is configured to allow you to open URLs in your browser when you click on them. This makes it easy to jump from the command-line context to the browser.

The rurl tool is useful in combination with other tools, for example: vim $(rurl http://....). This makes it easy to jump from the browser context back to the command line.

Clone this wiki locally