Home > File & Directory Management > gio

gio: GIO Command-line Tool

gio is a command-line tool for performing file and directory operations through GLib's GIO (Gnome Input/Output) virtual file system. It supports various operations such as copying, moving, deleting files, checking information, mounting/unmounting, and is particularly useful in GNOME environments.

Overview

Based on the GIO library, gio can perform operations on local file systems as well as remote locations (FTP, SMB, etc.) and virtual file systems. In addition to common file management tasks, it provides features like mount management and emptying the trash.

Key Features

  • File copy/move/delete
  • File information retrieval
  • Mount/unmount management
  • Trash management
  • URI schema support

Main Options

The gio command performs its functions through various subcommands. Each subcommand can have its own unique options.

File Management

Information and Open

Mount Management

Generated command:

Try combining the commands.

Description:

`gio` Executes the command.

Combine the above options to virtually execute commands with AI.

Usage Examples

Here are a few examples of using the gio command.

Checking File Information

touch document.txt
gio info document.txt
rm document.txt

Displays detailed information for the 'document.txt' file in the current directory.

Moving a File to Trash

touch old_report.pdf
gio trash old_report.pdf

Moves the 'old_report.pdf' file to the trash.

Listing Directory Contents

gio list .

Lists the contents of the current directory.

Copying a File

echo "Hello" > source.txt
gio copy source.txt destination.txt
rm source.txt destination.txt

Copies 'source.txt' to 'destination.txt'.

Opening a File with Default Application

gio open image.jpg

Opens 'image.jpg' with the system's default image viewer. (Requires an actual file to work)

Installation

gio is typically provided as part of the GLib development libraries or installed with desktop environments (e.g., GNOME). If it's not installed by default, you can install it using the following commands.

Debian/Ubuntu

sudo apt update && sudo apt install libglib2.0-bin

Fedora

sudo dnf install glib2

Arch Linux

sudo pacman -S glib2

Tips & Notes

gio is a powerful tool, but there are a few points to keep in mind.

Key Tips

  • **Utilize URI Schemes**: gio supports various URI schemes like `file://`, `ftp://`, `smb://`, allowing access to remote resources.
  • **GNOME Environment Integration**: It is tightly integrated with file managers (Nautilus) in the GNOME desktop environment, enabling command-line operations similar to GUI actions.
  • **Caution with Permanent Deletion**: The `gio rm` command permanently deletes files without sending them to the trash, so use it with caution.
  • **Detailed Help**: For more detailed information on each subcommand, you can use `gio help <subcommand>`.

Same category commands