Ask HN: What are your favorite terminal programs?

279 points by orcs ↗ HN
The title and why?

Recently discovered CMus and am a big fan of Pandoc and youtube-dl.

This has me wondering what else I'm missing out on.

202 comments

[ 3.2 ms ] story [ 218 ms ] thread
jq - amazingly useful for processing JSON
rg => (ripgrep) alternative to ack and grep.
There’s also ag (the silver searcher)
I must confess based on the strength of the argument buruntsushi had with the Ripgrep comparison I switched from ag to rg and have not looked back. I was a daily ag user but I don’t need the advanced regex support and I do like the speed.
I love how command-line tools are seeing the same explosion of choices as web-frameworks.

I changed to 'ack' six months ago after having used 'grep' for two decades, and already its successor 'ag' has been made redundant in favor of 'rg'.

My only peeve with 'ack' is that I can't make it switch nicely between paging and not paging:

https://stackoverflow.com/questions/50135983/less-waits-when...

I doubt any of 'ack's competitors have a fix for this, since it seems to be a pager feature that I'm looking for.

MPS-Youtube is extremely useful if you don't mind the CLI and want to quickly play a YouTube video. translate-shell if you're a language person. Very complete interface to most popular translation services. atools(aunpack, apack, als, etc) for quick archive manipulation if you're lazy.
mpv + youtube-dl plugin are also a nice combination, especially for live streams.
I prefer Streamlink[0] for live streams.

[0]: https://github.com/streamlink

Could you please elaborate why you prefer streamlink over youtube-dl?
I use them both, it is just youtube-dl is more suited for live streams and youtube-dl is more suited for downloading non-live videos.
ncdu to analyze disk space and find huge folders you can clean

And `z` (the zsh plugin) to cd into your most common directories

Thanks for sharing - I did not know about ncdu.

I typically do a series of "du -s -h * | sort -h" and this simplifies things.

wow, learned about that flag to sort today, thanks. I've been just doing "du -s | sort -n"
(comment deleted)
tig
Link? What's if for?
Its a CLI interface for git.

https://github.com/jonas/tig

Very cool, I like ncurses. Before visiting your link I was like 'isn't git already cli?'
I think TUI as in Text User Interface (similar to GUI) would be a more appropriate term than CLI. git is CLI, tig is TUI and gitk is GUI.
Here are some of my favorites that I use daily:

- tmux

- mutt - email client

- wyrd + remind - calendar

- ledger - double-entry accounting tool

- weechat + weeslack plugin - fully featured, super fast slack from the CLI

+1 for remind and wyrd. Remind is really, really powerful. You can express things like an appointment that fires "every 3 weeks starting May 4th, but if that day falls on a weekend or holiday then {skip it, move it to the following/preceding weekday that isn't a holiday}", and lots more. Wyrd is a really nice console frontend to remind (I just found that there are graphical frontends available too). Finally with rem2ics you can express really complicated things in Remind and then export the results as an iCalendar-compatible format and import that into whatever other calendar you want.

I used screen, remind+wyrd, mutt, and irssi (and even ledger) in school; I got a job at a bigco that pretty much required me to use gmail and gcal, and I stopped using console things as much. Lately I've been toying around with moving my mail flow back into console / console-ish inside emacs.

This brings back all kinds of memories: https://www.roaringpenguin.com/wiki/index.php/Remind_use_cas...

I was going to say xterm.. But I guess ssh, git, vim, gcc, make, node, tar, docker, elinks, mutt ls, ps, cp, mv, mkdir, timidity, minicom, tmux, diff, jq and some I can't recall right now
htop and xstarter (disclaimer, I'm the author of the latter)
Damn, xstarter looks neat! I'll try how well it plays with the suckless terminal :)
Thanks! I think it works well with st!
Some of them that I can't live without are

    - git-standup http://github.com/kamranahmedse/git-standup

    - z https://github.com/rupa/z

    - ZSH https://github.com/robbyrussell/oh-my-zsh

Apart from that, some that I use time to time

    - curl-size https://github.com/egoist/curl-size

    - ripgrep https://github.com/BurntSushi/ripgrep

    - jq https://github.com/stedolan/jq

    - asciinema https://github.com/asciinema/asciinema
git-standup seems cool, but misses the one thing I would want from it: show me the commits I've made from each repo that I work in, sorted by time. That way I can see that I made commit 1 in repo X, then commit 2 in repo Y, then commit 3 in repo X. Also instead of "-d 4" to see 4 days ago, "January 15th" or "Thursday" would be handy.
> show me the commits I've made from each repo that I work in, sorted by time

It does show the commits from each repo sorted by time. Repositories are not sorted though, if that is what you are asking for.

Yeah, I'm only interested in the actual flow of all my work, not the flow of my work in individual repos. I can use 'git log' to list my work in a single repo.
Just notice that you linked to Oh My Zsh (which, granted, is essential) but not to ZSH (http://www.zsh.org/)
>(which, granted, is essential)

Unless you belong to the Prezto or Antigen sects. :)

emacs

screen

notmuch, isync

powertop

parallel, ag

cd

because I never had to lookup how to use it

EDIT: hm it doesn't even have a man/info page. Where can you learn about "cd" or "cd -", then?!

`cd` is not a command; it is built into your shell.

Some systems, like OS X and CentOS, map the cd man page to builtin which lists all the shell builtins and lets you know you should look at your shell's man page.

cd has at least two man pages on Fedora 27: BASH_BUILTINS(1) and CD(1P) from POSIX Programmer's Manual.
> hm it doesn't even have a man/info page.

It does on Unix and BSD systems.

Tmux and ripgrep are two that I use daily. I used to use cloc then switched to tokei, then to my own scc which I use frequently along with lc. Hyperfine is something I have been using a lot and despite having ripgrep I still use grep often with xargs.
Written in Rust:

    - fd: A simple, fast and user-friendly alternative to 'find'
    https://github.com/sharkdp/fd

    - ripgrep: ripgrep recursively searches directories for a regex pattern
    https://github.com/BurntSushi/ripgrep

    - exa: Replacement for 'ls' written in Rust
    https://github.com/ogham/exa

    - bat: A 'cat' replacement.  I recommend following the customizations.
    https://github.com/sharkdp/bat

Written in Python:

    - asciinema: Terminal session recorder
    https://github.com/asciinema/asciinema

    - httpie: Modern command line HTTP client
    https://github.com/jakubroztocil/httpie

    - visidata: A terminal spreadsheet multitool for discovering and arranging data
    https://github.com/saulpw/visidata

    - youtube-dl: Command-line program to download videos from YouTube.com and other video sites
    https://github.com/rg3/youtube-dl

    - pgcli:  Postgres cli with autocomplete and syntax highlighting
    https://github.com/dbcli/pgcli

Written in C

    - jq: Command-line JSON processor
    https://github.com/stedolan/jq

    - tmux:  a terminal multiplexer
    https://github.com/tmux/tmux

    - pspg:  postgres pager (you can combine it with pgcli)
    https://github.com/okbob/pspg
As you are using tmux, also check out the awesome tmuxp written in Python. The author is very thorough with the package; testing and documentation. Tmuxp allows you to quickly launch pre-configured tmux sessions.
Thanks for the tip. I briefly read through the docs and it's not clear what this offers above and beyond what tmux does?
I think the idea is to be able to use tmux in different layouts, configured by simple plaintext. I'll try it out.
The benefit of tmuxp is pretty clear from its README[1]. It gives this example:

    session_name: 4-pane-split
    windows:
    - window_name: dev window
      layout: tiled
      shell_command_before:
        - cd ~/                    # run as a first command in all panes
      panes:
        - shell_command:           # pane no. 1
            - cd /var/log          # run multiple commands in this pane
            - ls -al | grep \.log
        - echo second pane         # pane no. 2
        - echo third pane          # pane no. 3
        - echo forth pane          # pane no. 4
The example is very simple (I use tmuxp to heavily configure the session initialization), but it shows how you can have a config file to set a session's name, set the number and names of windows in there, set the layout of panes differently if you want in each window, run commands like "cd", set env vars differently if you want, in each pane.

You can find a lot more examples of tmuxp config on its doc site[2].

tmux doesn't allow one to have such quick, easy-to-read config files. You can of course do most of this in your .tmux.conf, but it will be too complicated to allow reuse and quick modifications.

[1]: https://github.com/tmux-python/tmuxp#load-a-tmux-session

[2]: https://tmuxp.git-pull.com/en/latest/examples.html

That looks handy, i can see a, 'setup my testing and development environment' with just a quick cp-and-edit of config file.
I use a shell script for such config. eg tmux split-window -h ; tmux send-keys "ls -la" C-m; ...
As I mentioned earlier, it is possible to do such things within the .tmux.conf, but not practical. Here's one of my real tmuxp configs:

    # How to use this file:
    #   tmuxp load /path/to/this/file/main.yaml
    # - Specifying the .yaml extension is optional
    # - Specifying the path is optional if file is in ~/.tmuxp
    #
    #   tmuxp --help for full help.
    session_name: main
    suppress_history: false
    start_directory: '~'
    shell_command_before:
      - unsetenv SHELL_CONFIG_LOADED
      - source ~/.alias
    windows:
      - window_name: '*scratch*'
        layout: tiled
        focus: true
        panes:
          - cd ~/downloads/git           # Top-left
          - cd ~/downloads/git/emacs     # Top-right
          - focus: true                  # Bottom-left
            shell_command:
              - bob
              - sleep 2
              - tclr                     # Clear tmux status indicators
          - shell_command:               # Bottom-right
              - cd ~/.emacs.d/elisp/org-mode
              - module load gcc/6.1.0    # Needed for ob-fortran tests to pass when doing make test for Org
      - window_name: foo-1
        layout: even-horizontal
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
      - window_name: foo-2
        layout: tiled
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
          - null
      - window_name: uvm_lib
        layout: tiled
        panes:
          - cd ~/gitlab/bar_uvm_lib
      - window_name: sandbox
        layout: even-horizontal
        panes:
          - null
          - null
          - null
      - window_name: hugo
        layout: tiled
        panes:
          - shell_command:
              - cd '~/downloads/git'
          - shell_command:
              - cd '~/e/elisp/ox-hugo/example-site'
              - ./srv
          - shell_command:
              - cd '~/hugo'
          - focus: true
            shell_command:
              - cd '~/e/elisp/ox-hugo'
      - window_name: nim
        layout: even-horizontal
        panes:
          - cd ~/sandbox/nim
          - cd ~/sandbox/nim
          - focus: true
            shell_command:
              - cd ~/sandbox/nim/chat
      - window_name: tok
        layout: even-horizontal
        shell_command_before:
          - tok
          - cduh
        panes:
          - null
          - null
          - null
      - window_name: zoo
        layout: even-horizontal
        shell_command_before:
          - bob
          - cduh
        panes:
          - null
          - null
          - null
I don't do it within the .tmux.conf - I use separate scripts, one per project.
I understand. But the point I am trying to make applies there too. A script to do what I am doing in the tmuxp config I last pasted would be too unmanageable, and not as readable and reusable.
I wish HN handled long horizontal scrolling lines on mobile better. It’s aggravating that we are a site full of programmers and we can’t get the basics of usability in 2018.
One thing that I think most people don't consider often is that making things more usable isn't always good. Medium and message are interlinked. If everyone in the world switched to mobile, it would change the content of the articles we read and it would change the discussion of those articles. When you make something more usable on a different platform, you're encouraging the biases that the platform compels. In the case of mobile this means encouraging shallower content and briefer discussions, among other things.
You can have different rendering for mobile/non-mobile.

We are in the midst of everyone switching to mobile.

I know. I'm pointing out why this is a bad thing, because most people who advocate for better mobile support on Hacker News don't see themselves as advocating for a reduction in the quality of discussion and a reduction in the depth and complexity of the articles being shared.
Thanks, I see what you mean now. I didn't get it because I use a mobile platform as desktop, but that's not generally true (so far).
Sure making things more usable may sometimes have trade-offs. But I'm struggling to think of the disadvantage of basic markdown support on a site where everyone knows markdown, and even assumes it is supported. People are constantly posting markdown lists that end up all on one line.

I assume the reason it hasnt been fixed is that nobody can be bothered, which is fine. But it's still a little embarrassing. Kind of like how Stackoverflow doesn't support triple backticks. I often see questions with formatting screwed up because people assume a site that heavily relies on markdown supports an extremely common markdown feature.

> we are a site full of programmers

Exactly! And we all know how good most programmers are at UI design ;-)

