A Guide to Using the Newsboat Command (with examples)
Importing Feed URLs from an OPML File
To import feed URLs from an OPML (Outline Processor Markup Language) file, you can use the following command:
newsboat -i my-feeds.xml
Motivation: This command is useful when you have an OPML file containing a collection of feed URLs and you want to add them to Newsboat. By importing the feeds in bulk, you can save time and effort compared to manually adding each feed separately.
Explanation: The -i
flag is used to specify the OPML file to import. In this example, my-feeds.xml
is the name of the OPML file. When running this command, Newsboat will parse the OPML file and add all the feed URLs to your Newsboat configuration.
Example Output: The feed URLs from the my-feeds.xml
file are added to Newsboat, and you will see them listed as available feeds in the application.
Adding Feeds Manually
If you prefer to add feeds manually, you can use the following command:
echo "http://example.com/path/to/feed" >> "${HOME}/.newsboat/urls"
Motivation: Adding feeds manually is useful when you only have a few feed URLs to add or when you want to add a specific feed that is not included in an OPML file.
Explanation: This command appends the specified feed URL (http://example.com/path/to/feed
) to the urls
file in the Newsboat configuration directory (~/.newsboat/urls
). By adding the URLs to this file, Newsboat will automatically load them as available feeds.
Example Output: The feed URL http://example.com/path/to/feed
is added to Newsboat, and you will see it listed as an available feed in the application.
Refreshing Feeds on Startup
To start Newsboat and automatically refresh all feeds on startup, use the following command:
newsboat -r
Motivation: By refreshing all feeds on startup, you can have the latest content available immediately without manually triggering the refresh each time you open Newsboat.
Explanation: The -r
flag is used to specify that Newsboat should refresh all the feeds on startup. When you run this command, Newsboat will refresh the feeds, fetching the latest content from the respective URLs.
Example Output: Newsboat starts, retrieves and updates the latest content from all the configured feed URLs.
Executing Commands in Non-Interactive Mode
If you want to execute a space-separated list of commands non-interactively, you can use the following command:
newsboat -x "reload print-unread ..."
Motivation: This command allows you to automate Newsboat by executing a series of commands without the need for manual interaction. With this feature, you can schedule tasks or create scripts that interact with Newsboat programmatically.
Explanation: The -x
flag is used to specify a list of space-separated commands to be executed by Newsboat. In this example, the commands are reload
and print-unread
, separated by a space. The ellipsis (...
) represents additional commands that can be added as needed.
Example Output: The specified commands are executed in sequential order by Newsboat. In this case, Newsboat reloads the feeds and prints the count of unread items.
Viewing Keyboard Shortcuts
To view the keyboard shortcuts available in Newsboat, you can use the following command:
newsboat
After running this command, press ?
to see the keyboard shortcuts. The most relevant shortcuts are also visible in the status line.
Motivation: Familiarizing yourself with the keyboard shortcuts in Newsboat can significantly improve your efficiency and productivity when using the application. It allows you to navigate, mark articles as read, open links, and perform various actions quickly without relying on the mouse or touchpad.
Explanation: Running the newsboat
command without any options starts Newsboat in interactive mode. When Newsboat is running, press the ?
key to display a help screen with a list of available keyboard shortcuts.
Example Output: After running the command and pressing ?
, Newsboat displays a help screen with a comprehensive list of keyboard shortcuts that can be used within the application.
Conclusion
In this article, we explored eight different use cases of the Newsboat command. We covered importing feed URLs from an OPML file, adding feeds manually, refreshing feeds on startup, executing commands in non-interactive mode, and viewing keyboard shortcuts. These examples demonstrate various scenarios where the Newsboat command can be leveraged to enhance your experience with the RSS/Atom feed reader. By understanding these commands and their arguments, you can effectively manage and customize your feed subscriptions within Newsboat.