Files
second-brain/Clippings/Some Obsolete Commands in GNULinux and the Tools You Should Use Instead.md

7.3 KiB
Raw Permalink Blame History

title, source, author, published, created, description, tags
title source author published created description tags
Some Obsolete Commands in GNU/Linux and the Tools You Should Use Instead https://medium.com/nerd-for-tech/some-obsolete-commands-in-gnu-linux-and-the-tools-you-should-use-instead-df64c42ee9ad
Talha Khaild
2024-08-23 2024-10-29 In software development, things change at an incredible speed due to improvements in hardware and environments. For the same reason, tools change. Sometimes old ones dont adapt well to changes, so…
clippings

[

Talha Khaild

](https://medium.com/@talhakhalid101?source=post_page---byline--df64c42ee9ad--------------------------------)

[

Nerd For Tech

](https://medium.com/nerd-for-tech?source=post_page---byline--df64c42ee9ad--------------------------------)

In software development, things change at an incredible speed due to improvements in hardware and environments. For the same reason, tools change. Sometimes old ones dont adapt well to changes, so they end up fading away and being replaced by other utilities (with the arguable point being that new tools are better than old ones and if the old one works, dont touch it).

Below are a handful of older tools you may still be using, some you should use instead, and why you should switch to these improved alternatives that provide the same or updated functionality, thus being well maintained.

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.

Part of the Unix philosophy, and one that identifies many programs. Among them the venerable grep command. I can sum it up as: “write a program that does one thing, but does it well and is universal.”

Also Check:

egrep and fgrep

The egrep (extended grep) tool uses regular expressions to match a line. However, egrep has been deprecated in favor of using regular grep with the grep -E flag. For example:

$ egrep '^[fj]' /etc/passwdftp:x:14:50:User FTP:/var/ftp:/sbin/nologinuser:x:1000:1000:user:/home/user:/bin/bash
$ grep -E '^[fj]' /etc/passwd ftp:x:14:50:User FTP:/var/ftp:/sbin/nologin user:x:1000:3000:user:/home/user:/ bin/bash

Both examples match lines starting with the letter jof in the /etc/passwd file.

Another example of adding a new flag is fgrep. The grep command, uses a fixed string to match (no optimizations, so it is faster than a regular expression) instead of -E. It has been replaced by grep -F. Here is a comparison:

$ fgrep 'user' /etc/passwduser:x:1000:3000:user:/home/user:/usr/bin/zsh
$ grep -F 'user' /etc/passwduser:x:1000:3000:user:/home/user:/usr/bin/zsh

As you can see, it makes more sense to use flags to make a tool provide similar behavior. You just need to know that grep with a flag can use regular expressions or perform an exact search.

nslookup: He lives, but….

Surely you have ever tried to get the IP address of a server like this:

$ nslookup domain_urlServer: 192.168.0.1Address: 192.168.0.1
Non-authoritative answer:Name: domain_urlAddress: 50.63.7.206

An alternative to nslookup is dig. Here is an example similar to the above:

$ dig @192.168.1.1 domain_url A +noall +answer +nocmd  domain_url. 600 IN A 50.63.7.206

Interactive mode shows how to get the pointer record (PTR) of the same server (this is a reverse lookup to get the server name by providing the IP address):

> set type=ptr> 50.63.7.206Server: 192.168.1.1Address: 192.168.1.1#53
Non-authoritative answer:206.7.63.50.in-addr.arpa name = ip-50-63-7-206.ip.secureserver.net.
Authoritative answers can be found from:

The equivalent command in dig looks like this:

$ dig -x @192.168.1.1 domain_url +noall +response +nocmd......

The dig command can do things that nslookup cannot. Such as requesting a DNS transfer of a domain zone (including all record types) to backup your domain DNS:

$ dig +short ns domain_url..........$ dig axfr domain_url @dns_server..........

However, nslookup can do things that dig cannot, such as friendly interactive mode, which is very useful when scanning DNS domains. It can also be run in non-interactive mode. There is one fundamental difference between the two utilities, dig uses the operating systems resolver libraries (the libraries that perform address lookups in DNS) and nslookup does not. Therefore, the two may behave differently when resolving addresses.

Also check:

ifconfig, netstat, route: Ip has arrived.

You can use ifconfig to get information about network interfaces and change their settings. However, it was replaced by ip . Heres how to list your network interfaces using ip:

$ ip address

Another useful tool is route. You can use,route -nto check the routing table (the information about how your machine connects to other machines):

$ route -nKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.1.1 0.0.0.0 UG 600 0 0 wls1172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wls1

But the ip command can also display the routing table. For example:

$ ip route listdefault via 192.168.1.1 dev wls1 proto static metric 600172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1 linkdown192.168.1.0/24 dev wls1 proto kernel scope link src 192.168.1.16 metric 600

Another utility that was replaced is netstat. With netstat, you can see the list of active connections, among other things. Its replacement is the commandH.H. For example:

$ ss --numeric --tcp --listenState Recv-Q Send-Q Local Address:Port Peer Address:Port Process              LISTEN 0 32 192.168.122.1:53 0.0.0.0:*LISTEN 0 4096 127.0.0.53%lo:53 0.0.0.0:*LISTEN 0 128 0.0.0.0:22 0.0.0.0:*LISTEN 0 128 127.0.0.1:631 0.0.0.0:*LISTEN 0 4096 0.0.0.0:5355 0.0.0.0:*LISTEN 0 128 [::]:22 [::]:*LISTEN 0 128 [::1]:631 [::]:*LISTEN 0 4096 *:9323 *:*LISTEN 0 4096 [::]:5355 [::]:*LISTEN 0 4096 *:9100 *:*

For all three of these cases, lack of maintenance was the downfall of these tools. Newer tools took their place, many distros have deprecated the use of ifconfig and route in favor of the software package.iproute2, such as ArchLinux or RHEL since version 7. This tool includes support for all common ifconfig, route, arp, and netstat functions. It also includes support for multicast configuration, virtual link and tunnel management, traffic control, and low-level IPsec configuration, among other features.

Also Check:

Conclusion

Its a good idea to keep up with the latest tools, as developers fix bugs and add useful features that may not have been present in older versions. Its all about being more productive. Old software tends not to get bug fixes. If left unattended, some of them could compromise the system. Anyway, keep up to date with the information you have about your favorite applications, and if you like one in particular, support it, pamper it, love it, and dont forget to donate, you help the developer survive. Until another post, reader. Good vibes.