7Urbit has its own revision-controlled filesystem, Clay. Clay is a typed, global,
8referentially transparent namespace. An easy way to think about it is like typed
11The most common way to use Clay is to mount a Clay node in a Unix directory. The
12mounted directory is always at the root of your pier directory.
14For more information on Clay, see the [Overview](/docs/arvo/clay/clay), and
15additional usage information at [Using Clay](/docs/arvo/clay/using).
19This quick-start guide will walk you through some common commands. Follow along
20using your Dojo. When you get a `>=` message after entering a command, this means
21that the command was successful.
23A [`desk`](/docs/glossary/desk) is something like an independently
24revision-controlled branch of your urbit's file-system. Your urbit's system
25files live in the `%base` desk.
27It's important to note that whenever you want to sync changes from your Unix
28directory to your ship, you must use the `|commit %desk` command, where `%desk`
29is the `desk` that you'd like to sync to.
31When developing it's a good idea to use a separate `desk`. Create a `%sandbox`
32`desk` based on the `%base` `desk` (`our` produces your ship name):
35~zod:dojo> |merge %sandbox our %base
38Most of the time we want to use Clay from Unix. Mount the entire contents of
39your `%sandbox` desk to Unix:
42~zod:dojo> |mount %sandbox
45To explore the filesystem from inside Urbit `+ls` and `+cat` are useful. `+ls`
46displays files in the current directory, and `+cat` displays the contents of
49We use `%` to mean "current directory." The result of the command below
50is just like using `ls` in a Unix terminal.
56Notice how `+cat %` does the same thing. That's because everything in Clay,
57including directories, is a file.
59Sync from your friend `~bus`'s `%experiment` desk to your `%sandbox` desk:
62~zod:dojo> |sync %sandbox ~bus %experiment
65If and when your sync is successful, you will receive a message:
68kiln: sync succeeded from %experiment on ~bus to %sandbox
71The ship that you sync from will get their own message indicating that you're
72both connected as peers:
75; ~zod is your neighbor.
82The following constitutes an explanation of handy commands that most Urbit
83pilots will want to know at some point. Reading this section will get you to the
84point that you can navigate the file system, sync with Unix, merge your desk,
85and other basic tasks familiar to novice users of the Unix terminal.
89A path in Clay is a list of URL-safe text, restricted to the characters `[a z]`,`[0 9]`, `.`, `-`, `_`, and `~`. This path is a list of strings each
90prepended by `/`. In other words, paths are expressed as `/foo/bar/baz`. File
91extensions are separated from file names with `/`, not `.`. Extensions are
92syntactically identical to subdirectories, except that they must terminate the
95Paths begin with three strings indicating the ship, desk, and revision, and
96might look like `/~dozbud-namsep/base/11`.
98The first component is `ship`, which is, as you might guess, the name of
99an Urbit ship. The second component is `desk`, which is a workspace meant to
100contain other directories; the default `desk` is `%base`. The third component is
101the revision, which represents version information in various ways: date and time;
102a version sequence, which is a value incremented by one whenever a file on the
103given `desk` is modified; or an arbitrary plaintext label.
105You can find what your current ship, desk, and revision is at any given moment by
106typing `%` in the Dojo and looking at the first three results. This will display
107as a cell rather than a path, like
110[~.~zod ~.base ~.~2021.3.19..16.11.20..0c60]
113Here we see that the revision consists of the date, time, and a short hash.
115We use this format because, unlike the current internet, the Urbit network uses a
116global namespace. That means that a file named `example.hoon` in the `/gen`
117directory on the `%base` desk of your ship `~lodleb-ritrul` would have a
118universal address to anyone else on the network:
119`/~lodleb-ritrul/base/186/gen/example/hoon`. That, of
120course, doesn't mean that everyone on the network has privileges to access that
121path. But given the revision-controlled and immutable nature of Urbit, this
122means that if the file requested is available, it will always be the same. This
123means that if an Urbit is serving a webpage, that exact version will always be
124retrievable (assuming you have access to it).
128The `%` command, which we gestured at in the above section, represents the
129**relative path**, which is the path where you are currently working.
131`%`s can be stacked to indicate one level further up in the hierarchy for each
132additional `%`. Try the following command:
138You'll notice that it only has your ship name and the empty list. The
139two additional `%`s abandoned the revision and the `desk` information by moving
140up twice the hierarchy.
142There are no local relative paths. `/foo/bar` must be written as
147You don't need to write out the explicit path every time you want to reference
148somewhere outside of your working directory. You can substitute `=` for the
151Recall that a full address in the the Urbit namespace is of the form
152`/ship/desk/case/path`. To switch to the `%sandbox` `desk`, you would enter
155~sampel-palnet:dojo> =dir /=sandbox=
158`=dir` is used to change the working directory - we will see more on it
159[below](#changing-directories.)
161The above command uses substitution to use your current `ship` and
162revision; only the `desk` argument, which is located between the other two, is
163given something new. Without substitution, you would need to write:
166~sampel-palnet:dojo> =dir /~sampel-palnet/sandbox/85
169Substitutions work the same way in the `ship/desk/case` and
170paths. For example, if you are in the `/gen` directory, you can reference a file
171in the `/app` directory like below. (`+cat` displays the contents of a file).
174~sampel-palnet:dojo> =dir %/gen
175~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen> +cat /===/app/curl/hoon
178Note what was substituted out, and note that we don't need to separate `=` with
181If we changed our working directory to something called `/gen/gmail`, we could
185~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen> =dir %/gmail
186~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen/gmail> +cat /===/app/=/split/hoon
189Because both paths share a directory named `/gmail` at the same position in the
190address hierarchy – which, if you recall, is just a `list` – the above command
193We can do the same thing between desks. If `%sandbox` has been merged with
194`%base`, the following command will produce the same results as the above
198~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen/gmail> +cat /=sandbox=/app/=/split/hoon
201Most commonly this is used to avoid having to know the current revision
202number in the `dojo`: `/~lodleb-ritrul/base/~2021.3.19..16.11.20..0c60/gen/example/hoon`
204#### Changing directories
206Change the working directory with `=dir`. It's our equivalent of the Unix `cd`.
208For example, the syntax to navigate to `/base/gen/ask` is:
211~sampel-palnet:dojo> =dir /=base=/gen/ask
214This command will turn your prompt into something like this:
217~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen/ask>
220Using `=dir` without anything else uses the null path, which returns you to
224~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen/ask> =dir
227Your dojo prompt will turn back into `~sampel-palnet:dojo>`.
229To go up levels in the path hierarchy, recall the relative path expression
230`%`. Stacking them represents another level higher in the hierarchy than
231the current working directory for each `%` beyond the initial. The command below
232brings you one level up:
235~sampel-palnet:dojo> =dir %/gen
236~sampel-palnet:dojo/=/=/~2021.3.19..16.11.20..0c60/gen> =dir %%
243Syntax: `|mount %/clay/path %mount-point`
245Mount the `/clay/path` at the Unix mount point `mount-point` with your pier as
251|mount %/gen %generators
254Mounts `%/gen` to `/generators` inside your pier directory.
262Unmount the the mount point from Unix.
270Unmounts the Unix path `/foo`.
275|merge %target-desk ~source-ship %source-desk
278Merges a source `desk` into a target `desk`.
280This can optionally include a [merge
281strategy](/docs/arvo/clay/using#strategies):
284|merge %target-desk ~source-ship %source-desk, =gem %strategy
287You may also merge a Clay path on your own ship to a `desk`, along with an
291|merge %target-get %/clay/path, =gem %strategy
297|merge %examples ~wacbex-ribmex %examples
300Merge the `%examples` `desk` from `~waxbex-ribmex`
303|merge %work /=base=, =gem %fine
306Merge `/=base=` into `%work` using merge strategy `%fine`.
311|sync %target-desk ~source-ship %target-desk
314Subscribe to continuous updates from remote `desk` on local `desk`.
319|sync %foo ~dozbud %kids
325|unsync %target-desk ~source-ship %source-desk
328Unsubscribe from updates from remote `desk` on local `desk`. Arguments must
329match original `|sync` command.
334|unsync %foo ~dozbud %kids
341Syntax: `+cat path [path ...]`
343Similar to Unix `cat`. `+cat` takes one or more `path`s, and prints their
344contents. If that `path` is a file, the contents of the file is printed. If the
345`path` terminates in a directory, the list of names at that path is produced.
351Similar to Unix `ls`. `+ls` takes a single `path`.
353Produces a list of names at the `path`.
356~sampel-palnet:dojo> +cat %/our/base/gen/curl/hoon
363Remove the data at `path`. `Path` must be a path to the actual node, not a
370Copy the file at `from` into the path `to`.
376Move the file at `from` into the path `to`.
378In Clay, `|mv` is just a shorthand for `|cp` then `|rm`. The `|rm`
379doesn't happen unless the `|cp` succeeds.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list