Documents

g – powerful and cross-platform ls

ls is a command to list computer files. ls is specified by POSIX and the Single UNIX Specification. When invoked without any arguments, ls lists the files in the current working directory.

The GNU Core Utilities or coreutils is a package of GNU software containing implementations for many of the basic tools, such as cat, ls, and rm, which are used on Unix-like operating systems.

There are many enterprising developers that look to update and enhance many of the commands available in coreutils. ls is no exception.

g is an alternative to ls with lots of configurability. It’s written in Go and published under an open source license.

Installation

There’s a package for g for Ubuntu. At the time of writing the latest version of g is v0.22.2. Download the deb package with the command.

$ wget https://github.com/Equationzhao/g/releases/download/v0.22.2/g_0.22.2_amd64.deb

Install with dpkg:

$ sudo dpkg -i g_0.22.2_amd64.deb

You should check the project’s GitHub repository for the current version as there are frequent updates.

The image below shows the installed files.

installed files

If you’re not running Ubuntu or another distro that has a package, you can always build the software manually.

On a fairly fresh installation of Ubuntu 23.10, we first need to install go (and git). We could install go via snap, but we prefer installing deb packages.

$ sudo apt install golang-go git

Now clone g’s GitHub repository:

$ git clone https://github.com/Equationzhao/g

Change into the newly created directory.

$ cd g

Build g with the command.

$ go build -ldflags="-s -w"

We can copy the g executable to a directory on our PATH such as /usr/local/bin

$ sudo cp g /usr/local/bin/

Besides Linux, g runs under macOS and Windows.

Next page: Page 2 – In Operation and Summary

Pages in this article:
Page 1 – Introduction and Installation
Page 2 – In Operation and Summary

Subscribe
Notify of
guest

This site uses Akismet to reduce spam. Learn how your comment data is processed.

0 Comments
Inline Feedbacks
View all comments