g
a powerful ls
g is a ls alternative with features:
- display items with type-specific icons and colors that are easy to be customized
- display in various layouts ( grid/across/byline/zero/comma/table/html/json/markdown/tree )
- user-friendly options with many aliases
- check file git-status when listing entries
- highly customizable sort option
- cross-platform ( Linux/Windows/MacOS )
- option to fuzzy match the path like
zoxide
with fzf
algorithm
Screenshots
Install
From source
go version required >= 1.20
go install -ldflags="-s -w" github.com/Equationzhao/g@latest
or Clone this repo
git clone github.com/Equationzhao/g
cd g
go build -ldflags="-s -w" # use -s -w to shrink size
# then add the executable file to your `PATH`
Via package manager
user can install g
from AUR
yay -S g-ls
homebrew:
brew tap equationzhao/core git@github.com:Equationzhao/homebrew-g.git
brew install g-ls
Pre-built executable
just download from release page, extract the gzip and add the executable file to your PATH
Usage
g path(s)
with icon
g -icons
with mod(default) time
g -time
with access/create/mod time
g -time -time-type=access
g -time -ac/cr/mod
with fileperm
g -permission
g -octal-perm # show octal permission like 0777
with owner/group
g -owner
g -group
with size
g -size
g -size -recusive-size # show size of dir recursively
show all files, including hidden files
g -sh
g -a
show dir only
g -dir
list by line
g -1
g -oneline
g -single-column
show file only with target ext
g -ext=<target ext(s)>
# eg:
# g -ext=go,md
recurse into directories
g -R
g -recurse
limit depth in tree/recurse (default: no limit)
g -R -depth=<level>
fuzzy search
g -f
g -fuzzy
# eg: g -f in
# /mnt/e/Project/gverything/index
# pathindex.go
disable index update
g -di
g -no-update
g -disable-index
disable color
g -no-color
g -colorless
set color
g -color=always
g -color=auto # default
g -color=never
g -color=16/basic # 16-color
g -color=256/8bit # 256-color
g -color=16m/24bit/true-color # 24-bit
show checksum (md5,sha1,sha224,sha256,sha384,sha512,crc32)
g -cs -ca=sha256
show git status
g -git
g -git-status
output in table
g -tb
list in tree
g -tree
output in markdown, and render with glow
(colors are not supported in markdown )
g -md | glow
...
Shell scripts
generate shell scripts
g -init bash/zsh/fish/pwsh
bash
# add the following command to .bashrc
eval "$(g --init bash)"
# then `source ~/.bashrc`
zsh
# add the following command to .zshrc
eval "$(g --init zsh)"
# then `source ~/.zshrc`
fish
# add to fish config:
g --init fish | source
# then `source ~/.config/fish/config.fish`
powershell
# add the following line to your profile
Invoke-Expression (& { (g --init powershell | Out-String) })
use command echo $profile
to find your profile path
nushell
# 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 = ^g
More options
g.md
Custom theme
theme
Logo
created by bing
/ Recent activity