一个强大的 ls 工具
g 是一个 ls 替代品,拥有下面一些功能:
- 显示带有类型特定图标和颜色的条目,并且易于更改
- 有丰富的输出格式 ( grid/across/byline/zero/comma/table/html/json/markdown/tree )
- 用户友好的选项
- 支持显示 git status
- 丰富且可自定义的排序选项
- 跨平台 ( Linux/Windows/MacOS )
- 支持使用
fzf算法,像zoxide一样模糊匹配路径
要求 go version >= 1.21
go install -ldflags="-s -w" github.com/Equationzhao/g@latest或者 clone 这个仓库 (nightly build)
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`yay -S g-lshomebrew:
brew tap equationzhao/core git@github.com:Equationzhao/homebrew-g.gitbrew 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.json
# error msg like this can be ignored
# Move-Item:
# Line |
# 2 | mv g-amd64.exe g.exe
# | ~~~~~~~~~~~~~~~~~~~~
# Move-Item:
# Line |
# 3 | mv g-amd64.shim g.shim
# | ~~~~~~~~~~~~~~~~~~~~~~从 release 页下载对应deb文件后安装
sudo dpkg -i g_$version_$arch.deb从 release page 下载对应平台的文件, 解压 gzip 并将可执行文件添加到 PATH
macOS:
Windows:
cross-platform:
g path(s)显示图标
g -icons显示修改(默认)时间
g -time 显示 访问/创建/修改 时间
g -time -time-type=access
g -time -ac/cr/mod显示文件权限
g -permission
g -octal-perm # show octal permission like 0777显示用户/群组
g -owner
g -group 显示文件大小
g -size
g -size -recursive-size # show size of dir recursively显示所有文件,包括隐藏文件
g -sh
g -show-hidden
g -a 只显示目录
g -dir 按行显示
g -1
g -oneline
g -single-column 显示有指定拓展名的文件
g -ext=<target ext(s)>
# eg:
# g -ext=go,md递归显示目录
g -R
g -recurse 限制在 树/递归 模式下的 递归深度 (默认: 无限制)
g -R -depth=<level> 模糊搜索
g -f
g -fuzzy
# eg: g -f in
# /mnt/e/Project/gverything/index
# pathindex.go禁用索引更新
g -di
g -no-update
g -disable-index 禁用颜色
g -no-color
g -colorless 设置颜色
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显示校验和 (md5,sha1,sha224,sha256,sha384,sha512,crc32)
g -cs -ca=sha256 显示 git status
g -git
g -git-status表格式输出
g -tb树状输出
g -tree以 markdown 格式输出, 并用 glow 渲染 ( 不支持颜色 )
g -md | glow ...
生成 shell 脚本
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) })使用 echo $profile命令查找配置文件路径
# 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- Version sort
- Git sort
- Print security context
- $OLDPWD
- Color Support for html/markdown
- Support Scoop
以下是 eza 的新功能,后续计划支持
- --git-repos: list each directory’s Git status, if tracked
- --git-repos-no-status: list whether a directory is a Git repository, but not its status (faster)
查看 CONTRIBUTING
created by bing
本项目受到以下项目的启发,你也许想试试

