40 votes

What are your favorite CLI tools/applications?

While I've been teaching myself my first programming language (Python), I've been getting more into using the terminal as much as possible to build familiarity and get comfortable. This has opened my eyes to so many useful utilities and makes me curious as to what there is out there that I haven't heard of yet.


My favorites so far:

exa - A modern version of "ls"

youtube-dl - Download videos from youtube.com or other video platforms with various options

hledger - Plain text double-entry accounting software based on ledger written in Haskell

thefuck - App that corrects a spelling mistake in the previous command by typing "fuck"

spicetify-cli - Customizes the Spotify client with themes and extensions

spotifyd - Lightweight Spotify daemon

spotify-tui - Control Spotify in the terminal

neofetch - Launch tool that can display ASCII art or pictures and general system information

I'm on macOS but I'm almost certain all of these are cross-platform.


What are your favorite or "must-have" CLI packages?

25 comments

  1. [2]
    Comment deleted by author
    Link
    1. mxuribe
      Link Parent
      +1 on micro - if only because it so nicely/simply supports good ol' ctrl-c for copying and ctrl-v for pasting. ;-)

      +1 on micro - if only because it so nicely/simply supports good ol' ctrl-c for copying and ctrl-v for pasting. ;-)

      2 votes
  2. cmccabe
    Link
    Vim is well worth the time investment if you want a good editor for your programming (or for any plaintext editing, really).

    Vim is well worth the time investment if you want a good editor for your programming (or for any plaintext editing, really).

    9 votes
  3. balooga
    Link
    bat is a nice replacement for cat and less that adds syntax highlighting for recognized file formats. I have a couple aliases that let me neatly replace both of those commands with it: alias...

    bat is a nice replacement for cat and less that adds syntax highlighting for recognized file formats. I have a couple aliases that let me neatly replace both of those commands with it:

    alias cat="bat -pp"
    alias less="bat -p"
    

    I also wrote a couple functions to use it to mimic head and tail:

    function head() {
        if [[ ! -p /dev/stdin ]]
        then
            file="${@: -1}"
            length=$(($#-1))
            args=${@:1:$length}
            if test -f "$file"
            then
                filename=$(basename -- "$file")
                extension="${filename##*.}"
                /usr/bin/head $args $file | bat -pp -l $extension
            else
                echo "File does not exist." >&2
            fi
        else
            /usr/bin/head $@
        fi
    }
    function tail() {
        if [[ ! -p /dev/stdin ]]
        then
            file="${@: -1}"
            length=$(($#-1))
            args=${@:1:$length}
            if test -f "$file"
            then
                filename=$(basename -- "$file")
                extension="${filename##*.}"
                bat_paging_arg=""
                tail_force_follow_arg=""
                while getopts ':fF' flag; do
                    case "${flag}" in
                        f|F)
                            bat_paging_arg='--paging=never'
                            tail_force_follow_arg='-F'
                            ;;
                    esac
                done
                /usr/bin/tail $args $tail_force_follow_arg $file | bat -pp $bat_paging_arg -l $extension
            else
                echo "File does not exist." >&2
            fi
        else
            /usr/bin/tail $@
        fi
    }
    

    I haven't done robust testing on those but for my limited uses of head and tail they work. It's nice to have pretty colors in these old-school CLI utils.

    Note: I hard-coded the paths to actual head and tail binaries on my system, which may be different on your machine.

    9 votes
  4. [2]
    Crestwave
    Link
    Here's a rambly list of utilities that you might find useful. I've included TUIs and such since you seem to have included them in your post: ffmpeg is the swiss army knife of audio and video. Need...

    Here's a rambly list of utilities that you might find useful. I've included TUIs and such since you seem to have included them in your post:

    ffmpeg is the swiss army knife of audio and video. Need to convert formats? Change a file's volume? Screen record/screenshot? Slow down a video? Reduce a video's size? Cut a snippet? Crop black bars? It can do it all and much, much more.

    But for actually playing them (although FFmpeg does come with ffplay, which can play files), I use mpv. I don't think it's ever failed to play a video (although playing videos may not be considered CLI) for me, when every other player has multiple times, and it supports stuff like YouTube links (using youtube-dl as its backend, which I also find great) and playing from a virtual terminal with the drm driver.

    ripgrep is a very fast grep alternative; great for searching directories and such. In a similar vein, fd is an alternative to find, although I find the former more useful.

    rsync is my go-to for copying files beyond simple cp uses. It can show a progress indicator, sync files (only copying the differences), copy to remote locations, etc.

    hyperfine has a lot of features for benchmarking.

    netcat is the swiss army knife of networking; I don't really do complex networking stuff, but it's still useful for things like checking for open ports, opening connections (I usually use this for sending extremely long URL from a device to another), etc.

    It's a bit obvious, but Bash itself is one of the most useful tools to me outside of coreutils, and it's often underutilized. Python is also great for stuff like creating an HTTP server that serves a directory's contents.

    wget is great for robust or complex downloading. My internet connection is often spotty and wget is a godsend, retrying downloads and allowing you to continue stuff. It's almost (though not quite) like torrenting! Also, you can download everything in a link, which I use with Python's HTTP server that I mentioned earlier to transfer directories when I don't want to tar things up or set up SSH. curl is also great stuff like checking redirects.

    Speaking of torrenting, I use rtorrent for that. I've also been meaning to look into aria2.

    tmux is great, not just for splitting a screen, but stuff like sharing a session across terminals and keeping a session alive after an SSH (OpenSSH is also part of this list!) session is killed.

    bc is great for calculations beyond the extremely simple stuff that Bash can handle.

    Vim is my go-to for text editing and it's everywhere.

    weechat is my preferred IRC client.

    8 votes
    1. mxuribe
      Link Parent
      I'm a recent convert to ripgrep. Admittedly my needs tend to be very simple (I'm not some sort of grep ninja), so grep is fine too...but ripgrep sure is fast!

      I'm a recent convert to ripgrep. Admittedly my needs tend to be very simple (I'm not some sort of grep ninja), so grep is fine too...but ripgrep sure is fast!

      3 votes
  5. scissortail
    Link
    I adore ffmpeg for quick and easy conversion of audio files. I've only just started with alpine but am liking it pretty well as a mail reader. bc works well as a simple calculator but is...

    I adore ffmpeg for quick and easy conversion of audio files.
    I've only just started with alpine but am liking it pretty well as a mail reader.
    bc works well as a simple calculator but is apparently stupid powerful, with applications well beyond my ken.
    cmus is my preferred music player.
    rsync is great for backups or pushing changes to remote servers via ssh.
    wordgrinder is a simple little word processor that can export to various file formats.
    pandoc is good for changing programs between file formats.
    tty-clock is good if you like tiling window managers and don't like status bars.
    tuir is good if you're still nursing a reddit addiction.

    EDIT: youtube-dl is incredible too!

    7 votes
  6. [2]
    kodystriplin
    Link
    If you are using zsh (the new default shell on macOS) you should check out Oh My ZSH. They've got lots of CLI programs in the form of plugins. I use the git, wd (warp), osx, spotify, and vsca (VS...

    If you are using zsh (the new default shell on macOS) you should check out Oh My ZSH. They've got lots of CLI programs in the form of plugins. I use the git, wd (warp), osx, spotify, and vsca (VS Code) plugins all day every day.

    6 votes
    1. kari
      Link Parent
      I’m really late, but prezto is another alternative. Personally, it worked better for me than Oh My ZSH. OMZ, for some reason, would take a second or more to print the prompt after every command,...

      I’m really late, but prezto is another alternative. Personally, it worked better for me than Oh My ZSH. OMZ, for some reason, would take a second or more to print the prompt after every command, even without any plugins active.

  7. timo
    Link
    git, use it for pretty much every project. Also for dotfiles. rsync: for backups / syncing. vim: Slowly learning it, but it has currently replaced other text editors in the terminal for me. rtv:...

    git, use it for pretty much every project. Also for dotfiles.
    rsync: for backups / syncing.
    vim: Slowly learning it, but it has currently replaced other text editors in the terminal for me.
    rtv: reddit terminal client. My usual goto, since the website is crap. rtv isn't maintained anymore but there are some forks. Should update sometime.
    tealdeer, tld: Get TL:DR's for CLI tools, quite useful when you forget the arguments for commands like tar again.
    bat: cat with colors. Aliased to cat.
    exa: ls with colors. Aliased to ls.
    ripgrep, rg: grep replacement.

    I should really learn some Rust, using so much of it :P

    6 votes
  8. mxuribe
    Link
    I knew of youtube-dl for quite some time now...but for some reason i find myself using it tons more recently. I used it at first to mostly download DJ mixes and burn them to CDs (for listening in...

    I knew of youtube-dl for quite some time now...but for some reason i find myself using it tons more recently. I used it at first to mostly download DJ mixes and burn them to CDs (for listening in my old car)...now when i download the mixes, i just instinctively listen to them offline. If you have a playlist of media from youtube that you want to view/listen to without ads, youtube-dl is the way to do it. (Not that the ads bother me much, but i guess it might be important for others.)

    5 votes
  9. [4]
    SleepyGary
    Link
    Other than already listed (n)vim and thefuck, I really like tldr a much friendlier and simplified tool alternative to man

    Other than already listed (n)vim and thefuck, I really like tldr a much friendlier and simplified tool alternative to man

    4 votes
    1. [3]
      mxuribe
      Link Parent
      I like tldr, but recently learned of http://cheat.sh/ - and yes it is curl-able from the terminal. For example, in order to learn about the "ls" command, you would run the following: curl...

      I like tldr, but recently learned of http://cheat.sh/ - and yes it is curl-able from the terminal. For example, in order to learn about the "ls" command, you would run the following:
      curl cheat.sh/ls

      As long as you have curl installed, you don't need to install "cheat.sh" nor anything else - pretty nifty! (This assumes you have internet connectivity of course.) I have it set as an alias on my linux laptop, so just do something like:
      cheat ls
      (and then it runs "curl cheat.sh/ls")

      3 votes
      1. [2]
        SleepyGary
        Link Parent
        That's neat in a pinch but I also appreciate the tab completion of having the utility installed on my computer.

        That's neat in a pinch but I also appreciate the tab completion of having the utility installed on my computer.

        5 votes
        1. mxuribe
          Link Parent
          Yeah, that is a good benefit.

          appreciate the tab completion

          Yeah, that is a good benefit.

          2 votes
  10. mrnd
    Link
    For me, excluding the standard *nix tools, it is fzf. At its base, it's a simple filter: you can pipe lines to it and interactively and fuzzily select out of them. But it also provides a lot of...

    For me, excluding the standard *nix tools, it is fzf.

    At its base, it's a simple filter: you can pipe lines to it and interactively and fuzzily select out of them. But it also provides a lot of integrations out of the box like shell commands (history search, selecting files, entering directories and so on) and editor integrations. And then there are of course a lot of third-party integrations, of which my favorite is probably notational-fzf-vim for note taking and searching.

    It's just so simple tool, that advances the whole ecosystem by providing a simple way to greatly improve upon the standard CLI user experience.

    4 votes
  11. andre
    Link
    z or autojump are invaluable for navigating to frequently used directories quickly. tmux for dealing with more than one shell at a time. I use alacritty on OS X, which doesn't have tabs and...

    z or autojump are invaluable for navigating to frequently used directories quickly.

    tmux for dealing with more than one shell at a time. I use alacritty on OS X, which doesn't have tabs and splits, and tmux is nicer anyways. I spend my entire day in vim inside tmux.

    3 votes
  12. eyybby
    Link
    multitail lets you essentially do a tail -f on multiple files at once which is very useful for checking out multiple log files when debugging. In a similar vein, mssh lets you log into multiple...

    multitail lets you essentially do a tail -f on multiple files at once which is very useful for checking out multiple log files when debugging.

    In a similar vein, mssh lets you log into multiple hosts to allow you to issue commands to them all in bulk. Very handy for one-off maintenance or hotfixes.

    jq as it describes itself is 'sed for JSON'.

    3 votes
  13. satotake
    Link
    bpython is great if you are pythonista

    bpython is great if you are pythonista

    3 votes
  14. Artemix
    Link
    I use kickstart to manage my project bootstrapping, which I find to be really useful.

    I use kickstart to manage my project bootstrapping, which I find to be really useful.

    2 votes
  15. The-Toon
    Link
    Along with what other people have been saying, I use potato and alarm as simple pomodoro and alarm apps respectively. As for Python programming, I've been playing around with flake8 (with an...

    Along with what other people have been saying, I use potato and alarm as simple pomodoro and alarm apps respectively.

    As for Python programming, I've been playing around with flake8 (with an extension for pydocstyle) and Mypy recently.

    2 votes
  16. [2]
    Pistos
    Link
    In addition to the common ones others have said: Silver Searcher ("ag"): a grep replacement jq: Mostly just for colourizing JSON. I have a shell script for piping curl output to it: curl -s "$@" |...

    In addition to the common ones others have said:

    • Silver Searcher ("ag"): a grep replacement
    • jq: Mostly just for colourizing JSON. I have a shell script for piping curl output to it: curl -s "$@" | jq -C '.' | less
    • mplayer: My go-to CLI audio and video player
    • ffmpeg: Audio and video Swiss army knife, for format conversions and manipulations like changing bit rate, sample rate, etc.
    • exiftool: For inspecting meta data of just about any file. For example, video frame rate, audio sample rate, video or image dimensions, resolution, bit depth, playback duration.
    • psql: I prefer interacting with databases via CLI, and not GUI or web UI.
    2 votes
    1. mxuribe
      Link Parent
      I learned about exiftool only a few months ago myself, and have used it a few times to great benefit! The first time that i needed to use it, i had one of those moments where i literally said to...

      I learned about exiftool only a few months ago myself, and have used it a few times to great benefit! The first time that i needed to use it, i had one of those moments where i literally said to myself: "where have you been all of my life!?!" :-)

      2 votes
  17. [2]
    mgutz
    (edited )
    Link
    Very good timing. I'm an American working remotely from the Philippines. Unfortunately due to the sudden pandemic lockdown, I am in a waiting queue to get fiber internet installed (weeks already)....

    Very good timing. I'm an American working remotely from the Philippines. Unfortunately due to the sudden pandemic lockdown, I am in a waiting queue to get fiber internet installed (weeks already). I have no choice to use my phone's hot spot, which is slow with frequent outages. I've since become productive working through ssh to a remote Digital Ocean box. I use about 400mb of data per day.

    Essential tools for low bandwidth and recommended terminal utils:

    • mosh: Mobile SSH. My SSH connection remains open no matter if I close my laptop, my phone runs out of data, etc. I run mosh through dtach to keep the client running in case I accidentally close the terminal. The only con is agent forwarding doesn't work well. I opted to generate secondary keys on the server itself.
    • tmux: Didn't think I would like it after using i3 and iTerm2. I was WRONG. It is TERRIFIC.
    • w3m: Text based browsing. Starting to like this flow over graphical browsing. I can read with more focus. Another benefit is the page buffer can be edited in vim quickly.
    • googler: Search google then launch links in w3m.
    • neovim + coc.nvim: I miss VS Code but this IDE-ish combination gets close for Javascript and Golang development.
    • ansible: Can't beat it for devops.
    • usql: psql for many databases. usql has variables etc.
    • ripgrep (rg): Fastest search. Stopped using silver searcher a while back.
    • jq: Json querying and setting.
    • ranger: Awesome text file manager.
    • ncdu: Interactive disk usage.

    BTW, latest Windows Terminal works great with tmux and mouse. I rarely use the mouse, but it comes in handy to select text in terminal and tmux. I run mosh from Ubuntu (WSL). Developing from Windows is great again.

    My workflow is:

    1. Open Windows Terminal
    2. Connect to Ubuntu WSL
    3. mosh to my Digital Ocean server
    4. start tmux
    5. code away
    2 votes
    1. Pistos
      Link Parent
      Some cool things here in your list. In particular: usql and ncdu. I'll check those out. But re: silver searcher: Does ripgrep have good features over and above what ag provides? Or is it strictly...

      Some cool things here in your list. In particular: usql and ncdu. I'll check those out. But re: silver searcher: Does ripgrep have good features over and above what ag provides? Or is it strictly the improved speed that you like? I ask because speed is not really a concern for me as far as grepping tools go.

  18. just_a_salmon
    Link
    My development workflow is git + tmux + vim + ctags + ranger. The only thing really lacking is namespace and object property autocomplete (ie type “std::cout.f”, hit ctrl-n, and select “flush”...

    My development workflow is git + tmux + vim + ctags + ranger. The only thing really lacking is namespace and object property autocomplete (ie type “std::cout.f”, hit ctrl-n, and select “flush” from the list).