Thanks for the links. In the future, please don’t use indentation to set off lists like this. It makes it difficult to read due to side scrolling, particularly on mobile. People often use - (hyphen) or * set of bullet points, and separate lines with new lines. You don’t get <li> elements, but it does work. Plus, your links will work, too :)
The problem isn't using indentation. The problem is the platform's rendering on mobile.

Agree on links tho.

Given that we're members of HN (as opposed to someone running the site), I try to provide constructive advice that others can actually use to improve the situation. The admins are well aware of the situation; continuing to argue that it's a problem with the platform while refusing to do what you can to work with the given situation seems like a needless waste of a comment.
(comment deleted)
Formatting:

Written in Rust

- fd: A simple, fast and user-friendly alternative to 'find' https://github.com/sharkdp/fd

- ripgrep: ripgrep recursively searches directories for a regex pattern https://github.com/BurntSushi/ripgrep

- exa: Replacement for 'ls' written in Rust https://github.com/ogham/exa

- bat: A 'cat' replacement. I recommend following the customizations. https://github.com/sharkdp/bat

Written in Python

- asciinema: Terminal session recorder https://github.com/asciinema/asciinema

- httpie: Modern command line HTTP client https://github.com/jakubroztocil/httpie

- visidata: A terminal spreadsheet multitool for discovering and arranging data https://github.com/saulpw/visidata

- youtube-dl: Command-line program to download videos from YouTube.com and other video sites https://github.com/rg3/youtube-dl

- pgcli: Postgres cli with autocomplete and syntax highlighting https://github.com/dbcli/pgcli

Written in C

- jq: Command-line JSON processor https://github.com/stedolan/jq

- tmux: a terminal multiplexer https://github.com/tmux/tmux

- pspg: postgres pager (you can combine it with pgcli) https://github.com/okbob/pspg reply

Written in Rust:

- rq: A tool for doing record analysis and transformation (replacement for jq, supports yaml, json, avro, protocol buffers, etc.) https://github.com/dflemstr/rq