top of page
  • Dmytro Chaurov

6 outdated Linux commands and the alternatives you should use

Replace your outdated Linux commands with modernized versions that offer comparable, if not superior, functionality.

Due to advancements in environments and hardware, software development experiences rapid change. Tools also evolve for the same reason. Older tools may not always adapt well to changes, thus they eventually become obsolete and are replaced by newer tools (with the debatable point of the new tools being better than the previous ones).

This article lists a few outdated programs that you might still be using, suggests some replacements, and explains why you should use these newer tools instead because they offer at least as much capability. Additionally, these tools are kept up well. Therefore, in no particular order, here is my list.

Instead of egrep and fgrep, use flags.

One of the best illustrations of the Unix operating system's philosophy is the venerable grep command:

Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams because that is a universal interface.

Regular expressions are used by the egrep (extended grep) utility to match a line. However, standard grep with the flag grep -E has replaced egrep as the preferred option. For instance:

$ grep -E '^[sl]' /etc/passwd

$ egrep '^[sl]' /etc/passwd

Both cases coordinate the lines that begin with the letter s or l within the /etc/passwd file.

Another example of adding a new flag is fgrep. The fixed grep command uses a fixed string for matching (no optimizations, so it is faster than a regexp) as opposed to -E. It's been replaced by grep -F. Here is a comparison:

$ fgrep 'root' /etc/passwd

$ grep -F 'root' /etc/passwd

Why were egrep and fgrep supplanted?

In order for a tool to give equivalent behavior, it makes more sense to use flags. Just be aware that grep with a flag can run an exact search or use regular expressions.

nslookup: Still alive but not well

If you've ever tried to find a server's IP address in the manner described here, raise your hand:

$ nslookup

Non-authoritative answer:

Dig is an alternative to nslookup. Here is another illustration like the one above:

$ dig +short

The interactive mode below demonstrates how to perform a reverse lookup using the IP address to obtain the pointer (PTR) record of the same server:

$ nslookup

Non-authoritative answer:    name =

Authoritative answers can be found from:      internet address =      internet address =

The equivalent command in dig looks like this:

$ dig -x +short

The dig command has capabilities beyond those of nslookup. To create a backup of your DNS domain, for instance, you can ask for a DNS transfer of a domain zone (containing all record types):

$ dig ns +short

$  dig axfr
# domain protection
; <<>> DiG 9.16.1-Ubuntu <<>> axfr
;; global options: +cmd
; Transfer failed.

Nevertheless, nslookup has capabilities that dig lacks, such as the amiable interactive mode, which is particularly helpful when investigating DNS domains. It can also be used in a passive mode.

Why was nslookup replaced?

Actually, nslookup was not replaced by dig (or host). Per Wikipedia:

nslookup was a member of the BIND name server software. Early... in the development of BIND 9, the Internet Systems Consortium planned to deprecate nslookup in favor of host and dig. This decision was reversed in 2004 with the release of BIND 9.3, and nslookup has been fully supported since then.

So it is perfectly fine to use both.

route, netstat, and ifconfig: Try ip

To learn more about network interfaces and modify their settings, use the ifconfig command. For instance:

$ ifconfig lo
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet  netmask
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 225  bytes 19746 (19.7 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 225  bytes 19746 (19.7 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

Ip, however, took the role of ifconfig. Here's how to use ip to list your network interfaces:

$ ip ad sh lo
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever

Route is another helpful tool. To view the routing table - which contains details about how your machine connects to other machines- use the command below:

$ ip route list
default via dev eth0

Netstat is another utility that was superseded. Among other things, netstat allows you to view a list of connections that are active. For instance, enter the following to get a list of TCP connections on your servers that are actively listening without name resolution:

netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name

The replacement in this instance is the command ss:

$ ss -nltp
State                      Recv-Q                      Send-Q                                           Local Address:Port                                             Peer Address:Port                      Process

What caused the deprecation of ifconfig, route, and netstat?

The failure of these tools in this instance was caused by a lack of upkeep. They were replaced by newer tools, according to Wikipedia:

Many Linux distributions have deprecated the use of ifconfig and route in favor of the software suite iproute2, such as ArchLinux or RHEL since version 7, which has been available since 1999 for Linux 2.2. iproute2 includes support for all common functions of ifconfig(8), route(8), arp(8), and netstat(1). It also includes multicast configuration support, tunnel and virtual link management, traffic control, and low-level IPsec configuration, among other features.

learnable lessons:

  • Using the most recent tools is advised because they contain bug fixes and beneficial functionality that may not be present in earlier versions. Being more productive is the key.

  • There are often no bug fixes for outdated software. Some of these could compromise your system if you leave them neglected.

  • And not all claims that a tool is obsolete are accurate! Do your homework as usual, and make sure your utilities are current.

13 views0 comments

Recent Posts

See All
bottom of page