Ilia Frenkel

Anything is possible, it's only a matter of time


Obsolete and outdated Linux utilities and their alternatives

By

on

in

and tagged as

We use some Linux commands daily without realising that they are no longer maintained and have arguably better, more modern alternatives. Below I list some of them along with the potential replacement.

I do not intend to create a comprehensive user manual for all the commands mentioned here. I will provide simple examples and links to more in-depth reviews. As always, man is your best friend.

In this post:

  1. ifconfig
  2. netstat
  3. nslookup
  4. scp

Whenever you want to check your IP address or who is listening on a particular port, you probably use ifconfig or netstat commands. These commands are from the net-tools package. While the package is still somewhat maintained, it is generally considered obsolete. The maintainers of net-tools discussed its future nearly 15 years ago in the mailing list and decided to switch to iproute2.

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.

Wikipedia

1. ifconfig

I was using ifconfig for decades. To find out my local ip address or to bring an interface up or down. Nowadays you’ll be better of using the ip command from the iproute2 package. It can do everything ifconfig and much more. The ip can also replace the route command: ip route list.

I have been using ifconfig for decades. To find out my local IP address or to bring an interface up or down. Nowadays, you’ll be better off using the ip command from the iproute2 package. It can do everything ifconfig can and much more. The ip can also replace the route command: ip route list.

~ $ ifconfig
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
		inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
		ether 02:42:02:f4:c9:31  txqueuelen 0  (Ethernet)
		RX packets 0  bytes 0 (0.0 B)
		RX errors 0  dropped 0  overruns 0  frame 0
		TX packets 0  bytes 0 (0.0 B)
		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
		inet 127.0.0.1  netmask 255.0.0.0
		inet6 ::1  prefixlen 128  scopeid 0x10<host>
		loop  txqueuelen 1000  (Local Loopback)
		RX packets 83  bytes 7958 (7.7 KiB)
		RX errors 0  dropped 0  overruns 0  frame 0
		TX packets 83  bytes 7958 (7.7 KiB)
		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
		inet 192.168.176.167  netmask 255.255.255.0  broadcast 192.168.176.255
		inet6 fe80::ef1a:6685:7930:480  prefixlen 64  scopeid 0x20<link>
		ether 70:56:81:a0:39:91  txqueuelen 1000  (Ethernet)
		RX packets 905  bytes 141076 (137.7 KiB)
		RX errors 0  dropped 0  overruns 0  frame 103288
		TX packets 203  bytes 21130 (20.6 KiB)
		TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
		device interrupt 17

~ $ ip -s addr
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 127.0.0.1/8 scope host lo
	   valid_lft forever preferred_lft forever
	inet6 ::1/128 scope host noprefixroute 
	   valid_lft forever preferred_lft forever
	RX:  bytes packets errors dropped  missed   mcast           
		  8104      84      0       0       0       0 
	TX:  bytes packets errors dropped carrier collsns           
		  8104      84      0       0       0       0 
2: wlp2s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
	link/ether 70:56:81:a0:39:91 brd ff:ff:ff:ff:ff:ff
	inet 192.168.176.167/24 brd 192.168.176.255 scope global dynamic noprefixroute wlp2s0
	   valid_lft 42653sec preferred_lft 42653sec
	inet6 fe80::ef1a:6685:7930:480/64 scope link noprefixroute 
	   valid_lft forever preferred_lft forever
	RX:  bytes packets errors dropped  missed   mcast           
		182455    1196      0       0       0       0 
	TX:  bytes packets errors dropped carrier collsns           
		 24040     241      0       0       0       0 
3: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default 
	link/ether 02:42:02:f4:c9:31 brd ff:ff:ff:ff:ff:ff
	inet 172.17.0.1/16 brd 172.17.255.255 scope global docker0
	   valid_lft forever preferred_lft forever
	RX:  bytes packets errors dropped  missed   mcast           
			 0       0      0       0       0       0 
	TX:  bytes packets errors dropped carrier collsns           
			 0       0      0       0       0       0 

There is an excellent introduction to the ip command from Linode once you get past the “create a compute instance” advice.

2. netstat

The netstat command is a multi-tool for interrogating your network connections and statistics. But the newer ss tool is here to replace it. The developer of the ss command made it very easy for us to switch by making sure that most (if not all) of the netstat options have the same effect.

~ $ netstat -lnt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State
tcp        0      0 127.0.0.1:631           0.0.0.0:*               LISTEN
tcp        0      0 127.0.0.1:42257         0.0.0.0:*               LISTEN
tcp6       0      0 ::1:631                 :::*                    LISTEN
~ $ ss -lnt
State   Recv-Q  Send-Q     Local Address:Port      Peer Address:Port  Process
LISTEN  0       4096           127.0.0.1:631            0.0.0.0:*
LISTEN  0       4096           127.0.0.1:42257          0.0.0.0:*
LISTEN  0       4096               [::1]:631               [::]:*

A few good examples of how to use ss can be found here.

3. nslookup

This utility is (was) the best way to get the IP addresses of a server:

~$ nslookup google.com
Server:         127.0.0.53
Address:        127.0.0.53#53

Non-authoritative answer:
Name:   google.com
Address: 142.250.66.238
Name:   google.com
Address: 2404:6800:4006:810::200e

The alternative, dig can do the same:

~$ dig google.com

; <<>> DiG 9.18.12-0ubuntu0.22.04.2-Ubuntu <<>> google.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 39968
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 1

;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 65494
;; QUESTION SECTION:
;google.com.                    IN      A

;; ANSWER SECTION:
google.com.             34      IN      A       142.250.66.238

;; Query time: 0 msec
;; SERVER: 127.0.0.53#53(127.0.0.53) (UDP)
;; WHEN: Mon Jul 24 04:49:05 UTC 2023
;; MSG SIZE  rcvd: 55

The dig can do more things, such as domain zone transfers, but it can’t do interactive mode like nslookup can. Technically, nslookup is not obsolete:

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.

Wikipedia

You can still use both. In my mind, the advantage of dig is that it uses operating system resolvers while nslookup doesn’t. This makes it easier to investigate any problems on a box. It did happen to me a few times that nslookup worked fine but dig didn’t due to misconfiguration.

The awesome nixCraft created a very good guide on how to use dig.

4. scp

This is an interesting one. SCP is both the name of the protocol and the name of the command line utility. The SCP protocol is considered outdated, but some distributions created a new version of scp that uses SFTP protocol instead.

It is a general consensus, though, to avoid scp and use rsync instead. The scp always does a full copy, while rsync can do it incrementally. As a result, rsyn is much faster. It is also much more flexible, allowing complex filters, daemon mode, and resuming interrupted uploads, among other things. The rule of thumb is if you need to copy a few files, you can still use scp, just make sure it is the one that uses SFTP. If you need to run complex backups on a regular schedule or something similar, use rsync. If you ask me, always use rsyn to avoid confusion. Just make sure you use it over SSH.

~$ scp backup.tar.gz iliaf@192.168.1.2:/iliaf/home/backups
~$ rsync -avzh backup.tar.gz iliaf@192.168.1.2:/iliaf/home/backups

There is a comprehensive guide from LinuxHandbook on how to use rsync.

That is all for now.

A programmer sitting in front of a blue monitor with a mug.

Last update on


One response to “Obsolete and outdated Linux utilities and their alternatives”

  1. I’ll immediately seize your rss as I can’t to find your email subscription hyperlink or newsletter service.
    Do you’ve any? Please let me recognise so that I may subscribe.
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *