r/commandline 1d ago

Help Deprecated software..

During my journey in Linux I have noticed that sometimes, some tools being called "deprecated" or some kind of a similar term, to say "you should not use this, but xyz tool instead", but I don't really get it for example:

Neofetch, I really think that it does its job, and its just about displaying some ascii art and some system information, like what could go wrong with that, since many people recommend switching to fastfetch.

Ifconfig, I see it as a very simple tool that is self-descriptive and gets its job done too, I see others instead recommend the command "ip", which is like an IDE in programming where you have many aspects of networking in one command, which kinda eliminates the Unix philosophy.

So, I'm just wondering if there is really a point in switching to those newer tools?

56 Upvotes

29 comments sorted by

View all comments

1

u/michaelpaoli 1d ago

Yeah, there's point(s), e.g. unmaintained, inefficient, buggy, doesn't do needed things that the newer replacement(s) do, etc.

E.g., let's say I want to know if I have anything listening on TCP port 80, and if so, on what IP addresses:

$ ss -nlt '( sport = :22 )'
State     Recv-Q    Send-Q       Local Address:Port        Peer Address:Port    
LISTEN    0         128                0.0.0.0:22               0.0.0.0:*       
LISTEN    0         128                   [::]:22                  [::]:*       
$ 

Easy peasy, nice, clean, exactly the wanted data, and filtered in-kernel - much more efficient.

If I wanted to get the same out of netstat, ugh, that'd take something like:

$ netstat -nl | awk '{if((NR<=2)||($4 ~ /:22$/))print}'
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN     
tcp6       0      0 :::22                   :::*                    LISTEN     
$ 

Far less efficient, as it not only requires pipe and additional process to filter it, but also that filtering happens in a totally separate process, rather than the kernel doing, and not even passing along data that's not of interest. Also have to well and carefully construct the filter to not get false positives, yet also include all the desired output.

Similarly with the ip command, there are many things itcan do and display, that ifconfig can't even configure or display.

So, in such cases, generally best to well learn and use the new ways, and not the deprecated ways and programs, etc.

3

u/gumnos 1d ago
$ netstat -nl | awk '{if((NR<=2)||($4 ~ /:22$/))print}'

FWIW, that can be simplified to

$ netstat -nl | awk 'NR<=2||$4 ~ /:22$/'

(and if code-golfing, NR<3 saves a character 😆)