2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 <productname>GIO</productname>
9 <contrib>Developer</contrib>
10 <firstname>Matthias</firstname>
11 <surname>Clasen</surname>
12 <email>mclasen@redhat.com</email>
18 <refentrytitle>gio</refentrytitle>
19 <manvolnum>1</manvolnum>
20 <refmiscinfo class="manual">User Commands</refmiscinfo>
24 <refname>gio</refname>
25 <refpurpose>GIO commandline tool</refpurpose>
30 <command>gio</command>
31 <arg choice="plain">help</arg>
32 <arg choice="opt"><replaceable>COMMAND</replaceable></arg>
35 <command>gio</command>
36 <arg choice="plain">version</arg>
39 <command>gio</command>
40 <arg choice="plain">cat</arg>
41 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
44 <command>gio</command>
45 <arg choice="plain">copy</arg>
46 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
47 <arg choice="plain" rep="repeat"><replaceable>SOURCE</replaceable></arg>
48 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
51 <command>gio</command>
52 <arg choice="plain">info</arg>
53 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
54 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
57 <command>gio</command>
58 <arg choice="plain">list</arg>
59 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
60 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
63 <command>gio</command>
64 <arg choice="plain">mime</arg>
65 <arg choice="plain"><replaceable>MIMETYPE</replaceable></arg>
66 <arg choice="opt"><replaceable>HANDLER</replaceable></arg>
69 <command>gio</command>
70 <arg choice="plain">mkdir</arg>
71 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
72 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
75 <command>gio</command>
76 <arg choice="plain">monitor</arg>
77 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
78 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
81 <command>gio</command>
82 <arg choice="plain">mount</arg>
83 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
84 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
87 <command>gio</command>
88 <arg choice="plain">move</arg>
89 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
90 <arg choice="plain" rep="repeat"><replaceable>SOURCE</replaceable></arg>
91 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
94 <command>gio</command>
95 <arg choice="plain">open</arg>
96 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
99 <command>gio</command>
100 <arg choice="plain">rename</arg>
101 <arg choice="plain"><replaceable>LOCATION</replaceable></arg>
102 <arg choice="plain"><replaceable>NAME</replaceable></arg>
105 <command>gio</command>
106 <arg choice="plain">remove</arg>
107 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
108 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
111 <command>gio</command>
112 <arg choice="plain">save</arg>
113 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
114 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
117 <command>gio</command>
118 <arg choice="plain">set</arg>
119 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
120 <arg choice="plain"><replaceable>LOCATION</replaceable></arg>
121 <arg choice="plain"><replaceable>ATTRIBUTE</replaceable></arg>
122 <arg choice="plain" rep="repeat"><replaceable>VALUE</replaceable></arg>
125 <command>gio</command>
126 <arg choice="plain">trash</arg>
127 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
128 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
131 <command>gio</command>
132 <arg choice="plain">tree</arg>
133 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
134 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
139 <title>Description</title>
140 <para><command>gio</command> is a utility that makes many of the GIO
141 features available from the commandline. In doing so, it provides
142 commands that are similar to traditional utilities, but let you
143 use GIO locations instead of local files: for example you can use
144 something like <filename>smb://server/resource/file.txt</filename>
149 <title>Commands</title>
154 <command>help</command>
155 <arg choice="opt"><replaceable>COMMAND</replaceable></arg>
158 <para>Displays a short synopsis of the available commands or provides
159 detailed help on a specific command.</para>
165 <command>version</command>
168 <para>Prints the GLib version to which <command>gio</command>
175 <command>cat</command>
176 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
179 <para>Concatenates the given files and prints them to the standard
181 <para>The cat command works just like the traditional cat utility.</para>
182 <para>Note: just pipe through cat if you need its formatting options
183 like -n, -T or other.</para>
189 <command>copy</command>
190 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
191 <arg choice="plain" rep="repeat"><replaceable>SOURCE</replaceable></arg>
192 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
195 <para>Copies one or more files from <replaceable>SOURCE</replaceable>
196 to <replaceable>DESTINATION</replaceable>. If more than one source
197 is specified, the destination must be a directory.</para>
198 <para>The copy command is similar to the traditional cp utility.</para>
200 <title>Options</title>
203 <term><option>-T</option>, <option>--no-target-directory</option></term>
204 <listitem><para>Don't copy into <replaceable>DESTINATION</replaceable> even if it is a directory.</para></listitem>
207 <term><option>-p</option>, <option>--progress</option></term>
208 <listitem><para>Show progress.</para></listitem>
211 <term><option>-i</option>, <option>--interactive</option></term>
212 <listitem><para>Prompt for confirmation before overwriting files.</para></listitem>
215 <term><option>--preserve</option></term>
216 <listitem><para>Preserve all attributes of copied files.</para></listitem>
219 <term><option>-b</option>, <option>--backup</option></term>
220 <listitem><para>Create backups of existing destination files.</para></listitem>
223 <term><option>-P</option>, <option>--no-dereference</option></term>
224 <listitem><para>Never follow symbolic links.</para></listitem>
232 <command>info</command>
233 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
234 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
237 <para>Shows information about the given locations.</para>
238 <para>The info command is similar to the traditional ls utility.</para>
240 <title>Options</title>
243 <term><option>-w</option>, <option>--query-writable</option></term>
244 <listitem><para>List writable attributes.</para></listitem>
247 <term><option>-f</option>, <option>--filesystem</option></term>
248 <listitem><para>Show information about the filesystem that the given
249 locations reside on.</para></listitem>
252 <term><option>-a</option> <option>--attributes=<replaceable>ATTRIBUTES</replaceable></option></term>
253 <listitem><para>The attributes to get.</para>
254 <para>Attributes can be specified with their GIO name, e.g.
255 standard::icon, or just by namespace, e.g. unix, or by '*',
256 which matches all attributes. Several attributes or groups
257 of attributes can be specified, separated by comma.</para>
258 <para>By default, all attributes are listed.</para></listitem>
261 <term><option>-n</option>, <option>--nofollow-symlinks</option></term>
262 <listitem><para>Don't follow symbolic links.</para></listitem>
271 <command>list</command>
272 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
273 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
276 <para>Lists the contents of the given locations. If no location is
277 given, the contents of the current directory are shown.</para>
278 <para>The list command is similar to the traditional ls utility.</para>
280 <title>Options</title>
283 <term><option>-a</option> <option>--attributes=<replaceable>ATTRIBUTES</replaceable></option></term>
284 <listitem><para>The attributes to get.</para>
285 <para>Attributes can be specified with their GIO name, e.g.
286 standard::icon, or just by namespace, e.g. unix, or by '*',
287 which matches all attributes. Several attributes or groups
288 of attributes can be specified, separated by comma.</para>
289 <para>By default, all attributes are listed.</para></listitem>
292 <term><option>-h</option>, <option>--hidden</option></term>
293 <listitem><para>Show hidden files.</para></listitem>
296 <term><option>-l</option>, <option>--long</option></term>
297 <listitem><para>Use a long listing format.</para></listitem>
300 <term><option>-n</option>, <option>--nofollow-symlinks</option></term>
301 <listitem><para>Don't follow symbolic links.</para></listitem>
304 <term><option>-u</option>, <option>--print-uris</option></term>
305 <listitem><para>Print full URIs.</para></listitem>
314 <command>mime</command>
315 <arg choice="plain"><replaceable>MIMETYPE</replaceable></arg>
316 <arg choice="opt"><replaceable>HANDLER</replaceable></arg>
319 <para>If no handler is given, the mime command lists the
320 registered and recommended applications for the mimetype.
321 If a handler is given, it is set as the default handler for
323 <para>Handlers must be specified by their desktop file name,
324 including the extension. Example: org.gnome.gedit.desktop.</para>
330 <command>mkdir</command>
331 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
332 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
335 <para>Creates directories.</para>
336 <para>The mkdir command is similar to the traditional mkdir utility.</para>
338 <title>Options</title>
341 <term><option>-p</option>, <option>--parent</option></term>
342 <listitem><para>Create parent directories when necessary.</para></listitem>
351 <command>monitor</command>
352 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
353 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
356 <para>Monitors files or directories for changes, such as creation
357 deletion, content and attribute changes, and mount and unmount
358 operations affecting the monitored locations.</para>
359 <para>The monitor command uses the GIO file monitoring APIs to do
360 its job. GIO has different implementations for different platforms.
361 The most common implementation on Linux uses inotify.</para>
363 <title>Options</title>
366 <term><option>-d</option>, <option>--dir=<replaceable>LOCATION</replaceable></option></term>
367 <listitem><para>Monitor the given location as a directory. Normally,
368 the file type is used to determine whether to monitor a file or directory.</para></listitem>
371 <term><option>-f</option>, <option>--file=<replaceable>LOCATION</replaceable></option></term>
372 <listitem><para>Monitor the given location as a file. Normally,
373 the file type is used to determine whether to monitor a file or directory.</para></listitem>
376 <term><option>-D</option>, <option>--direct=<replaceable>LOCATION</replaceable></option></term>
377 <listitem><para>Monitor the file directly. This allows to capture changes made via hardlinks.</para></listitem>
380 <term><option>-s</option>, <option>--silent=<replaceable>LOCATION</replaceable></option></term>
381 <listitem><para>Monitor the file directly, but don't report changes.</para></listitem>
384 <term><option>-n</option>, <option>--no-moves</option></term>
385 <listitem><para>Report moves and renames as simple deleted/created events.</para></listitem>
388 <term><option>-m</option>, <option>--mounts</option></term>
389 <listitem><para>Watch for mount events.</para></listitem>
398 <command>mount</command>
399 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
400 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
403 <para>Provides commandline access to various aspects of GIOs mounting
404 functionality.</para>
405 <para>Mounting refers to the traditional concept of arranging multiple
406 file systems and devices in a single tree, rooted at /. Classical
407 mounting happens in the kernel and is controlle by the mount utility.
408 GIO expands this concept by introducing mount daemons that can make
409 file systems available to GIO applications without kernel
411 <para>GIO mounts can require authentication, and the mount command
412 may ask for user IDs, passwords, and so on, when required.</para>
414 <title>Options</title>
417 <term><option>-m</option>, <option>--mountable</option></term>
418 <listitem><para>Mount as mountable.</para></listitem>
421 <term><option>-d</option>, <option>--device=<replaceable>DEVICE</replaceable></option></term>
422 <listitem><para>Mount volume with device file.</para></listitem>
425 <term><option>-u</option>, <option>--unmount</option></term>
426 <listitem><para>Unmount the location.</para></listitem>
429 <term><option>-e</option>, <option>--eject</option></term>
430 <listitem><para>Eject the location.</para></listitem>
433 <term><option>-s</option>, <option>--unmount-scheme=<replaceable>SCHEME</replaceable></option></term>
434 <listitem><para>Unmount all mounts with the given scheme.</para></listitem>
437 <term><option>-f</option>, <option>--force</option></term>
438 <listitem><para>Ignore outstanding file operations when unmounting or ejecting.</para></listitem>
441 <term><option>-a</option>, <option>--anonymous</option></term>
442 <listitem><para>Use an anonymous user when authenticating.</para></listitem>
445 <term><option>-l</option>, <option>--list</option></term>
446 <listitem><para>List all GIO mounts.</para></listitem>
449 <term><option>-o</option>, <option>--monitor</option></term>
450 <listitem><para>Monitor mount-related events.</para>
454 <term><option>-i</option>, <option>--detail</option></term>
455 <listitem><para>Show extra information.</para>
465 <command>move</command>
466 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
467 <arg choice="plain" rep="repeat"><replaceable>SOURCE</replaceable></arg>
468 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
471 <para>Moves one or more files from <replaceable>SOURCE</replaceable>
472 to <replaceable>DESTINATION</replaceable>. If more than one source
473 is specified, the destination must be a directory.</para>
474 <para>The move command is similar to the traditional mv utility.</para>
480 <command>open</command>
481 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
484 <para>Opens files with the default application that is registered
485 to handle files of this type.</para>
486 <para>GIO obtains this information from the shared-mime-info
487 database, with per-user overrides stored in
488 <filename><envar>$XDG_DATA_HOME</envar>/applications/mimeapps.list</filename>.</para>
489 <para>The mime command can be used to change the default handler for
496 <command>rename</command>
497 <arg choice="plain"><replaceable>LOCATION</replaceable></arg>
498 <arg choice="plain"><replaceable>NAME</replaceable></arg>
501 <para>Renames a file.</para>
502 <para>The rename command is similar to the traditional rename utility.</para>
508 <command>remove</command>
509 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
510 <arg choice="plain" rep="repeat"><replaceable>LOCATION</replaceable></arg>
513 <para>Deletes each given file.</para>
514 <para>This command removes files irreversibly. If you want a reversible
515 way to remove files, see the trash command.</para>
516 <para>Note that not all URI schemes that are supported by GIO may
517 allow deletion of files.</para>
518 <para> The remove command is similar to the traditional rm utility.</para>
520 <title>Options</title>
523 <term><option>-f</option>, <option>--force</option></term>
524 <listitem><para>Ignore non-existent and non-deletable files.</para></listitem>
533 <command>save</command>
534 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
535 <arg choice="plain"><replaceable>DESTINATION</replaceable></arg>
538 <para>Reads from standard input and saves the data to the given
540 <para>This is similar to just redirecting output to a file using
541 traditional shell syntax, but the save command allows saving to
542 location that GIO can write to.</para>
544 <title>Options</title>
547 <term><option>-b</option>, <option>--backup</option></term>
548 <listitem><para>Backup existing destination files.</para></listitem>
551 <term><option>-c</option>, <option>--create</option></term>
552 <listitem><para>Only create the destination if it doesn't exist yet.</para></listitem>
555 <term><option>-a</option>, <option>--append</option></term>
556 <listitem><para>Append to the end of the file.</para></listitem>
559 <term><option>-p</option>, <option>--private</option></term>
560 <listitem><para>When creating, restrict access to the current user.</para></listitem>
563 <term><option>-u</option>, <option>--unlink</option></term>
564 <listitem><para>When replacing, replace as if the destination did not exist.</para></listitem>
567 <term><option>-v</option>, <option>--print-etag</option></term>
568 <listitem><para>Print the new etag in the end.</para></listitem>
571 <term><option>-e</option>, <option>--etag=<replaceable>ETAG</replaceable></option></term>
572 <listitem><para>The etag of the file that is overwritten.</para></listitem>
581 <command>set</command>
582 <arg choice="plain"><replaceable>LOCATION</replaceable></arg>
583 <arg choice="plain"><replaceable>ATTRIBUTE</replaceable></arg>
584 <arg choice="plain" rep="repeat"><replaceable>VALUE</replaceable></arg>
587 <para>Allows to set a file attribute on a file.</para>
588 <para>File attributes can be specified with their GIO name, e.g
589 standard::icon. Note that not all GIO file attributes are writable.
590 Use the --query-writable option of the info command to list
591 writable file attributes.</para>
592 <para>If the <replaceable>TYPE</replaceable> is unset,
593 <replaceable>VALUE</replaceable> does not have to be specified.
594 If the type is stringv, multiple values can be given.</para>
596 <title>Options</title>
599 <term><option>-t</option>, <option>--type=<replaceable>TYPE</replaceable></option></term>
600 <listitem><para>Specifies the type of the attribute. Supported
601 types are string, stringv, bytestring, boolean, uint32, int32,
602 uint64, int64 and unset.</para>
603 <para>If the type is not specified, string is assumed.</para>
607 <term><option>-n</option>, <option>--nofollow-symlinks</option></term>
608 <listitem><para>Don't follow symbolic links.</para></listitem>
617 <command>trash</command>
618 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
619 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
622 <para>Sends files or directories to the "Trashcan". This can be a
623 different folder depending on where the file is located, and not
624 all file systems support this concept. In the common case that the
625 file lives inside a users home directory, the trash folder is
626 <filename><envar>$XDG_DATA_HOME</envar>/Trash</filename>.</para>
627 <para>Note that moving files to the trash does not free up space on
628 the file system until the "Trashcan" is emptied. If you are interested
629 in deleting a file irreversibly, see the remove command.</para>
630 <para>Inspecting and emptying the "Trashcan" is normally supported by
631 graphical file managers such as nautilus, but you can also see the
632 trash with the command: gio list trash://.</para>
634 <title>Options</title>
637 <term><option>-f</option>, <option>--force</option></term>
638 <listitem><para>Ignore non-existent and non-deletable files.</para></listitem>
641 <term><option>--empty</option></term>
642 <listitem><para>Empty the trash.</para></listitem>
651 <command>tree</command>
652 <arg choice="opt" rep="repeat"><replaceable>OPTION</replaceable></arg>
653 <arg choice="opt" rep="repeat"><replaceable>LOCATION</replaceable></arg>
656 <para>Lists the contents of the given locations recursively, in a
657 tree-like format. If no location is given, it defaults to the current
659 <para>The tree command is similar to the traditional tree utility.</para>
661 <title>Options</title>
664 <term><option>-h</option>, <option>--hidden</option></term>
665 <listitem><para>Show hidden files.</para></listitem>
668 <term><option>-l</option>, <option>--follow-symlinks</option></term>
669 <listitem><para>Follow symbolic links.</para></listitem>
679 <title>Exit status</title>
680 <para>On success 0 is returned, a non-zero failure code otherwise.</para>
684 <title>See Also</title>
687 <refentrytitle>cat</refentrytitle>
688 <manvolnum>1</manvolnum>
691 <refentrytitle>cp</refentrytitle>
692 <manvolnum>1</manvolnum>
695 <refentrytitle>ls</refentrytitle>
696 <manvolnum>1</manvolnum>
699 <refentrytitle>mkdir</refentrytitle>
700 <manvolnum>1</manvolnum>
703 <refentrytitle>mv</refentrytitle>
704 <manvolnum>1</manvolnum>
707 <refentrytitle>rm</refentrytitle>
708 <manvolnum>1</manvolnum>
711 <refentrytitle>tree</refentrytitle>
712 <manvolnum>1</manvolnum>