We gathered 9 modern alternatives to classic Linux commands for you. There are some terminal utilities that virtually every Linux computer includes in its default installation (and in most cases even in its minimal installation). They are essential for the operation of other tools and have been with Linux since its very birth since all of them were born years before for Unix or compatible systems (such as BSD).
Alternatives to classic Linux commands
Over the years, alternatives have been emerging that improve and/or simplify their more veteran references, and many of them have already earned a place in the hearts of Linux users. Let’s take a look at some of the most outstanding ones:
Cat vs Bat
Cat’ (short for ‘concatenate’) is a command that allows us to create or merge files, or ‘print’ them to standard output (displaying them in the terminal or redirecting them to another file).
On the other hand, ‘bat’ (which is defined as ‘cat with wings’) supplements cat in all its functions, adding other useful ones such as automatic syntax highlighting for a wide number of programming and markup languages, integration with Git (highlighting modifications), automatic pagination or the option to display non-printable characters.
Cd vs Zoxide (Z)
Possibly the most used command when working with the terminal, ‘cd’ (short for “change directory”) does exactly that, allowing us to change directory (folder) to execute the relevant commands in each one.
But what if ‘cd’ kept track of the directories we use most often and used a sorting algorithm to navigate to the best match, saving us from having to type complex paths over and over again? Then the program would be called Zoxide and would use ‘z’ as the command.
Diff vs Diff-so-fancy
Diff’ (short for “difference”) allows us to visualize the differences between two files or two directories. It is one of the most used commands by developers, often in combination with Git, to know which lines of code have changed between two versions of the same program.
However, a common criticism of ‘diff’ is that it seems to be more machine-readable than human-readable, so to better recognize changes at a glance, they have released ‘diff-so-fancy‘, which dispenses with the use of symbols such as ‘+’ and ‘-‘, and relies instead on improved text highlighting.
Du vs Ncdu
‘Du’ (abbreviation of ‘disk usage’) is a command that allows showing how much disk space directories and files occupy, allowing according to the arguments that we are passing to the program to know which are the ones that occupy the most space. So, if we wanted to know the 5 ‘heaviest’ directories and show them sorted on-screen with human-readable units (MB, GB, etc) we should write something like the following:
- du -hs * | sort -nr | head
However, ‘ncdu‘ is an alternative that not only shows us directly the same information as the previous complex command but accompanies it with bar graphs… and allows us to navigate between directories to know, in turn, the ‘weight’ of each of the folders they contain. Or delete them:
Find vs Fd
Find’ means, literally, “find” in English; and that is exactly its task, to search for files on the hard disk following the criteria we provide (the name of the file or part of it, the user’s name, the file size, etc).
Fd‘ does not include as many options and modifiers as ‘find’, but it is a simpler alternative to it in most cases. So, for example, to search for any MP3 file in the current directory you would previously write
- find . -iname “*.mp3”
- …now a simple ‘fd .mp3’ would suffice.
Ls (and Tree) vs Exa
‘Ls’ is probably close to ‘cd’ in terms of frequency of use by Linux users. Its function is quite simple: list the files and folders inside a directory, the equivalent of opening it in the file explorer. Tree’ would be the equivalent of the browser’s navigation panel, showing all the subdirectories in tree format.
Well, ‘Exa‘ offers the same functions as both, but makes use of a colored output that allows to differentiate at a glance folder from files, as well as to identify permissions and owner users, and shows extra information if we visualize Git repositories, besides handling dates in standard format (and not in Anglo-Saxon).
- To replace the functions of ‘tree’, just use
- $ exa –tree
Man vs TLDR
Nowadays it is common to search Google for information on how to use any program with which we are not familiar, but at the time, in the early days of Unix, there was no Google, nor Internet, so the documentation of each program was installed along with it and was (and is) searchable using the ‘man’ command (from ‘manual’).
The problem with ‘man’ is that the first-time user who resorts to it sees how it gives him a long list with all the detailed options of the program consulted, and that is not always useful. In many cases, more than a manual, we need a manual, and that is what ‘tldr‘ offers us: summarized versions of the manuals of each command, focused on showing us practical and simple examples.
This website provides a sample of the result that ‘tldr’ would provide for each query.
Sed vs Sd
Sed’ is the abbreviation of ‘Stream Editor’, and it is a text processor in the most traditional sense of the term: the arguments we pass to the command will allow us to transform the content of one or several text files, allowing us, for example, to cut text or replace it according to certain criteria.
Sd’ is capable of doing most of the things that ‘Sed’ does, but makes them much simpler. In part, thanks to the fact that the syntax for regular expressions that it uses is the same that we can find in JavaScript, much simpler than that of ‘sed’ and ‘awk’. So, for example, two commands like:
- $ sed s/before/after/g
- $ sed ‘:a;N;$!ba;s/before/,/g’.
They are transformed into:
- $ sd before after
- $ sd: sd ‘\n’ ‘,’
Top vs Htop
‘Top’ is a command that provides a set of statistics (updated every few seconds) about the usage of our system: RAM and SWAP memory, CPU usage, and above all about the most active processes when using those resources. Htop’ is very similar, only better: colored visualization, more readable ‘layout’ of the data, use of graphs, etc.