14 votes

What are some common terminal aka CLI workflows?

So, earlier today i read about Bagels (https://github.com/EnhancedJax/Bagels), which describes itself as "Powerful expense tracker that lives in your terminal". Not only is it really cool looking, but seems quite useful! I'm really loving the increased TUI-centric command line apps that are becoming more popular; well, it seems like they've become more popular, but i admit to not having any hard data/stats to back up my impression. However...As much as i love the command line/terminal/CLI....my daily workflows simply do not necessitate being in/using the terminal. (I only need such terminal apps on a rare basis, or i simply use old school unix/linux cli tools.) I mean, especially while on my mobile, there's not that much that i need to do from the command line. (Yes, i know there are mobile app terminal emulators, i'm simply saying that i have very little use for my daily needs.)

So, besides the expense tracking that Bagel cites, I'm very curious to learn what other common, daily sorts of use-cases and workflows do people here have that could benefit from leveraging terminal/command line apps? Please share!

17 comments

  1. [2]
    streblo
    Link
    I don't think I would seek out a terminal UI without context. Like you say, in a mobile environment for instance it doesn't make any sense at all. I do have a terminal emulator on my phone, but I...

    I don't think I would seek out a terminal UI without context. Like you say, in a mobile environment for instance it doesn't make any sense at all. I do have a terminal emulator on my phone, but I use it to phone into my network and reboot something occasionally.

    Where TUIs make sense is a) if you're already working out of a terminal i.e. you're a developer or b) your workflow is already very keyboard-centric and using something that is designed with a keyboard input only makes sense. Occasionally there is another scenario c) where the TUI is actually the best format for interacting with a medium. For example, before the reddit API fiasco, the non-affiliated TUI client was a lot better than even the original web interface because there were no ads and you didn't have any of the non-textual fluff to distract you.

    14 votes
    1. sleepydave
      Link Parent
      This. CLI/TUIs make sense for sysadmins, not for consumer use. CLIs allow for scripting automation and one-line system changes, and TUIs provide an abstraction over CLIs that add a usability...

      This. CLI/TUIs make sense for sysadmins, not for consumer use. CLIs allow for scripting automation and one-line system changes, and TUIs provide an abstraction over CLIs that add a usability factor for more sweeping system modifications that would require complex commands. These interfaces were designed from the ground up with the needs of administrators and developers in mind and don't make much sense for people outside that domain. That said, I never want to discourage anyone from spending time and effort to develop their knowledge on how their computer works on a lower level of abstraction, and using a terminal regularly can help accomplish that.

      6 votes
  2. [2]
    stu2b50
    Link
    CLIs have pros and cons. The biggest con IMO is their lack of discovery. Once you forget an obscure ffmpeg flag, it's gone, and it's hard to remember without digging through the manpage again, and...

    CLIs have pros and cons. The biggest con IMO is their lack of discovery. Once you forget an obscure ffmpeg flag, it's gone, and it's hard to remember without digging through the manpage again, and no one likes that. The excellence of GUIs is that they can have those semi-obscure features which you can discover easily.

    So for a CLI program, you would want it to be something that a) either you interact with every day, so you won't have the chance to forget or b) something you never have to interact with (e.g a piece of an pipeline or script) directly.

    Advantages for CLI include novelty (there often is only CLI programs for obscure tasks, because they're easy to make), ease to fit into data pipelines/automation, and sometimes power (again, since it's easy to make, so they can be more cutting edge/expose more powerful features with burdening developers with UI work).

    As an example of the former, git. Unfortunately, I do have to use git every day, so I do remember all the things I need to do with it. As an example of the later, youtube-dlp, which I never call directly, but have some scripts which use it.

    8 votes
    1. mxuribe
      Link Parent
      Yep, discovery is often an issue with the terminal and TUIs. This is one reason I'm trying to see what and how others use the terminal - beyond the obvious administering a machine, etc.

      Yep, discovery is often an issue with the terminal and TUIs. This is one reason I'm trying to see what and how others use the terminal - beyond the obvious administering a machine, etc.

  3. Johz
    Link
    I write software developer for a living, and I think it's really important for software developers to be comfortable with the command line as a tool. I even use a TUI based editor as my primary...

    I write software developer for a living, and I think it's really important for software developers to be comfortable with the command line as a tool. I even use a TUI based editor as my primary IDE (Helix). Getting familiar with this stuff (and finding the right tools that make command line work more enjoyable) is a great tool to have in your toolbelt.

    In my experience the main use cases for the command line are:

    • You can easily run lots of one-off commands/applications from a single, relatively universal interface. I have a shortcut that brings up a terminal, and it immediately gives me direct access to a lot of tools that I use daily. For example, if I want to play around with some HTTP API, I can use HTTPie to fire off a quick request — I press F12, type http httpbin.org/get, and I immediately see what's going on. That's a lot quicker than opening up Postman (or whatever the latest equivalent is), waiting for it to load, clicking around to fill in the fields, etc. For a lot of simple tasks like "run the script that automatically checks my code works" or "update my timesheet so I know what I worked on today", doing this in the command line is the easiest approach.
    • Your commands become easily repeatable and scriptable. Every time I run a command, it's saved in my shell history, which means later I can go back and run that exact same command again. If I want to share a particular command with my colleagues, I can copy the command as a string and send it to them, and they can do the exact same thing that I did. That's not as easy with a GUI app, where you need to tell them "click button X, then button Y, then scroll to section Z".
    • You can combine data from different sources very easily. Being able to pull data from a source, then pull out only the interesting bits of that data with a tool like jq makes a lot of data analysis questions surprisingly easy. Combining that with a tool like xargs to run another command that uses that data means that I do some really quite powerful things.

    That said, I'm also quite sceptical of the value of the command line outside of these bounds. Like I said, I use a TUI text editor as one of my main tools at work, but this is very much despite it being a TUI, rather than because of it. The terminal isn't great at drawing complex UIs — you don't have a lot of room for detail, and subtle designer tricks like changing font size to guide your eyes properly often just aren't possible. Moreover, you've often got several layers interacting at once to make something work — your OS, your terminal emulator, potentially a multiplexer, and then your TUI application itself — which means that keystrokes and shortcuts are often more complicated to manage. In general, if I'm going to be working with a single tool for longer than about a minute, I'd rather it being a proper GUI than a terminal tool.

    8 votes
  4. [2]
    overbyte
    Link
    If your main text editor is vim or emacs then I'd say you're practically living in the terminal already. I'm pretty much in "mouse-optional" mode unless I have to use a GUI for the task. I find it...

    If your main text editor is vim or emacs then I'd say you're practically living in the terminal already. I'm pretty much in "mouse-optional" mode unless I have to use a GUI for the task. I find it just outright faster and more consistent copy/pasting a single line of text instead of following screenshots to click things.

    Before I found Todoist I managed a to-do list on a command line. Was nice and simple, but Todoist's features like parsing dates and times is just too convenient to pass up.

    And if you code regardless of hobby or work, source code management is practically a CLI workflow with endless attempts to put a GUI on top of it. With GitHub, you can monitor workflow runs and review/approve pull requests completely from the CLI.

    Another is mass renaming files and moving around my home directory in general. I have full PDF copies of payslips, receipts and heaps of travel photos that get downloaded with nonsensical filenames, this helps keep everything nice and tidy. Then setup recurring encrypted backups for all of these with rsync and borg.

    Working with that many small files around necessitated learning to move more efficiently around the filesystem with commands like pushd, popd and cd -. They're a big level up in how it sped up my workflow in return for just a few minutes of effort reading how to use those commands beyond the standard cd.

    My more occasional CLI uses:

    • transcoding batches of video by piping youtube-dl to ffmpeg
    • compiling that one program a hobbyist put the source code on Github that solves my exact problem at that particular time
    • curl and jq for talking in API. If you have a Slack webhook for example, you can get notifications from whatever thing you want that can reach that webhook. Transcoding a big batch of video, your daily backup jobs, you name it.
    • using ansible to get a repeatable install of my Linux machines or as close I can get to. Those little tweaks you do to your computer over time from random searches to fix some specific thing? Yeah put that in a playbook as well. Back when Windows still needed them I had a folder full of registry tweaks to apply on a fresh install which provided the same thing.
    5 votes
    1. mxuribe
      Link Parent
      Yep, agreed! Also, thanks for sharing some of your use-cases (curling, compiling, transcoding). These make sense from a terminal perspective! :-)

      If your main text editor is vim or emacs then I'd say you're practically living in the terminal already.

      Yep, agreed! Also, thanks for sharing some of your use-cases (curling, compiling, transcoding). These make sense from a terminal perspective! :-)

  5. [2]
    crdpa
    (edited )
    Link
    I'm very keyboard centric and a heavy terminal user. Been like this for years since I started using Linux in 1999/2000 with Slackware and Mandrake. I love terminal and TUI apps, but there are...

    I'm very keyboard centric and a heavy terminal user. Been like this for years since I started using Linux in 1999/2000 with Slackware and Mandrake.

    I love terminal and TUI apps, but there are downsides. When you get used to a TUI APP, it's really hard to use another one. It's very specific in how it works, how you navigate inside, shortcuts, etc. You end up with a lot of specific muscle memory that's applicable to one software only.

    I use helix as my main editor and cmus as a music player and fortunately both have vim centric navigation so I easily navigate both and my window manager without even thinking, but if cmus dies I will have a hard time adjusting to another.

    I'm slowly moving away from this and using KDE Plasma + GUI software because discoverability is way easier in a GUI app.

    I think that when TUI starts to get rather complex, it's not really that good.

    You start being tied to your specific configs and dotfiles and dread losing it. Now you have a git repo just to configure your computer.

    That said, I recommend cmus as a music player. Fast, easy and it is around since the dawn of times and still being developed.

    5 votes
    1. tauon
      Link Parent
      Actually, I’d view this as an advantage. Push the repo to your/a server’s remote destination and never dread losing your config again. There are even programs that alleviate setting such a repo...

      Now you have a git repo just to configure your computer.

      Actually, I’d view this as an advantage. Push the repo to your/a server’s remote destination and never dread losing your config again.

      There are even programs that alleviate setting such a repo up. Example, example 2 (both links are Tildes comments about the same software, actually)

      2 votes
  6. bme
    Link
    Spotifyd + spt for Spotify.

    Spotifyd + spt for Spotify.

    3 votes
  7. [2]
    DataWraith
    Link
    Other than for developing software (also using the Helix editor), my main use for terminal workflows is personal knowledge management. Taskwarrior manages my ToDo list. I have setup various...

    Other than for developing software (also using the Helix editor), my main use for terminal workflows is personal knowledge management.

    • Taskwarrior manages my ToDo list. I have setup various shortcuts and little scripts to slice and dice my current task list by project, priority or context. It's a very flexible tool, and I like to call it from my shell startup file so I see the most urgent tasks every time I open a new terminal window.

    • zk makes for a nice personal wiki. Here, too, I have a few scripts that help me manage things. There's one that creates a daily journal note and links it to the notes from the previous day/week/month/year (though I haven't been using it for a year yet...) so I can hold myself accountable for what I did or did not get done in that timespan.

      I'm also experimenting with storing some of my bookmarks as notes inside zk: a small script uses Jina Reader to turn a given webpage into markdown, so that I can both annotate and full-text search it if the need arises.

    • One interesting thing I've started using a short while ago is Recutils. It's a plaintext format for small-to-medium databases that can be queried from the command-line. It is much easier to work with than CSV files, because each column entry goes on its own line so there's mostly no need to escape special characters.

    3 votes
    1. mxuribe
      Link Parent
      I used to use the terminal for journaling some time ago (I just use text files for journaling, so its easy to adopt many worklfows). But, for some reason (that i can not recall), i got better at...

      I used to use the terminal for journaling some time ago (I just use text files for journaling, so its easy to adopt many worklfows). But, for some reason (that i can not recall), i got better at keyboard navigation from the GUI file manager to open text files with my favorite text editor (Kate)...and then just got used to the non-terminal flow. But, yeah, i can agree that text file editing, personal knowledge management via terminakl makes sense - more so if one is often in a terminal screen too.
      Interesting to learn that you have started to use Recutils! i had heard of it several years ago, but couldn't find a good enough use case for myself, though i think its quite intriguing. For the vast majority of the time if i need to do heavy duty stuff with a csv, i'm, reaching for ;libreoffice. However if i need to do very minor stuff, i mostly reach for my text editor...However maybe twice or three times i used somethign called visidata (a python terminalk app for working with sprreadsheets and other tabular sorts of data), which was really awesome. I have heard its the kind of thing that if you get good at it, the productivity shooots through the roof....but i assume that person probably is in CSVs like most of their work day, etc. Anyway, thanks again for sharing! :-)

  8. [3]
    SlapShot
    Link
    I'm a software engineer in the data space which means spending a significant portion of time digging into raw file formats such as CSV, JSON, etc. Visidata has been a blessing. Visidata Also, less...

    I'm a software engineer in the data space which means spending a significant portion of time digging into raw file formats such as CSV, JSON, etc. Visidata has been a blessing.

    VisiData is an interactive multitool for tabular data. It combines the clarity of a spreadsheet, the efficiency of the terminal, and the power of Python, into a lightweight utility which can handle millions of rows with ease.

    Visidata

    Also, less of a CLI tool, but I've been using DuckdDB a lot lately to dig into different file formats as it's easy to read differing formats into tables, compare files, then write to a third file or modify an existing one. All easily accomplished in a few lines.

    DuckDB

    2 votes
    1. mxuribe
      Link Parent
      That's a good endorsement for visidata, since my exposure had been quite limited. Thanks for validating that it is indeed worth using! :-) Also, your mention of duckdb is like the several dozenth...

      That's a good endorsement for visidata, since my exposure had been quite limited. Thanks for validating that it is indeed worth using! :-)
      Also, your mention of duckdb is like the several dozenth time over the last week that it has come up! So, clearly the online gods want me to dive into it for some reason! lol Long ago, i thought when i first heard of it i recall it sort of like a sqlite alternative...but maybe my recollection si incorrect....Well, with this many signals shone my way, i guess i shoui,d look into it and see what all the fuss is all about. :-)
      Thanks for sharing btw!

      1 vote
    2. Weldawadyathink
      Link Parent
      Duckdb is super powerful. A few months ago when the ssn leak was released, I wanted to do some basic data analysis on it. Simple things like search for my family members, find the number on unique...

      Duckdb is super powerful. A few months ago when the ssn leak was released, I wanted to do some basic data analysis on it. Simple things like search for my family members, find the number on unique ssns, quantity by state, etc. I never successfully got it imported into SQLite. It took a handful of hours to import into Postgres. Building an index on Postgres took about 14 hours on an M3 max, one of the best single core cpus you can buy. Without an index, querying for a single ssn took about 20 minutes. But then I tried with Duckdb. Importing took half the time as Postgres, and I didn’t need to build any indexes. The data was compressed about 50% at rest (Postgres does zero compression). A query for a single ssn is instantaneous. A more complex query, like unique ssn, group by state, order by quantity, was less than a few seconds. Absolutely fantastic tool.

      1 vote
  9. [2]
    spicyq
    Link
    I feel like CLIs and TUIs need to be talked about more separately. I use cli tools a lot and they are extremely good for complex tasks, but I don't use many TUI tools and would never explicitly...

    I feel like CLIs and TUIs need to be talked about more separately. I use cli tools a lot and they are extremely good for complex tasks, but I don't use many TUI tools and would never explicitly seek out a tool because of it being a TUI. It seems like there has been a resurgence of TUI apps and like you I am curious as to what the appeal is.

    1. unkz
      Link Parent
      A TUI combined with tmux and a server in the cloud often makes for a powerful combination. I have many long running things out there that I can ssh in to look at from anywhere, then I just detach...

      A TUI combined with tmux and a server in the cloud often makes for a powerful combination. I have many long running things out there that I can ssh in to look at from anywhere, then I just detach and let them go about their business.