Overview
The gio utility serves as the primary command-line gateway to the GNOME Virtual File System (GVfs), offering administrators and power users modern file-handling capabilities beyond traditional POSIX tools. This guide explores practical workflows for replacing destructive rm executions with recoverable desktop trashing, querying extended metadata attributes, launching registered default handlers, and interacting with uniform resource identifiers (URIs).
1. Environment Setup and Basic Tool Verification
Before putting gio to work, verify that your local package indices are fresh and that the core GLib command-line binaries are present on your Ubuntu machine.

Run gio version to report the underlying GIO and GLib runtime release installed on your host system.
⚙️ [Core Subcommands Overview]
trash : Safely shuttles targets to the system trash bin instead of destroying them.list : Enumerates directory entries across regular directories or custom URI schemes.info : Displays granular metadata attributes, detected MIME types, and filesystem origins.copy : Duplicates data objects across standard paths and remote GVfs locations.move : Relocates or renames items across virtual mounts and local filesystems.mount : Controls the mounting and detaching of external devices and network shares.mkdir : Initializes new directory hierarchies locally or over virtual endpoints.

Executing gio help prints a comprehensive overview of all available operational subcommands alongside their basic syntax conventions.
This reference list provides immediate guidance for file manipulation, metadata querying, and GVfs backend administration.

2. Safe File Deletion via the Desktop Trash Mechanism
To keep practice operations isolated, create a dedicated scratch workspace and navigate into it.

Generate an arbitrary text file named target.txt to test the disposal mechanism safely.

Using gio trash target.txt dispatches the selected file straight to the GNOME desktop trash container rather than unlinking its inode immediately.
Unlike the irreversible destruction caused by rm, items moved with this command can easily be restored using graphical file managers or terminal invocations if an accidental purge occurs.

Issue gio list trash:// to inspect the contents currently queued inside the virtual trash repository.
The output verifies that target.txt now resides safely inside the recovery holding area.

When disk capacity needs reclaiming, purge the staging zone permanently by executing gio trash --empty.
This operation removes every item residing in the trash backend and frees up physical storage immediately.

3. Investigating File Metadata and Managing Handler Associations
Set up a test Python script named script.py to evaluate metadata extraction and execution workflows.

Running gio info script.py produces an exhaustive manifest showing the target’s URI, file size, filesystem type, mount details, and extended namespace attributes.
This output presents both standard POSIX statistics and GVfs-specific property fields in a single view.

Query system MIME associations with gio mime text/x-python to inspect which desktop software handles Python source files by default.
In minimal or containerized setups, this query often reveals that no graphical editor has been registered yet for the text/x-python classification.

Triggering gio open script.py launches the designated file using whatever preferred software handler is registered within the desktop subsystem.
Whenever an association is active, your preferred desktop editor or viewer pops up immediately to display the document.

4. Manipulating Files Across GVfs and Leveraging URI Paths
Create a sample document named sample_doc.txt containing test content to observe data copying and migration behavior.

The command gio copy sample_doc.txt sample_backup.txt replicates the source payload to the specified destination.
While fulfilling duties identical to cp, this utility seamlessly bridges local paths and remote GVfs network locations without requiring separate tools.

To relocate a file or alter its identity within the filesystem hierarchy, run gio move sample_backup.txt ~/gio_test/archived.txt.
Functioning much like standard mv, it consistently coordinates path reorganizations across virtual and physical targets alike.

Run gio list file://$HOME/gio_test to browse directory contents through explicit file:// scheme notation.
This demonstrates that GVfs treats traditional operating system directories and abstract network protocols interchangeably through uniform URI addressing.

You now have a solid command of gio fundamentals on Ubuntu, ranging from reliable deletion workflows to deep virtual filesystem interaction. Incorporating these techniques into your day-to-day command-line routines will streamline system management and safeguard vital data against accidental loss.