# Using Urbit from Unix
With `urb` at your Unix command line, you can execute hoon, run
dojo commands, and more. Additionally, with `fuse`, you can
inspect the urbit namespace.
## Installation
These commands are in the a [separate
repo](https://github.com/urbit/urb). Clone this repo to get the
commands.
You'll also need the `requests` and `fuse` libraries for python.
If you have `pip`, you can just run:
```
pip install requests fuse-python
```
Otherwise, on Ubuntu, run:
```
apt-get install python-requests python-fuse
```
Then you can either run the python commands from the git repo, or
put them somewhere in your path.
## `urb`
`urb` transfers data from a source to a sink. Examples of data
sources include literal data, a file, a URL, or some
tranformation of another source. Examples of data sinks are
stdout, output file, POST request, or dojo command.
Here are some examples. This takes the literal data "hello
world" and sends it to stdout (the default sink).
urb --data 'hello world'
Let's run some hoon code at the dojo.
urb --dojo '(add 2 2)'
Let's convert a markdown file to html.
urb --data @@file.md -m md -m html
Mount the `%home` desk. This syncs the `home` desk into the pier
directory.
urb --dojo '+hood/mount /=home=' --app hood
### Sources
Sources can be any of the following:
- `-d, --dojo command` runs a dojo command. This is commonly
naked hoon code, but it can also be a generator, or any of the
other ways the dojo gets data.
- `-D, --data text` is literal text data, as a cord.
- `-c, --clay path` pulls data from Urbit's filesystem.
- `-u, --url url` pulls data from a URL.
- `-m, --mark mark source` converts the output from another source to
a new 'mark' (datatype).
- `-H, --hoon code source` transforms the output of another
source by running it through some hoon code.
- `[source-0 source-1 ...]`. Sources can be combined into tuples
of different sources.
Any of the arguments to a source (except in the "compound
sources" `--mark` and `--hoon`) can be replaced by `-` to
represent stdin or `@@filename` to pull data in from a Unix file.
Thus, `urb [-D @@file1 -D - -D @@file2]` is equivalent to Unix's
`cat file1 - file2`.
Additionally, if no source is specified, `--data -` (stdin as
literal text data) is assumed.
### Sinks
- `-s, --stdout` outputs to stdout. This is the default.
- `-f, --output-file path` writes to a unix file.
- `-C, --output-clay path` writes to Urbit's filesystem.
- `-U, --output-url url` sends a POST request with the data to
the URL.
- `-p, --app app` sends the data to an urbit app.
- `-x, --command` outputs to a literal dojo command.
## `fuse`
Urbit's namespace is accessible through the `fuse` command.
`fuse` takes all the normal FUSE arguments, which you can see
with `fuse -h`. Generally, you just run `fuse MOUNT-POINT`.
When accessing the namespace through `fuse`, everything is
read-only. If you want to write to Clay, mount a desk, as
described above.
Let's look first in the Clay portion of the Urbit namespace.
Assume we've mounted to `./pt`.
$ ls ./pt/c/=/=/=
app arvo gen lib mar ren sec sur web
$ ls ./pt/c/=/=/=/arvo
ames behn clay dill eyre ford gall hoon zuse
Those `=`s aren't decorative. The first `=` means "current
ship", the second "current desk", and the third "current
revision". Let's try something a little more exciting.
This runs the Unix `diff` command on the first and current
versions of the `app/gh/hoon` file, showing all the changes we've
made to the file.
```
$ diff pt/c/=/=/{1,=}/app/gh/hoon
73c73,75
< (malt (turn issues |=(issue:gh [(rsh 3 2 (scot %ui number)) ~])))
---
> %- malt ^- (list {@ta $~})
> :- [%gh-list-issues ~]
> (turn issues |=(issue:gh [(rsh 3 2 (scot %ui number)) ~]))
92c94,101
< read-y=(read-get /issues)
---
> read-y=(read-static %gh-list-issues ~)
> sigh-x=sigh-list-issues-x
> sigh-y=sigh-list-issues-y
> ==
> ^- place :: /issues/mine/