haxor-news Lets You Browse and Search Hacker News From Your Linux Terminal
Hacker News is an essential source of news and interesting articles for hackers, coders, and anyone with an interest in technology and tech culture.
While you would normally read HN through a web interface, a dedicated app, or an email digest, you can read, search, and filter the latest articles through your terminal. Here’s how.
What Is Hacker News?
Put simply, Hacker News is a news aggregator platform. Users can submit either text posts or links to online articles that are likely to be of interest to the tech community. Other users can upvote your submission, or ignore it.
If you’re familiar with Reddit, you’ll recognize the format of the platform, although there are a few essential differences. The main site has a super simple layout, reminiscent of the early days of the internet, and which could best be described as Spartan.
There’s no downvote button, and there are no sub-forums. Away from the front page, there is, however, a specially tagged “jobs” section, as well as “ask” for asking questions, and “show”, which acts as a show and tell type area.
Why Access Hacker News From Your Terminal?
Due to its simple text-only layout, there’s a real advantage to viewing Hacker News in a browser. You don’t get images or adverts, there are no audio or video embeds, and to be frank, the aesthetics of the site are not pretty.
As you probably have a couple of terminal windows open anyway, it’s thematically appropriate to pop open another one to browse, view, and filter Hacker News posts, comments, post-linked web content, hiring posts, and user information.
How to Install and Use haxor-news on Linux
haxor-news is a Python app, with packages hosted on PyPI. You will need to have Python installed on your system to download and install it. Don’t worry if you don’t have the latest Python version, as haxor-news supports everything from Python 2.6 right up to Python 3.7.
With that out of the way, all you need to do is open a terminal, and enter:
pip install haxor-news
Once you’ve installed haxor-news, you can view available commands by entering the following into a terminal:
Basic usage is simple, and to view the best 10 posts from the last several days you would enter:
If you need more than the top 10 in your terminal, simply append an integer for your desired number of posts. For instance:
hn best 30
…will display the 30 best HN posts from the last few days.
But viewing headlines isn’t enough. You use haxor-news to view the linked content from other sites as formatted Markdown in your terminal after viewing a list of posts with the view argument followed by the number of the post. For instance:
hn view 9
If the article contains content such as video, which is difficult to display in a terminal, add the -b switch to open the linked page in your default browser instead:
hn view 12 -b
The real value of Hacker News comes from its comments and community interaction, where you can find deep discussions and insights relating to the original post. The -c switch will expand all comments for the post, allowing you to view the sparkling wit and repartee of Hacker News regulars:
hn view 18 -c
Alternatively, if you want to keep a local copy of the comments for a particular post, you can save them to a file with:
hn view 8 --comments > /path/to/comments.txt
When viewing comments, it’s good to be able to filter out comments that you’ve already read. You can view only unseen comments with the -u switch. For instance:
hn view 12 -cu
Filter haxor-news With Regular Expressions
Regular expressions (regex) are sequences of characters specifying a search pattern in the text, and you can use them to help you find posts and comments as well as search for freelance coding jobs by adding the -q switch to your search query.
For a case-insensitive search for comments containing the term “moderators” on the third HN post, you would enter:
hn view 3 -cq "(?i)moderators"
Comments containing the requested term will be highlighted.
Regex search is even more useful when looking for jobs or freelance employees. You can browse through monthly hiring posts with:
And through jobseeker posts with:
Using regex means you can more closely find exactly what you’re looking for. For example, if you’re searching for a job that suits your Python and Java skills, you can enter:
hn hiring "(?i)Python|Java"
The above query will return matches for either of your skills.
Hacker News Isn’t the Only Great Source of Tech News, Jobs, and Discussion
In addition to Hacker News, and, of course, MakeUseOf, there are several sites where you can find interesting news and links to articles.
If you use Hacker News to search for jobs or freelancers, you’d love browsing through other websites dedicated to helping you find freelance work.