Total Pageviews

Monday, 7 March 2022

tldr

Collaborative cheatsheets for console commands.

https://tldr.sh/

What is tldr-pages?

The tldr-pages project is a collection of community-maintained help pages for command-line tools, that aims to be a simpler, more approachable complement to traditional man pages.

Maybe you are new to the command-line world? Or just a little rusty? Or perhaps you can't always remember the arguments to lsof, or tar?

It certainly doesn't help that the first option explained in man tar is:

-b blocksize
   Specify the block size, in 512-byte records, for tape drive I/O.
   As a rule, this argument is only needed when reading from or writing to tape drives,
   and usually not even then as the default block size of 20 records (10240 bytes) is very common.

There seems to be room for simpler help pages, focused on practical examples. 

This repository is just that: an ever-growing collection of examples for the most common UNIX, Linux, macOS, SunOS and Windows command-line tools.

How do I use it?

A popular and convenient way to access these pages on your computer is to install the Node.js client, which is supported by the tldr-pages project maintainers:

npm install -g tldr

You can also use the fully-featured official Python client which can be installed via pip3.

pip3 install tldr

That way you can write tldr tar in the terminal to show the tldr page for tar, just like you would write man tar to show its manpage.

However, if you just want to browse without installing anything, check out the PDF version.

There are also various other clients provided by the community, both for the command-line and for other platforms. For a comprehensive list of clients, head over to our Wiki.

Similar projects

  • Bro pages are a highly readable supplement to man pages. Bro pages show concise, common-case examples for Unix commands. The examples are submitted by the user base, and can be voted up or down; the best entries are what people see first when they look up a command.

  • Cheat allows you to create and view interactive cheatsheets on the command-line. It was designed to help remind *nix system administrators of options for commands that they use frequently, but not frequently enough to remember.

  • cheat.sh Aggregates cheat sheets from multiple sources (including tldr-pages) into 1 unified interface.

  • devhints Rico's cheatsheets are not just focused on the command-line and include a plethora of other cheatsheets related to programming.

  • eg provides detailed examples with explanations on the command-line. Examples come from the repository, but eg supports displaying custom examples and commands alongside the defaults.

  • kb is a minimalist command-line knowledge base manager. kb can be used to organize your notes and cheatsheets in a minimalist and clean way. It also supports non-text files.

  • navi is an interactive cheatsheet tool, which allows you to browse through specific examples or complete commands on the fly.

What does "tldr" mean?

TL;DR stands for "Too Long; Didn't Read". It originated as Internet slang, where it is used to indicate that a long text (or parts of it) has been skipped as too lengthy. Read more in How-To Geek's article.


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

----


tldr pages clients


