sources/tech/20220202 Read and Organize Markdown Files in Linux Terminal With Glow.md
5.9 KiB
Read and Organize Markdown Files in Linux Terminal With Glow
Brief: Glow is a CLI tool that lets you render Markdown files in the Linux terminal. You can also organize Markdown files with it.
I love Markdown. I am not an expert Markdown user but I can surely write most of my articles in Markdown.
If you are a regular at It’s FOSS, you might have come across Markdown guides, editors and tools like Obsidian. I’ll add one more tool to this list. It’s called Glow and unlike previously covered applications, Glow enables you to read Markdown files in the terminal.
Wait! Can you not read Markdown in the terminal using the regular Linux commands to read text files like cat, less or even editors like Vim?
Yes, you can. But it will be the raw markdown file with all the codes displayed as it is, rather than showing a properly formatted text.
Do note that Glow is not an editor. You cannot use it to write in Markdown text.
Glow features Markdown lovers will love
Glow can be used in two formats: CLI and TUI.
Simply using Glow on a Markdown file will display the entire rendered content on the screen.
glow markdown_file
That’s good but Glow can do even better. It has additional options that open up the TUI mode (terminal user interface) and allows you to do more with it.
You can use the pager option to display the rendered text in pager mode (like how the less command shows the text without cluttering the screen).
glow -p markdown_file
In this pager view, you can use the / key and search for a certain text the same way you do with the less command. You can press q key to exit the view.
That’s not it. You can use the -a option and it will find all the Markdown files in the current directory and its subdirectories.
glow -a
You can use the arrow keys to scroll the files in the display. Up and down keys to move up and down, left and right arrow keys to move by pages.
You can see the help options displayed at the bottom. The find option in this view allows you to search files by name (not their content).
There are also tabs. You can move between the tabs using the tab key, of course.
The stash tab works like a bookmark. You can create a stash/bookmark by pressing the s key while browsing files or while viewing their content. This bookmark will be visible only in the current directory.
You can press x key to remove bookmark (not file) or even add a memo by pressing the m key.
The News tabs shows changelogs and other messages from the Glow developer(s).
When you have found your desired file, you can view it by pressing enter. Since you are in the TUI mode, you get additional keyboard options here. The options can be displayed by pressing the ? key.
Installing Glow on Linux
Glow is available for Linux and macOS. You can install it using Homebrew on Linux and macOS, however, I would advise using the Linux packages here.
Glow is available in the repository of Void, Solus and Arch Linux. You can use their package managers to install it.
On Arch-based distributions, use:
sudo pacman -S glow
For Ubuntu, Debian, Fedora and SUSE, there are .DEB and .RPM binaries available for various architectures and you may find that on its release page.
Download Glow for other Linux distros
Conclusion
Overall, Glow is a handy tool to beautifully view and organize Markdown files in the terminal. Like most other CLI tools, it is not for everyone. If you dwell in the terminal with a liking for Markdown files, you may give it a try. And when you do, please share your experience with it in the comment section.
via: https://itsfoss.com/glow-cli-tool-markdown/
作者:Abhishek Prakash 选题:lujun9972 译者:译者ID 校对:校对者ID