g

一个强大的 ls 工具
g 是一个 ls 替代品,拥有下面一些功能:
- 显示带有类型特定图标和颜色的条目,并且易于更改
- 有丰富的输出格式 ( grid/across/byline/zero/comma/table/html/json/markdown/tree )
- 用户友好的选项
- 支持显示 git status
- 丰富且可自定义的排序选项
- 跨平台 ( Linux/Windows/MacOS )
- 支持使用
fzf算法,像zoxide一样模糊匹配路径
截图

安装
源码安装
要求 go version >= 1.20
go install -ldflags="-s -w" github.com/Equationzhao/g@latest
或者 clone 这个仓库 (nightly build)
git clone github.com/Equationzhao/gcd ggo build -ldflags="-s -w" # use -s -w to shrink size# then add the executable file to your `PATH`
通过包管理器
用户可以通过 AUR 安装
g
yay -S g-ls
homebrew:
brew tap equationzhao/core git@github.com:Equationzhao/homebrew-g.git
brew install g-ls
二进制文件
deb
sudo dpkg -i g_$version_$arch.deb
tar,gz/zip
从 release page 下载对应平台的文件, 解压 gzip 并将可执行文件添加到 PATH
推荐使用的终端
macOS:
Windows:
cross-platform:
用法
g path(s)
显示图标
g -icons
显示修改(默认)时间
g -time
显示 访问/创建/修改 时间
g -time -time-type=accessg -time -ac/cr/mod
显示文件权限
g -permissiong -octal-perm # show octal permission like 0777
显示用户/群组
g -ownerg -group
显示文件大小
g -sizeg -size -recusive-size # show size of dir recursively
显示所有文件,包括隐藏文件
g -shg -show-hiddeng -a
只显示目录
g -dir
按行显示
g -1g -onelineg -single-column
显示有指定拓展名的文件
g -ext=<target ext(s)># eg:# g -ext=go,md
递归显示目录
g -Rg -recurse
限制在 树/递归 模式下的 递归深度 (默认: 无限制)
g -R -depth=<level>
模糊搜索
g -fg -fuzzy# eg: g -f in# /mnt/e/Project/gverything/index# pathindex.go
禁用索引更新
g -dig -no-updateg -disable-index
禁用颜色
g -no-colorg -colorless
设置颜色
g -color=alwaysg -color=auto # defaultg -color=neverg -color=16/basic # 16-colorg -color=256/8bit # 256-colorg -color=16m/24bit/true-color # 24-bit
显示校验和 (md5,sha1,sha224,sha256,sha384,sha512,crc32)
g -cs -ca=sha256
显示 git status
g -gitg -git-status
表格式输出
g -tb
树状输出
g -tree
以 markdown 格式输出, 并用 glow 渲染 ( 不支持颜色 )
g -md | glow

…
Shell 脚本
生成 shell 脚本
g -init bash/zsh/fish/pwsh
bash
# add the following command to .bashrceval "$(g --init bash)"# then `source ~/.bashrc`
zsh
# add the following command to .zshrceval "$(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 profileInvoke-Expression (& { (g --init powershell | Out-String) })
使用 echo $profile命令查找配置文件路径
nushell
# add the following to your $nu.env-path^g --init nushell | save -f ~/.g.nu# then add the following to your $nu.config-pathsource ~/.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
更多选项
自定义主题
TODO
- Version sort
- Git sort
- Print security context
- $OLDPWD
- Color Support for html/markdown
Logo
created by bing
其他选择
本项目受到以下项目的启发,你也许想试试
