Alternatives to default commands | www-gem words

www-gem words

Alternatives to default commands

Published on

cli If you’re using the command line on a daily basis, you already know the power of the commands. The classic commands are great but like everything they can benefit from some modernization that offer additional benefits which improve usability for modern systems. Here is a list of the ones I use for years now but there are more options available:

╭── Used to sudo, try doas

doas is acting the same way sudo is by allowing users to perform tasks as root. It is a portable version of OpenBSD’s doas command. Its advantage is to be a minimalistic alternative to sudo and so a much smaller tool. On the other hand, sudo offers more fine-grained control.

The main advantage of doas is also its drawback: a simpler configuration file. Configuring sudo is done through the /etc/sudoers file which is so complex for the average user that you have to use visudo to to not create an improper config file and lock yourself out of your system.

Hence sudo is really needed for people who need its advanced configuration and granularity. To make it simple, if you are a single-user or running a multi-user personal machine, then doas is sufficient. doas may be limited for enterprise sysadmin who have to accommodate granular settings for a huge number of users.

If you’re ready to give doas a try then I’d recommend following the very well written Archwiki .

╭── You like your cat? Have you ever meet a bat?

As other tools in this list, bat completes the same tasks as the historical tool but with some nice additional features to make it easier to visualize your text:

  • syntax highlight: a lots of programming and markup languages are supported
  • git integration: git modifications are shown on the left side of your text
  • show non-printable characters: useful to visualize tabs, spaces, line break…
  • by default bat will pipe its output to a pager but if you prefer the default cat behavior you can use the --paging=never option

╭── You can grep. Even better you can ripgrep. But then you ripgrep-all.

ripgrepall is ripgrep with the ability to search in pdfs, e-books, office documents, archives, database, images (with OCR), videos’ subtitles…

With this list you can imagine the power of such tool and the list of options and adapters on the github page will help you getting the best out of ripgrepall. In terms of configuration, I personally love the integration with fzf and being able to define the color of matching terms and how many lines to show before and after each match. You could for example run a search through an entire directory and show the results in fzf with a nice preview in context for each file. Maybe more on that in a future post ;)

╭── 50% shorter than find: fd

This title is actually the last “advantage” listed on the fd github page .

fd comes with:

  • intuitive syntax: use fd PATTERN instead of find -iname ‘PATTERN
  • support for regular expression and glob-based patterns
  • speed due to parallelized directory traversal
  • colors to highlight different file types (same as ls)
  • support for parallel command execution
  • smart case: the search is case-insensitive by default. It switches to case-sensitive if the pattern contains an uppercase character
  • option (default) to ignore patterns from your .gitignore

fd is simpler, faster, and more user-friendly than find but is not meant to completely replace it (even though I’m personally using fd only for years now).

╭── Advanced copy and move

advcpmv is not a rewrite of a tool but a mod of the GNU cp and mv tools. While the default commands let you in the dark when copying/moving huge files/directories, advcpmv shows you:

  • a progess bar so you know where you are in the process
  • some info about the operations made (like which files have been copied and where)

advcpmv is to me what the default commands should have always been and as a consequence it replaces them on my system. You can easily do the switch by following the instructions on the project’s github page.

╭── exa: ls under steroids

exa is not only bringing colors to ls, there is the --color=auto ls option for that. exa comes with these features:

  • shows standard filesystem information but also extended attributes (inode, number of blocks, various dates and times, users, groups…). You can customize the fields to be shown
  • extend the tree built-in tool by showing files’ information and metadata alongside the hierarchy
  • view the staged and unstaged status
  • parallel queries which increase performance
  • don’t waste space on widescreen: the grid view option splits the file list among several larger columns, which will automatically resize themselves to fit all the contents in the screen
  • if you like icons, exa natively supports them

As the other tools in this list, this is just a brief summary to a powerful tool with more options to discover on the project’s github page and official website .

╭── htop has reached its zenith

zenith is mostly a graphical improvement of htop. It adds zoomable chart views (with support to scroll back in time) for CPU, memory, network, and disk usage. Other features include:

  • quick glances at disk free space, NIC IP addresses, CPU frequency
  • highlight top users of CPU, memory, and disk
  • battery percentage, time to charge or discharge, power used
  • a top-like filterable process table that includes per process disk usage
  • change process priority
  • managing processes with signals
  • performance data saved between runs
  • GPU Utilization Metrics for NVIDIA GPUs (with --features nvidia), including per-process GPU usage

╭── You’ve improved your home trash system, do the same to your computer

trash-cli is a CLI to FreeDesktop.org Trash and offers 5 commands:

  • trash-put: trash files/directories
  • trash-list: list trashed files/directories
  • trash-empty: empty the trashcan(s)
  • trash-rm: remove individual files/directories from the trashcan
  • trash-restore: restore a trashed file/directory

The main advantage over rm is to be able to store your trash and decide when you really want them to go away. This may save you from deleting a file/directory by mistake or help you recovering a file/directory because you eventually changed your mind.

If you are thinking about aliasing rm to trash-put, the project’s github page tells you that you shouldn’t because trash-cli has different semantics which will cause you problems. For example, while rm requires -R for deleting directories trash-put does not. I personally like not having to use the -R flag and I didn’t notice other “issues” so I went into rebellion and aliased rm to trash-put.


More food for thoughts? Check other posts about: #Cli


Thanks for your read. Hope it's been useful to you.


Interact with this post using Mastodon or

Comment on wwwgem's post

Copy and paste this URL into the search field of your favourite Fediverse app or the web interface of your Mastodon server.

✄ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈ ┈