LinuxCommandLibrary

hn

Set or view hostname

TLDR

View stories on Hacker News

$ hn
copy

View _number_ of stories on Hacker News
$ hn [[-l|--limit]] [number]
copy

View stories on Hacker News, and keep the list open after selecting a link
$ hn [[-k|--keep-open]]
copy

View stories on Hacker News sorted by submission date
$ hn --latest
copy

SYNOPSIS

hn [global-options] command [command-options] [arguments]

PARAMETERS

-json
    Output in JSON format instead of human-readable

-markdown
    Render comments in Markdown

-colors=false
    Disable colored output

-pager
    Use pager for long output

-offline
    Use cached data if available (some implementations)

-limit=N
    Limit number of stories/comments to N

--help
    Show help

DESCRIPTION

The hn command is a lightweight, terminal-based interface to Hacker News (news.ycombinator.com), powered by its JSON API.

It allows users to browse top, new, best, and ask stories, view individual posts with comments, check user profiles, and more—all without opening a web browser. Written in Go for speed and portability, it's ideal for developers monitoring tech news on the command line.

Key features include colorized output, paging for long comment threads, JSON export for scripting, and offline caching in some forks. Install via go install or package managers like Homebrew (brew install hncli). Usage is intuitive with subcommands like hn top for trending stories or hn show 123 for details.

Perfect for servers, SSH sessions, or minimal setups, it respects API rate limits and supports customization via flags.

CAVEATS

Third-party tool, not in core Linux distros; requires installation. API-dependent, subject to Hacker News limits. Multiple implementations exist (e.g., skx/hn, ije/hn)—check man page or hn --help for specifics.

COMMON COMMANDS

hn top: Top stories
hn new: Newest
hn show <ID>: Story + comments
hn user <name>: User submissions

INSTALLATION

Go: go install github.com/skx/hn@latest
Brew: brew install hncli
AUR: hn-cli

HISTORY

Originated around 2013 with early Go ports; popularized by tools like skx/hn (2015+). Evolved with HN API v0; active forks add features like search, notifications.

SEE ALSO

curl(1), jq(1), newsboat(1)

Copied to clipboard