The content of tldr pages is openly available under the permissive MIT License. It can be accessed directly by downloading the contents of this repository (there's a regularly updated archive available here), visiting the command pages individually on github.com — for example, here's the page for the tar command — or downloading the PDF version.

For a more convenient access, though, several dedicated client applications have been developed for different platforms:

Web clients

AuthorSource codeWhere to find it
@osteratldr.jsxAvailable online at tldr.ostera.io
@finzzztldr.finzzz.netAvailable online at https://tldr.finzzz.net/
@TheAshwaniktldr-Jquery-clientAvailable online at blog.ashwani.co.in/tldr-Jquery-client
@hilltldr-chrome[Discontinued] Browser extension for Google Chrome
@piracestldr-extension-browserBrowser extension, published in the stores for Google ChromeFirefoxEdge and other Chromium based browsers
@duckduckgotldr_pagesSidebar shown on searches such as "tldr tar" on the DuckDuckGo search engine
DistroWatch(unavailable)Available online at distrowatch.com/dwres.php?resource=man-pages
@opoet7tldr-persianAvailable online at https://opoet7.github.io/tldr-persian/

Console clients

The original client

The Node.js client was the client that was originally bundled with the tldr-pages project. It has since been moved to a separate repository, but remains actively supported by the maintainers of the tldr-pages project. It is available on NPM and can be installed by running npm install -g tldr.

The Node.js client has also been packaged as a Docker container (alias tldr='docker run --rm -it -v ~/.tldr/:/root/.tldr/ nutellinoit/tldr').

Other console clients

ClientImplementation detailsInstallation instructions
accatyyc / tldr-manmanInstructions on the README
unInstance / untldrC99make install
anoopengineer / tldrGogo get github.com/anoopengineer/tldr
(or Download binaries for Windows, MacOSX and Linux)
avih / tldr-fmtPOSIX Shellgit clone https://github.com/avih/tldr-fmt
brainmaestro/tldr-phpPHPcomposer global require brainmaestro/tldr
dbrgn / tealdeerRustcargo install tealdeer
AUR: yay -S tealdeer
tldr-pages / extldrElixirInstructions on the README
edgurgel / tldr_elixir_clientElixirbinaries not yet available
hterkelsen / tldrDartpub global activate tldr
isacikgoz / tldrGogo get github.com/isacikgoz/tldr/cmd/tldr
k3mist / tldrGogo get bitbucket.org/djr2/tldr
(or Downloads (OSX, Linux, Windows))
kirillseva / tldrrrRdevtools::install_github('kirillseva/tldrrr')
lord63 / tldr.pyPythonpip install tldr.py
pepa65 / tldr-bash-clientBashbpkg install pepa65/tldr
porras / tlcrCrystalbrew install porras/tap/tlcr
pranavraja / tldrGogo get github.com/pranavraja/tldr
(or platform binaries)
principis / tldr-sharpC#platform packages or instructions in README
psibi / tldr-hsHaskellstack install tldr
raylee / tldr-sh-clientPOSIX Shellinstallation via curl or manually saving the script
rilut / rust-tldrRustcargo install tldr
RosalesJ / tldr-ocamlOCamlopam install tldr
skaji / perl-tldrPerlcpanm App::tldr
tldr-pages / tldr-c-clientCHomebrew: brew install tldr
Macports: port install tldr-cpp-client
tldr-pages / tldr-python-clientPythonpip install tldr
ArchLinux: pacman -S tldr
ve-nt / outfieldrZigInstructions in the README
YellowApple / tldrbRubygem install tldrb
HardDie / myTldrGogo get github.com/HardDie/myTldr
(or platform binaries)
(supports custom pages directories)
marchersimon/tldr-cppC++yay -S tldr-cpp-git
iamgodot/py-tldrPythonpip install py-tldr
azraeljd/tldr-bashBashInstructions on the README
eqf0 / mtNimnimble install mt

Mobile clients

ClientPlatformInstallation instructions
Techno-Disaster / tldr man-pagesAndroidtldr man-pages on Google Play, and F-Droid
hidroh / tldroid (outdated)Androidtldroid on Google Play
freesuraj / TLDRiOSTLDR Man Page in App Store
mflint / ios-tldr-vieweriOStldr-pages in App Store

Desktop clients

ClientPlatformInstallation instructions
terenceng2010/tldr-electronLinux, macOS, Windowselectron-packaged binaries at https://github.com/terenceng2010/tldr-electron

Application integration

ApplicationLanguageSource codeInstallation instructions
AlfredGokonoui / alfred-tldrInstructions on the README
AlfredPythoncs1707 / tldr-alfred
Dash for macOS / ZealPythonModdus / tldr-python-dash-docsetopen Preferences > Downloads > User Contributed and find tldr pages in the list
EmacsEmacs Lispkuanyui / tldr.eltldr.el is now available on MELPA
SlackRusttldr-slack-botAdd a bot user to workspace, obtain API key, compile repository with cargo and execute.
TelegramJavaScripttldr-telegramAdd the bot on Telegram or follow the installation instructions.
KeypirinhaPythonkeypirinha-tldrFollow the installation instructions on the readme page.
DiscordC#Epictek/tldr-Discord
DendronJavaScriptkevinslin/seed-tldrInstall Dendron (VS Code extension), then follow the Quickstart to add the dendron.tldr vault
Rust/CoreutilsRustuutils/coreutilsCoreutils written in Rust documentations uses tldr for the doc. example

from https://github.com/tldr-pages/tldr/wiki/tldr-pages-clients

-----

Node.js command-line client for tldr pages.

tldr-node-client

NPM version GitHub Action Build Status Gitter chat

Node.js based command-line client for tldr.

tldr-node-client's output for the tar page, using a custom color theme

Installing

npm install -g tldr

Usage

To see tldr pages:

  • tldr <command> show examples for this command
  • tldr <command> --os=<platform> show command page for the given platform (linuxosxsunoswindows)
  • tldr --search "<query>" search all pages for the query
  • tldr --linux <command> show command page for Linux
  • tldr --osx <command> show command page for OSX
  • tldr --sunos <command> show command page for SunOS
  • tldr --windows <command> show command page for Windows
  • tldr --list show all pages for current platform
  • tldr --list-all show all available pages
  • tldr --random show a page at random
  • tldr --random-example show a single random example
  • tldr --markdown show the original markdown format page

The client caches a copy of all pages locally, in ~/.tldr. There are more commands to control the local cache:

  • tldr --update download the latest pages and generate search index
  • tldr --clear-cache delete the entire local cache

As a contributor, you might also need the following commands:

  • tldr --render <path> render a local page for testing purposes

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 as zhpt_BR, or fr) 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 without sudo access can set it locally in their ~/.profile.

  • LANG=zh tldr <command>

