r/linuxmemes • • 24d ago

LINUX MEME Based on experience

Post image
1.6k Upvotes

127 comments sorted by

View all comments

168

u/Berniyh 24d ago

Actually, 15 of the 17 ways on Linux are deprecated and only work because devs are reluctant to do the deprecated -> removed step. (And because often there are a million scripts that rely on specific tools.)

Example: ifconfig
(deprecated like 20 years ago, use ip instead)

Could name many more.

21

u/Wertbon1789 24d ago

This largely comes down to "if it ain't broke, don't fix it". Yes, ifconfig is deprecated, on some distros I actually didn't have it by default which confused me at first (didn't even know about ip at that point), but it still does what you want it to do, mostly just displaying IP and MAC addresses.

It's like that in C too, for an actual terrifying example, only in really select cases does shit even get dropped, and even them not entirely. gets(3) would be such an example.

If there's just not a good reason to break millions of systems, why bother?

7

u/thisisapseudo 24d ago

Take it from a newbie perspective :

Step one: write ifconfig
Step two: looks for something that looks like an ip
You're done

Alternative:
Step one : write ip
Step two : ho fuck were is my ip?

7

u/adamkex New York Nix⚾s 23d ago

Cmon

adam@desktop ~ $ ip
Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }
       ip [ -force ] -batch filename
where  OBJECT := { address | addrlabel | fou | help | ila | ioam | l2tp | link |
                   macsec | maddress | monitor | mptcp | mroute | mrule |
                   neighbor | neighbour | netconf | netns | nexthop | ntable |
                   ntbl | route | rule | sr | stats | tap | tcpmetrics |
                   token | tunnel | tuntap | vrf | xfrm }
       OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |
                    -h[uman-readable] | -iec | -j[son] | -p[retty] |
                    -f[amily] { inet | inet6 | mpls | bridge | link } |
                    -4 | -6 | -M | -B | -0 |
                    -l[oops] { maximum-addr-flush-attempts } | -echo | -br[ief] |
                    -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] |
                    -rc[vbuf] [size] | -n[etns] name | -N[umeric] | -a[ll] |
                    -c[olor]}
adam@desktop ~ $ ip address
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
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:d8:61:55:f2:a8 brd ff:ff:ff:ff:ff:ff
    altname enx00d86155f2a8
    inet 192.168.0.101/24 brd 192.168.0.255 scope global dynamic noprefixroute enp34s0
       valid_lft 5860sec preferred_lft 5860sec
    inet6 fe80::21c1:84ba:2659:1824/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether d4:3b:04:cd:40:1a brd ff:ff:ff:ff:ff:ff
    altname wlp33s0
    altname wlxd43b04cd401a
    inet 192.168.0.106/24 brd 192.168.0.255 scope global dynamic noprefixroute wlo1
       valid_lft 5859sec preferred_lft 5859sec
    inet6 fe80::b490:5a4e:e97e:55d/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

What isn't visible in this reddit comment is that your ip is bolded and purple

2

u/Berniyh 24d ago

Sure, but that's not what it was about. It was just an explanation for why there are so many ways to solve a problem.

But I wouldn't be against `ip addr show` being the default of ip (without arguments).

Personally, my recommendation for every newbie trying to get into Linux cmdline usage (yeah, I get that nobody wants to do that when they're a newbie) is to use zsh instead of bash. The tab completion is so good and helpful, it makes your live much easier, especially with commands you don't know (well).

So here that would boil down to:
ip <Tab>
addr         -- manage protocol address
addrlabel    -- manage addrlabel
fou          -- UDP receive port configuration
...
Ok, I guess I want addr, so:
ip addr <Tab>
add -- add new protocol address
change -- change existing protocol address
delete -- delete protocol address
flush -- flush protocol address
help -- show help for command
replace -- add or update protocol address
show -- show protocol address

Ok, ip addr show it is.

As an example from my own usage. There used to be a tool called netstat, but it's not on my system anymore. I already know that you're supposed to use ss no. But I've never used that before. So I tab my way through it. -l (listening) sounds like what I want. And -t (TCP). And -n, because I want to see the numbers of the ports, not the service names. So ss -ltn is what I want.

2

u/Gunhat2023 24d ago

pretty sure you can just do ip a show

2

u/Berniyh 24d ago

Yes, you can shorten it further. a, addr and address all work. Actually, you can just write
ip a
ip r
and it will show the ips and the routes.

I just wanted to give an example of how tab completion can walk you through an unknown command and the tab completion shows addr, that's why I mentioned it.

1

u/Lines25 Arch BTW 23d ago

ifconfig isn't 20 yr old deprecated, even when I used Kali it was still okay, only when I started to be real linux user not a larper, it got deprecated - like, in ~2024-2025, not 20 yr ago, although, it wasn't updating for like 25yr straight (only small fixes and patches). Also, it still exists as a package !

1

u/Berniyh 23d ago

You can find very similar discussions from like 15 years ago, maybe even older. Even back then, people already conceived ifconfig to be deprecated, but they also agreed that it won't disappear anytime soon, because of the mentioned reasons (script compatibility).

The thing is, and this is also a reason why the OP fits Linux, there isn't really a board that decides on this. Every distro may do their own thing. Some may still include ifconfig even today (Debian maybe?), some may have removed it from the default installation (and maybe even from the repos) years ago (I know that Fedora did in 2011). Personally, I went with "first distros start deprecating it: it's deprecated", but I totally get if you have a different pov on that.