Linux commands: Drop these old utilities for modern alternatives

These traditional Linux utilities have been revitalized with modern replacements.
15 readers like this.
Command line prompt

Opensource.com

Linux has a good track record for software support. There are about 60 commands in man section 1 of Unix 1st edition, and the majority still work today. Still, progress stops for no one. Thanks to vast global participation in open source, new commands are frequently developed. Sometimes a new command gains popularity, usually because it offers new features, or the same features but with consistent maintenance. Here are ten old commands that have recently been reinvented.

1. Replace man with cheat or tealdeer

The man page is functional, and it works well for what it does. However, man pages aren't always the most succinct at demonstrating how to use the command you're trying to reference. If you're looking for something a little more to the point, try cheat or tealdeer.

2. Replace ifconfig with ip

The ifconfig command provides information about your network interfaces, whether they're physical or virtual.

$ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
  inet 10.1.2.34  netmask 255.255.255.0  broadcast 10.0.1.255
  inet6 fe80::f452:f8e1:7f05:7514  prefixlen 64
  ether d8:5e:d3:2d:d5:68  txqueuelen 1000  (Ethernet)
  [...]

tun0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST>  mtu 1360
  inet 10.2.3.45  netmask 255.255.254.0  destination 10.2.14.15
  inet6 2620:52:4:1109::100e  prefixlen 64  scopeid 0x0<global>
  unspec 00-00-00-00-00-00-00-00-[...]0-00  txqueuelen 500  (UNSPEC)
  [...]

The newer ip command provides similar information:

$ ip -4 address
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    inet 10.1.2.34/24 brd 10.0.1.255 scope global noprefixroute eth0
4: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
5: tun0: <POINTOPOINT,MULTICAST,NOARP,UP,LOWER_UP> mtu 1360 qdisc pfifo_fast state UNKNOWN group default qlen 500
    inet 10.2.3.45/23 brd 10.2.15.255 scope global noprefixroute tun0

3. Replace yum with dnf and apt-get with apt

Package managers tend to be slow to change, and when they do they often work hard to maintain backward compatibility. Both the yum command and the apt-get command have had improvements lately. The changes are usually aliased or designed to work in both their old and new syntax:

$ sudo yum install foo
$ sudo dnf install foo
$ sudo apt-get install foo
$ sudo apt install foo

4. Replace repoquery with dnf

Before there was dnf there were a variety of utilities for yum to help users get reports on their packaging system configuration. Most of those extra functions got included by default with dnf. For instance, repoquery is a subcommand of dnf, and it provides a list of all installed packages:

$ sudo dnf repoquery

5. Replace pip with pip

The pip command is a package manager for Python. It hasn't been replaced, but the preferred syntax has been updated. The old command:

$ pip install yamllint

The new syntax:

$ python3 -m pip install yamllint

6. Replace ls with exa

The ls command hasn't been replaced.

Rather, it hasn't been replaced again.

The ls command was originally its own binary application, and it's still available as one. Eventually, though, the Bash shell included its own ls built-in command, which by default overrides any installed ls command.

Recently, the exa command has been developed as, depending on your preferences, a better ls. Read about it in Sudeshna Sur's exa command article, and then try it for yourself.

7. Replace du with dust or ncdu

There's nothing wrong with the du, which reports on how much disk space is used on your hard drives. It does its job well, but to be fair it's pretty minimal.

If you're looking for a little variety, try the ncdu command or the dust command.

8. Replace cat with bat

The cat command is, aside from being overused by the best of us, is a simple and direct command. It reads the contents of any number of files, and outputs it to standard input.

Its output is pretty basic, so if you're looking for something with syntax highlighting and flexible output options, try the bat command instead.

Does bat also replace the tac command? No, don't worry, for now at least tac is safe in its position as the command that outputs a file in reverse. (Unless, that is, you count sed.)

9. Replace netstat with ss

The netstat command has largely been replaced by the ss command, although of all the commands on this list it's possibly the most hotly debated. The ss command provides much of the same functionality, but as Jose Vicente Nunez points out in his six deprecated commands article, there are gaps and differences in functionality. Before switching wholesale to ss, try it and compare it with how you use netstat now.

10. Replace find with fd

I use find to located files, as an input source for GNU Parallel, and more. I'm pretty familiar with it, but I have to admit that its syntax is a little clunky. The fd command seeks to improve upon that. For instance, suppose you're looking for a file called example, but you can't remember what file extension you used. With find, the syntax might look something like this:

$ find . -name "*example*"
/home/tux/example.adoc
/home/tux/example.sh

With fd, the syntax is:

$ fd example
/home/tux/example.adoc
/home/tux/example.sh

And suppose you want to grep command to search through the results for the phrase "zombie apocalypse". Using find:

$ find . -name "*example*" -exec grep "zombie apocalypse" {} \;
zombie apocalypse

Using fd instead:

$ fd txt -x grep zombie
zombie apocalypse

Read more about it in Sudeshna Sur's fd article, and then try it for yourself.

For even more updates to classic commands, download our cheat sheet below.

Download now:
Tags
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

5 Comments

One of the big reasons to use dnf instead of yum is that dnf automatically looks for and installs all dependencies, even if you're installing some package you have saved to your drive. I also like using dnf list (you don't have to use sudo) to look for one or more packages.

There are much bigger differences than syntax between "apt" and "apt-get".

"apt" is designed for use on interactive sessions - like typing the command into a terminal. It provides good looking progress bars and other similar features. But it is bad for scripting - all that eye candy gets in the way.

"apt-get", on the other hand, eliminates much of that. The output it provides much more easily flows into log files and is therefore more useful for use within batch scripts and automation.

In Debian and Ubuntu the fd command is fdfind and can be installed with
sudo apt install fd-find

If you allow yourselves to move away from standard packages, take a look on nala (the dnf/yum for deb-based distrib) ;) https://gitlab.com/volian/nala

I would give real money for there to be a standardized protocol for package management. Then I propose we rename the current `install` command from coreutils to `ginstall`, and adopt `install` as the universal package management command. It can be symlinked to any given backend, but functionally it would work the same everywhere.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.