For the list of available translations, please refer to the main tldr repo.

Configuration

You can configure the tldr client by adding a .tldrrc file in your HOME directory. You can copy the contents of the config.json file from the repo to get the basic structure to start with, and modify it to suit your needs.

The default color theme is the one named "simple". You can change the theme by assigning a different value to the "theme" variable -- either to one of the pre-configured themes, or to a new theme that you have previously created in the "themes" section. Note that the colors and text effects you can choose are limited. Refer to the chalk documentation for all options.

{
  "themes": {
    "ocean": {
      "commandName": "bold, cyan",
      "mainDescription": "",
      "exampleDescription": "green",
      "exampleCode": "cyan",
      "exampleToken": "dim"
    },
    "myOwnCoolTheme": {
      "commandName": "bold, red",
      "mainDescription": "underline",
      "exampleDescription": "yellow",
      "exampleCode": "underline, green",
      "exampleToken": ""
    }
  },
  "theme": "ocean"
}

If you regularly need pages for a different platform (e.g. Linux), you can put it in the config file:

{
  "platform": "linux"
}

The default platform value can be overwritten with command-line option:

tldr du --os=osx

As a contributor, you can also point to your own fork containing the tldr.zip file. The file is just a zipped version of the entire tldr repo:

{
  "repository": "http://myrepo/assets/tldr.zip"
}

By default, a cache update is performed anytime a page is not found for a command. To prevent this behavior, you can set the configuration variable skipUpdateWhenPageNotFound to true (defaults to false):

{
  "skipUpdateWhenPageNotFound": true
}

Command-line Autocompletion

Currently we only support command-line autocompletion for zsh and bash. Pull requests for other shells are most welcome!

zsh

It's easiest for oh-my-zsh users, so let's start with that.

mkdir -p $ZSH_CUSTOM/plugins/tldr
ln -s bin/completion/zsh/_tldr $ZSH_CUSTOM/plugins/tldr/_tldr

Then add tldr to your oh-my-zsh plugins, usually defined in ~/.zshrc, resulting in something looking like this:

plugins=(git tmux tldr)

Alternatively, using zplug

zplug "tldr-pages/tldr-node-client", use:bin/completion/zsh

Fret not regular zsh user! Copy or symlink bin/completion/zsh/_tldr to my/completions/_tldr (note the filename). Then add the containing directory to your fpath:

fpath = (my/completions $fpath)

Bash

ln -s bin/completion/bash/tldr ~/.tldr-completion.bash

Now add the following line to our bashrc file:

source ~/.tldr-completion.bash

FAQ

Installation Issues

  • If you are trying to install as non-root user (npm install -g tldr) and get something like:
Error: EACCES: permission denied, access '/usr/local/lib/node_modules/tldr'

Then most probably your npm's default installation directory has improper permissions. You can resolve it by clicking here

  • If you are trying to install as a root user (sudo npm install -g tldr) and get something like:
as root ->
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/tldr/node_modules/webworker-threads/.node-gyp"
gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/tldr/node_modules/webworker-threads/.node-gyp/8.9.1"

You need to add the option --unsafe-perm to your command. This is because when npm goes to the postinstall step, it downgrades the permission levels to "nobody". Probably you should fix your installation directory permissions and install as a non-root user in the first place.

  • If you see an error related to webworker-threads like:
/usr/local/lib/node_modules/tldr/node_modules/natural/lib/natural/classifiers/classifier.js:32
    if (e.code !== 'MODULE_NOT_FOUND') throw e;

Most probably you need to reinstall node-gyp and webworker-threads. Try this -

sudo -H npm uninstall -g tldr
sudo -H npm uninstall -g webworker-threads
npm install -g node-gyp
npm install -g webworker-threads
npm install -g tldr

For further context, take a look at this issue

from https://github.com/tldr-pages/tldr-node-client

----

https://tldr.sh/assets/tldr-book.pdf

No comments:

Post a Comment