Byte Size TCP: TLDR Pages, concise man pages
Welcome to the 2nd edition of Byte Size TCP (Tools, Concepts, and Projects), where we do a bite-sized breakdown of a command, tool, or concept you can put to use right away.
Today we are going to look at tldr pages, a community-driven project that simplifies manuals pages and provide practical examples.
The Tool: TLDR Pages
TLDR Pages provides users with quick overview of a command, to include a short description, link to the official man pages, and common examples with various flags or arguments. Pages comes in a large number of languages and supports commands for a significant number of platforms (Linux, macOS, Windows, Android to name a few). TLDR pages can be accessed through several methods, such as a web client, CLI, mobil, and even integrates with several applications such as Discord and Raycast. They even have a 6.9 MB (6,146 pages at the time of writing) PDF available.
The Concept: Read The Short Manual
Pages really shines when trying to get your feet wet with a new tool or need a refresher on existing tool syntax. Can't remember the flag for Dynamic port forwarding in SSH? Want to play with netcat but not sure where to start? Instead of digging through man pages, TLDR Pages has you covered.
The Project: Too Long Lets Read
In order to use TLDR Pages in terminal, a quick and easy brew install tlrc is all it takes to get the rust client installed using Homebrew.
By executing tldr in terminal, we get the details on how to use the tool, and options that will help us get the desired output.
Flags of Interest
tldr -R [page]- returns the output in markdown formattldr -c [page]- Remove empty lines from output making it more compacttldr -o [page]- Prevents the cache from being updated, allowing for offline use
Example:
tldr -c docker
Output:
tldr -c docker
docker
Manage Docker containers and images.
Some subcommands such as run have their own usage documentation.
More information: https://docs.docker.com/reference/cli/docker/.
List all Docker containers (running and stopped):
docker ps --all
Start a container from an image, with a custom name:
docker run --name container_name image
Start or stop an existing container:
docker start|stop container_name
Pull an image from a Docker registry:
docker pull image
Display the list of already downloaded images:
docker images
Open an interactive tty with Bourne shell (sh) inside a running container:
docker exec --interactive --tty container_name sh
Remove stopped containers:
docker rm container1 container2 ...
Fetch and follow the logs of a container:
docker logs --follow container_name
Extra Credit
Be aware multiple systems can utilize the same command and the flags or operators can be different. TLDR does provide an indicator when there is a command found for an alternative OS, which you can look up, such as the example below.
tldr -c caffeinate
Output:
warning: 1 page(s) found for other platforms:
1. linux (tldr --platform linux caffeinate)
caffeinate
Prevent macOS from sleeping.
More information: https://keith.github.io/xcode-man-pages/caffeinate.8.html.
Prevent the display from sleeping:
caffeinate -d
Prevent from sleeping for 1 hour (3600 seconds):
caffeinate -u -t 3600
Fork a process, exec "make" in it, and prevent sleep as long as that process is running:
caffeinate -i make
Prevent from sleeping until a process with the specified PID completes:
caffeinate -w pid
Prevent disk from sleeping (use <Ctrl c> to exit):
caffeinate -m
We can use the provided command to lookup the linux equivalent:
tldr --platform linux -c caffeinate
Output
tldr --platform linux -c caffeinate
warning: 1 page(s) found for other platforms:
1. osx (tldr --platform osx caffeinate)
caffeinate
Prevent desktop from sleeping.
More information: https://manned.org/caffeinate.
Prevent desktop from sleeping (use <Ctrl c> to exit):
caffeinate
Reference:
tldr.sh
GitHub.com/tldr-pages/tldr
https://tldr.inbrowser.app