A feature-rich, customizable, and cross-platform ls alternative.
Experience enhanced visuals with type-specific icons, various layout options, and git status integration.
- Customizable Display: Icons and colors specific to file types, easy to customize.
- Multiple Layouts: Choose from grid, across, byline, zero, comma, table, json, markdown, and tree layouts.
- Git Integration: View file git-status/repo-status/repo-branch directly in your listings.
- Advanced Sorting: Highly customizable sorting options like version-sort.
- Cross-Platform Compatibility: Works seamlessly on Linux, Windows, and MacOS.
- Fuzzy Path Matching:
zoxideandfzflike fuzzy path matching. - Hyperlink support: Open files/directories with a single click.
g path(s)g --icon --long path(s) # show icons and long formatg --tree --long path(s) # show tree layoutyay -S g-lsbrew install g-lsor use the homebrew tap:
brew tap equationzhao/core [email protected]:Equationzhao/homebrew-g.gitbrew install g-lssudo port install g-lswindows scoop:
scoop install https://raw.githubusercontent.com/Equationzhao/g/master/scoop/g.json# upgrade
scoop uninstall g # uninstall first
scoop install https://raw.githubusercontent.com/Equationzhao/g/master/scoop/g.jsonTODO, see issue
bash -c "$(curl -fsSLk https://raw.githubusercontent.com/Equationzhao/g/master/script/install.sh)"curl -fsSLk https://raw.githubusercontent.com/Equationzhao/g/master/script/install.sh | bash /dev/stdin -r download from release page
sudo dpkg -i g_$version_$arch.debjust download from release page, extract the gzip and add the executable file to your PATH
Requires Go version >= 1.24
go install -ldflags="-s -w" github.com/Equationzhao/g@latestAlternatively, clone the repo for a dev version:
git clone github.com/Equationzhao/g
cd g
go build -ldflags="-s -w"
# then add the executable file to your `PATH`See BuildOption.md for optional build tags to enable or disable features.
macOS:
Windows:
cross-platform:
if you install
gthrough brew or the install script, the completion is usually installed already.
wget https://raw.githubusercontent.com/Equationzhao/g/master/completions/zsh/_ginstall the file to your zsh completion directory, usually /usr/local/share/zsh/site-functions or /usr/share/zsh/site-functions (or anywhere in your $FPATH)
mv _g ~/.zsh/completionsmake sure autoload -Uz compinit and compinit are in the ~/.zshrc or ~/.zprofile
if not, add them to at least one of them.
autoload -Uz compinit
compinitwget https://raw.githubusercontent.com/Equationzhao/g/master/completions/bash/g-completion.bashadd the following lines to your ~/.bashrc file:
source /path/to/g-completion.bashwget https://raw.githubusercontent.com/Equationzhao/g/master/completions/fish/g.fishInstall the file to your fish completion directory, usually ~/.config/fish/completions
mv g.fish ~/.config/fish/completionsRestart your terminal session or run the following command to immediately enable the completion functionality:
source ~/.config/fish/config.fishGenerate initialization scripts(alias) for various shells:
g -init bash/zsh/fish/pwsh# add the following command to .bashrc
eval "$(g --init bash)"
# then `source ~/.bashrc`# add the following command to .zshrc
eval "$(g --init zsh)"
# then `source ~/.zshrc`# add to fish config:
g --init fish | source
# then `source ~/.config/fish/config.fish`# add the following line to your profile
Invoke-Expression (& { (g --init powershell | Out-String) })use command echo $profile to find your profile path
the nushell has a nice built-in ls command, but if you wanna try g in nushell, you can do the following:
ps: the script is not guaranteed to work, if you have any problem, please file an issue
# add the following to your $nu.env-path
^g --init nushell | save -f ~/.g.nu
# then add the following to your $nu.config-path
source ~/.g.nu
# if you want to replace nushell's g command with g
# add the following definition and alias to your $nu.config-path
#
# def nug [arg?] {
# if ($arg == null) {
# g $arg
# } else {
# g
# }
# }
# alias g = ^gInterested in contributing? Check out the contributing guidelines.
g is highly inspired by following projects that you may wanna try!
| eza | g | |
|---|---|---|
| display mode | oneline,grid,across,tree,recurse | oneline,grid,across,zero,comma,table,json,markdown,tree,recurse |
| unique feature | -Z: list each fileβs security context,-@: list each fileβs extended attributes and sizes ... | --mime: list each file's mime type, --charset: list each file's charset ... |
| performance | better | slower |
