Hacker News new | comments | show | ask | jobs | submit login

I don't think these tips are that great. Some random criticisms:

ifconfig is deprecated (use "ip" instead).

There is not much value in knowing vim if you know Emacs. If you want to edit something in your terminal, well, emacsclient -t to your Emacs session. Or use mg, which is a very fast and light Emacs workalike -- just enough for editing your /etc/apt/sources.list to get Emacs installed :)

You don't think these tip are that great for you. But they're not written for Unix command-line ninjas. They're written for average users (like me) who run Ubuntu or some other flavor of Linux and just use the basic commands. I bookmarked the tips and will definitely be revisiting them regularly to improve my command line fu.

Sorry you didn't get anything out of it, but I suspect you don't need tips like "learn vim" and "be familiar with chown".

Functionally as a sysadmin, I've heard ifconfig is deprecated before yet I've never used ip. just 'ifconfig' on the command line tells me everything I need to know about what interfaces are up, their status and basic info.

'ip' just gives me the standard syntax description.

The power of the basic shell is that there's usually a few hundred ways to skin a cat. And just because there's documentation saying something is deprecated as often as not it's still so widely used that in practice, it's not.

ifconfig is deprecated, so probably a good idea to get out of that habit. Particularly if you are using it in scripts.

'ip addr' should give you all the information that 'ifconfig' does. You can also make the output a little less chatty by doing 'ip -o -4 addr' to get IPv4 addresses on one line per interface, or 'ip -o -0 addr' to get MAC addresses displayed similarly. This can make awking / cutting for addresses to use in scripts a little more elegant.

I didn't know about the one-per-line option, so thanks for that.

Commands I use regularly instead of using ifconfig:

  # link up/down
  ip link set dev eth0 up|down

  # add a new address
  ip addr add dev eth0

  # to clear all IP addresses from eth0
  ip addr flush dev eth0

  # delete an address
  ip addr del dev eth0

  # add default route
  ip route add default via
Edit: I fail at formatting

And what is wrong with

  ifconfig eth0 up|down?
Why would I want to type more to accomplish the same task?

This is the same reason as to why I hated that Linux decided to have an ifconfig for physical interfaces, an iwconfig for wireless interfaces. It seems redundant...

> And what is wrong with > ifconfig eth0 up|down?

Nothing, as long as it's working for you (your Linux distribution probably patched some of the remaining ifconfig problems themselves). You likely won't have a problem until you want to use network features that were implemented after 2001.

Yep, I'm fully aware of ifconfig. I use "ip link" just out of habit, and, given that ifconfig is apparently deprecated, it might disappear some day.

Anyway, the point of my post was showing some basic things which can be done with ip, and how to do them.

> Edit: I fail at formatting

Really not you. It's one way this site is too minimal.

ip accepts shortened versions of it's commands e.g.

    ip a
can be used instead of

    ip addr
Even shorter than ifconfig!

ifconfig doesn't show the additional IPs on an interface unless they are bound to aliased interface names (eth0:0)

true, but that's how we've always done it where I work.

We use chroot to support multiple web apps with their own ip/domain on a single box. real simple to just add a new /etc/sysconfig/network-script/ifcfg-eth#:# with the proper network config. We can then ifup and ifdown them as necessary, they come up on boot if the config is set...

Just always made sense :)

This isn't really an argument for using ifconfig.

On RHEL and related systems, ifup, ifdown, and everything in /etc/sysconfig/network-scripts/ are all implemented with the `ip` command.

Wait, what? ifconfig is deprecated? Now I need to start typing ip on Linux , yet another variation from my BSD machines where ifconfig is definitely still in use, and Windows where I have to use ipconfig.

'ip' does a hell of a lot more than just list devices. It's really worth learning how to use it.

you also don't need root rights to use it for display - although ifconfig can be run as a regular user, it's not on the path by default so it usually won't show up.

ifconfig is on the PATH by default for FreeBSD, Mac OS X, and OpenSolaris... to me it was always rather irritating that wasn't the case in Linux when I needed to find out the IP address of a machine.

I really don't understand why there is a need to throw out a perfectly good tool to replace it with something that is completely different and requires re-learning, and re-writing of scripts that are already using ifconfig.

'ip' is also much, much less portable than ifconfig.

I think you still need to be comfortable with basic vi commands as it is _the_ standard editor in Unix. Many a times I've found myself in situations when I had to quick-edit a config file on a new bare-bones server with only vi installed.

As for the quick Emacs workalikes - they are exotic and you can't always be expected to know the packaging commands of the odd Unix system you happen to be working with. And sometimes installing new packages is not an option.

At first I thought you meant "use 'ipconfig' instead" and I was like, "Whaaaaat?!". Then I checked the man page for "ip". Thank you. It looks rather useful. I don't mess with routing or devices too much but I have in the past and only knew about ifconfig.

> ifconfig is deprecated

Deprecated by whom? Is there any source on this? Nothing is mentioned in the man page, and googling for it turns up a wikipedia article with a [citation needed], a reddit discussion from today linking to wikipedia, and this discussion.

You can also use nano, which has similar key bindings and is often installed by default, which will do in a pinch until you can install emacs.

I hate nano with passion. The key bindings makes absolutely no fscking sense and resemble nothing else. Just learn vi and emacs basics.

Personally, not a fan... but at least it's the default on Debian.

Or use mg, which is a very fast and light Emacs workalike

There's also zile, another mini-emacs (great if you run Linux on small embedded computers.) I haven't used mg yet, so I don't know how they stack up against each other.

I do have a creeping feeling I should some day bite the bullet and learn more than 4 vi commands, though.

When I want emacs to be fast & light I just do emacs -Q.

Basic vi knowledge may not be needed if you only work in Linux, but in my job I can work on Linux, AIX, Solaris, and HP-UX, and vi is the only editor that you can find on all of them in their base installs.

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact