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?

28 comments

  1. [2]
    hungariantoast
    (edited )
    Link
    Taskwarrior is an invaluable tool for me. It's a command-line task management (todo list) program. I use it to track pretty much everything I need to do, and everything I have done. It helps me...

    Taskwarrior is an invaluable tool for me. It's a command-line task management (todo list) program. I use it to track pretty much everything I need to do, and everything I have done. It helps me immensely when it comes to tackling larger projects, breaking tasks down into smaller, more manageable jobs, and generally planning my day and week. The amount of mental effort I don't have to expend thanks to this tool is staggering.

    While the CLI interface is king, Taskwarrior has the ability to sync with a remote server. If you don't want to set up a taskserver yourself, hosted solutions like FreeCinc or Inthe.AM work really well. Inthe.AM also has a web interface in addition to acting as a sync solution.

    There are Android apps available, and I am pretty sure iOS apps as well, for syncing and managing tasks on your phone.

    One interesting thing that I have started using Taskwarrior for, that I have not seen anyone else do, is use it as a habit tracker.

    I have been trying to get into the habit of drawing something every day. Because Taskwarrior supports recurring tasks, at midnight (or the first time after midnight that the program is executed), Taskwarrior will generate a Draw something task for the current day.

    I can track how often I did a habit by the created and completed dates of each Draw something task, even if the completed date does not exist (meaning I have not completed the task yet). Taskwarrior stores all of your data in JSON files, as opposed to a database or binary format. This means I can use standard Unix tools (or Python, etc.) to parse the data. This allows me to write a script using Taskwarrior's JSON data that pretty prints a nice calendar or graph of my habits over a period of time.

    Also, because Taskwarrior is a command-line program, it can be scripted. If I wanted each Draw something task to instead be Draw something <today's date>, I can easily set that up using cron jobs and shell scripts, or via hooks, which are actions that Taskwarrior can execute automatically when doing a specific thing.

    These are benefits that declarative (handwritten) task management systems like Todo.txt and Org-mode don't provide.

    Overall, I view Taskwarrior a lot like I view Vim. It has a bit of a learning curve, a lot of features, and its benefits become greater and greater the more heavily you use it.


    myrepos is an excellent tool for managing multiple git repositories. Basically, it allows you to register repositories in specified directories. Then, anywhere on your computer, you can run a command and myrepos will update all the repositories, recursively, below the current directory.

    If a registered repository does not exist, then myrepos will automatically clone it into the correct directory. The program also has a bunch of other neat features too, but my workflow is so simple that I don't find myself using them much. If you have a lot of cloned repositories on your computer that you want to manage, this is a good tool to use. It also makes migrating to new computers really easy.


    git-annex is, as far as I am concerned, the only viable tool for syncing multiple files across multiple devices. I have never found anything else that handles n-way syncing as good as this. Unfortunately, understanding how it works and how to use it is about as hard as understanding regular git, so if you are not familiar with git, then learning how to use this tool effectively can be a challenge.


    Zenith, bottom, gotop, ytop, htop, and nmon are all nice system monitor programs (and are certainly not the only ones).


    Micro is a great alternative to Vim or nano if all you need is a simple, terminal-based text editor with normal keyboard shortcuts.

    10 votes
    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. Bauke
    (edited )
    Link
    If you're like me and have all your projects in 1 directory (and use git), multi-git-status is a real useful tool for figuring out the status of all your projects at once. The screenshot in the...

    If you're like me and have all your projects in 1 directory (and use git), multi-git-status is a real useful tool for figuring out the status of all your projects at once. The screenshot in the repo shows what the output looks like without any options.

    My usage of it is usually mgs -c . 1 | sort so it only checks 1 level deep and then also sorts the output alphabetically, and the -c is to preserve colors when using pipes.

    6 votes
  7. [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.

  8. 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
  9. 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
  10. [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
  11. 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
  12. 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
  13. 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
  14. satotake
    Link
    bpython is great if you are pythonista

    bpython is great if you are pythonista

    3 votes
  15. 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
  16. 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
  17. [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
  18. [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.

  19. Loire
    Link
    Hoo-wee tildes is *nix heavy. Is this the wrong place to ask if there are any Powershell users amongst us, how it compares as a shell and what utilities/applications these Microsoft Unicorns may...

    Hoo-wee tildes is *nix heavy.

    Is this the wrong place to ask if there are any Powershell users amongst us, how it compares as a shell and what utilities/applications these Microsoft Unicorns may prefer?

    2 votes
  20. 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).