How to use the command 'newsboat' (with examples)

How to use the command 'newsboat' (with examples)

Newsboat is a command-line based RSS/Atom feed reader designed for text terminals. It is a powerful tool for those who prefer to keep up with various news sources through a terminal interface rather than graphical applications. Newsboat allows users to manage their subscriptions, refresh feeds, and view unread articles efficiently from a command-line environment.

Use case 1: Import Feed URLs from an OPML File

Code:

newsboat -i my-feeds.xml

Motivation:

Importing feed URLs from an OPML file is highly beneficial for users who are transitioning from another RSS reader or who have exported their list of feed subscriptions. Utilizing this command allows for a seamless import process, ensuring no feeds are left behind and saving the user time from manually re-entering each RSS feed URL.

Explanation:

  • newsboat: This is the command used to start the Newsboat application.
  • -i: This flag specifies that the next argument will be the path to an OPML file from which Newsboat should import URLs.
  • my-feeds.xml: This is the file name of the OPML file containing the RSS feed URLs you want to import. Replace my-feeds.xml with your actual file name and its path if necessary.

Example Output:

When the command executes successfully, the following feedback appears in the terminal:

Importing OPML from 'my-feeds.xml'... Done.

It indicates that Newsboat has read the provided OPML file and successfully imported all the feed URLs listed.

Use case 2: Add Feeds Manually

Code:

echo http://example.com/path/to/feed >> "${HOME}/.newsboat/urls"

Motivation:

Manually adding feeds is a necessary task when you come across a new feed that is not yet in your subscription list, especially for niche sources that one might want to keep an eye on. This command allows you to easily append a new feed URL directly to Newsboat’s configuration file.

Explanation:

  • echo: This is a bash command that outputs the string provided.
  • http://example.com/path/to/feed: This represents the new feed URL that you want to add to your Newsboat subscriptions. Replace this with the actual URL you wish to subscribe to.
  • >>: This appends the output to a file rather than overwriting it, ensuring that all existing feeds in the file remain intact.
  • "${HOME}/.newsboat/urls": This is the path to the file where Newsboat stores its list of feed URLs. Using ${HOME} ensures that the file path is correctly interpreted on any user’s system.

Example Output:

The command itself does not produce any direct terminal output, but you will find that the URL has been added to ~/.newsboat/urls once you open it with a text editor:

http://example.com/path/to/feed

Use case 3: Start Newsboat and Refresh All Feeds on Startup

Code:

newsboat -r

Motivation:

Automatically refreshing all feeds upon starting Newsboat is useful for users who want the most up-to-date news without manual intervention. It streamlines the user experience, ensuring that all your subscribed channels provide current information as soon as you start your session.

Explanation:

  • newsboat: This begins the Newsboat application.
  • -r: The refresh flag commands Newsboat to update all feeds immediately upon starting. This ensures the feed data shown is the latest fetched from the server.

Example Output:

On running this command, Newsboat launches and presents a list of all feeds, subsequently displaying messages regarding the status of each feed update in real-time.

[21:58:23] Loading ...
[21:58:23] Downloading ...
[21:58:25] Update of ... complete

Use case 4: Execute One or More Commands in Non-Interactive Mode

Code:

newsboat -x reload print-unread ...

Motivation:

Executing commands in non-interactive mode is particularly advantageous for automation or scripting scenarios. It allows the user to routinely check for updates and gather specific information about unread articles without manually navigating the application interface.

Explanation:

  • newsboat: This starts the Newsboat application.
  • -x: This flag sets Newsboat into non-interactive mode, allowing it to run commands directly.
  • reload: This command refreshes all feeds.
  • print-unread: This command prints out a list of unread articles, allowing the user to quickly see what’s new in their feeds.

Example Output:

This command runs quietly without launching the Newsboat UI, producing a straightforward output:

10 unread articles in [Feed Title 1]
5 unread articles in [Feed Title 2]
...

Use case 5: See Keyboard Shortcuts

Code:

Simply press the ? key while Newsboat is running.

Motivation:

Accessing the list of keyboard shortcuts is crucial for users wanting to enhance their efficiency and speed in navigating through the Newsboat application. With knowledge of shortcuts, users can manage their feeds more effectively without overly relying on menus or the mouse.

Explanation:

  • ?: When viewing the feed list or an article list, pressing this key brings up a help screen that shows all available keyboard shortcuts, explaining what each key press does within Newsboat.

Example Output:

Pressing ? within the Newsboat interface opens a help screen that might include:

Navigation
  j: next article
  k: previous article
  g: first article
  G: last article
...
Press any key to continue.

Conclusion:

Newsboat is an extremely versatile command-line tool that caters to power users who prefer or require a terminal-based workflow for keeping up with RSS/Atom feeds. Whether importing from an existing OPML file, adding feeds manually, or automating feed updates, Newsboat’s array of command options makes it a robust choice for terminal enthusiasts seeking news aggregation.

Related Posts

How to Use the Command 'podman image' (with Examples)

How to Use the Command 'podman image' (with Examples)

Podman is a popular open-source containerization tool that offers users the ability to manage their container images, volumes, and other runtime features.

Read More
How to use the command 'bun' (with examples)

How to use the command 'bun' (with examples)

Bun is a modern JavaScript runtime and toolkit that stands out due to its powerful built-in features, including a JavaScript runtime, a bundler, a test runner, and a package manager.

Read More
Exploring the 'apt-cache' Command (with Examples)

Exploring the 'apt-cache' Command (with Examples)

The apt-cache command is a powerful tool used in Debian and Ubuntu Linux environments for querying the package database.

Read More