TLTR - “too long , don`t read” 命令提示
在使用linux的时候有时候突然忘了一个命令怎么写,比如说
docker-compose up -d
有时候会忘了后面的参数是什么意思,但是man
命令输出太过于冗长,包含的软件有时候不全,有没有更方便快捷的可以查询命令的工具呢?
TLDR
项目地址:https://github.com/tldr-pages/tldr
整体的使用效果:👇
安装TLDR
GitHub上面的安装方式有很多:
npm install -g tldr
pip3 install tldr
brew install tlrc
如果你用的Ubuntu或者Debian系统也可以用
sudo apt install tldr
修改语言
由于vps大多数都是默认英文,对于英文不好的小伙伴可以把输出语言改成中文
Tldr pages defaults to showing pages in the current language of the operating system, or English if that's not available. To view tldr pages for a different language, set an environment variable
LANG
containing a valid POSIX locale (such aszh
,pt_BR
, orfr
) and then run the above commands as usual. In most*nix
systems, this variable will already be set.It is suggested that the
LANG
environment variable be set system-wide if this isn't already the case. Users withoutsudo
access can set it locally in their~/.profile
.
LANG=zh tldr <command>
根据官方npm仓库,输入指令
vim ~/.profile
# 最后一行加上👇
LANG=zh
如果遇到:
表示 tldr
在尝试读取中文文档时遇到了编码问题。具体原因是 tldr
无法正确解码文件中的中文字符(可能是 UTF-8 编码问题)。
永久设置语言环境:
echo 'export LANG=zh_CN.UTF-8' >> ~/.bashrc
echo 'export LC_ALL=zh_CN.UTF-8' >> ~/.bashrc
source ~/.bashrc
如果再遇到
需要安装中文语言包
sudo apt install language-pack-zh-hans language-pack-zh-hans-base
然后再重新执行设置utf-8