gc (or gcs) is run from the command line with options and a URL to open.
gc [options] [url]
After the url is loaded gc enters a command loop where user commands are read and interpreted. url is expected to have the usual protocol identifiers (file, gopher, http, https or gemini). If not url
./
or ../
),
%09%09+
appended if it ends with a +
,
.
,
www
, gopher
or gemini
respecively.
If no url is given on the command line but a home page is configured gc opens that file.
gc uses a simple interactive line interface: the user enters commands
and gc executes them. gc comes without a command line editor. If
you want this, use rlwrap (sudo apt-get install rlwrap
):
rlwrap ./gc
Notice that Ctrl+C will end gc without a proper cleanup. That is, the temporary file that is used during a gc session is not removed.
When starting gc tries to read configuration options from the file
.config.gc or (if that not works) ~/.config/gc/config. Empty
lines or comments (lines starting with a #
) are allowed. The
following options are recognized:
Unknown option print an error message and terminate gc.
If the bookmarks file is not set gc uses ~/.config/gc/bookmarks if the configuration was read from there and .bookmarks.gc else.
gc understands the following protocols / URL schemes:
Several text types can be reformatted using helper programs, which should be available.
Content Type | Helper |
---|---|
text/html | lynx |
text/gemini | gem2text |
text/markdown | md2text |
gem2text and md2text come with gc and lynx is expected to be
installed. For Markdown, md2text extracts only [text](url "title")
links but leaves the text itself as-is.
Navigation is simple. Most often it starts with entering a URL at the command prompt, e.g.
> gopher://gopher.floodgap.com/
gc loads and display the content. Gopher directory item selectors are numbered and entering the number will take you there:
> 21
opens Floodgap's "getting started" directory. Notice that each item
that gc displays is paged using less and depending on the text
length the display may stay in paging mode until you end this by
entering q
. gc is ready when you see the >
prompt.
gc can render text/html (using lynx -dump
) and gemtext (gmi2text
utility) and extracts URL from them. These are also numbered and
selected by entering their number. Links from the last content file
are listed (as URLs) with gc's ref command.
Gopher directories are not considered as content but as navigation. This has the side effect that loading an item does not override the contents of the last visited gopher directory. Try these commands:
> gopher://gopher.floodgap.com/ > gemini://gemini.circumlunar.space/ > ls
There are two more link sources and all of them are selected with their index number: the history and gopher+ attribut blocks. Each time you enter a number to open a link, gc checks which item was displayed last and takes the link from the respective object. These are the commands to display and switch to their context:
Command | Function |
---|---|
history | Displays the current session history. |
ls | Lists the last gopher direcctory. |
page | Prints the last opened content item. |
plus | Prints the gopher+ attributes. |
gc supports a simple prev/next navigation. All files that have no special relation (set by +ADMIN.Relation) and are not downloads are numbered in the order as they appear in the directory. The commands
:(first|prev|next|last)
can be used to move around. Use :rel
to display the document
with a particular relation, e.g. :home
.
Gopher+ servers may supply prev/next information in the +RELATION block but this is currently ignored by gc. It computes the information on its own.
The option -e pnx
activates an experimental prev/next. After a
document has been shown the navigator prompts for one of the available
prev/next actions. Simply pressing return brings you to gc command
prompt.
Command name that are enclosed in parenthesis can be abbreviated.
Entering as much that the command can be uniquely identified is
enough, e.g. pa
instead of page
.
+
is appended the item is opened in
a new xterminal (requires X windows).
: (disable) [ option ]
disables _option_.
: (enable) [ option ]
enables _option_.
/
directory) of the current server's
directory. Does not properly work with Gopher-by-HTTP.
remote%09+PUT
.
Possible options are
gc's current working directory is important. This is the location where is stores it bookmarks (in the file .bookmarks.gc) and its temporary file. This is only removed on clean exit, not when gc is terminated with CTRL+C or similar.
When using gc as gopher client there are some things you should know.