加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > Linux > 正文

Linux命令学习神器:tldr命令

发布时间:2020-12-13 21:59:32 所属栏目:Linux 来源:网络整理
导读:Blog:博客园 个人 概述 github:https://github.com/tldr-pages/tldr tldr(Too Long; Didn't Read)命令会自动显示命令常用样例,什么 --help 和 man 都弱爆了。 安装 首先需要安装Node.js client,然后通过npm命令安装即可 npm install -g tldrsudo ln -s ~

Blog:博客园 个人

概述

github:https://github.com/tldr-pages/tldr

tldr(Too Long; Didn't Read)命令会自动显示命令常用样例,什么--helpman都弱爆了。

安装

首先需要安装Node.js client,然后通过npm命令安装即可

npm install -g tldr
sudo ln -s ~/.npm-global/lib/node_modules/tldr/bin/tldr /bin/tldr
# 更新本地库
tldr -u

语法

tldr command [options]

Options:

Options:
  -V,--version            output the version number
  -l,--list               List all commands for the chosen platform in the cache
  -a,--list-all           List all commands in the cache
  -1,--single-column      List single command per line (use with options -l or -a)
  -r,--random             Show a random command
  -e,--random-example     Show a random example
  -f,--render [file]      Render a specific markdown [file]
  -m,--markdown           Output in markdown format
  -o,--os [type]          Override the operating system [linux,osx,sunos]
  --linux                  Override the operating system with Linux
  --osx                    Override the operating system with OSX
  --sunos                  Override the operating system with SunOS
  -t,--theme [theme]      Color theme (simple,base16,ocean)
  -s,--search [keywords]  Search pages using keywords
  -u,--update             Update the local cache
  -c,--clear-cache        Clear the local cache
  -h,--help               output usage information

示例

[rohn@WhiteQueen ~]$ tldr grep

  grep

  Matches patterns in input text.
  Supports simple patterns and regular expressions.

  - Search for a pattern within a file:
    grep search_pattern path/to/file

  - Search for an exact string:
    grep -F exact_string path/to/file

  - Search for a pattern recursively in the current directory,ignoring non-text files:
    grep -RI search_pattern .

  - Use extended regular expressions (supporting ?,+,{},() and |),in case-insensitive mode:
    grep -Ei search_pattern path/to/file

  - Print 3 lines of [C]ontext around,[B]efore,or [A]fter each match:
    grep -C|B|A 3 search_pattern path/to/file

  - Print file name with the corresponding line number for each match:
    grep -Hn search_pattern path/to/file

  - Use the standard input instead of a file:
    cat path/to/file | grep search_pattern

  - Invert match for excluding specific strings:
    grep -v search_pattern

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读