[ Web Proxy ]
URL:
Viewing: https://www.howtogeek.com/stop-using-deprecated-linux-commands/ [Back]  [Original]

Please stop using these 7 deprecated Linux commands
Close

Please stop using these 7 deprecated Linux commands

4 [4]
A technology enthusiast, Bobby studied Computer Science at the University of Southampton before working in a number of roles across industries, from the private sector to the charitable one, at multinationals and startups. Hes helped maintain backend Java servers, designed databases and front-end interfaces, and created a bespoke content management system.

Bobby also enjoys video gaming, and has written for several outlets, including a stint as Editor-in-Chief atSwitch Player Magazineand contributions to online magazine, SUPERJUMP. Bobby uses a Mac for day-to-day work and an Android phone for distractions.
Sign in to your How-To Geek account
Add Us
Summary
Generate a summary of this story
Like
Like
Thread 14
Log in
Here is a fact-based summary of the story contents:

Over the years, several Linux commands have been deprecated, either because they are no longer relevant, have security problems, or have ceased to be maintained. You might still be able to use these common commands, but you probably shouldnt. Instead, try alternatives that are less prone to bugs and offer more features too.

cron: use systemd or launchd instead

This is probably the most-used deprecated Linux command

One of my favorite commands that I learned about long ago, cron was nevertheless a frustrating tool to get to grips with. Its awkward syntax and tricky-to-debug environment made it a challenge to work with, so its no surprise that modern alternatives are available. On Linux, the systemd software performs many startup-related tasks, including the handling of timers.

If you have access to a recent Linux distro, try using the systemctl command to show all systemd timers:

systemctl list-timers

You can then get more information about a timer with the status sub-command:

systemctl status motd-news.service

The output includes a Process line which lists the actual command this timer runs:

Information about the "Message of the Day" service, including current status, information about documentation, and the linked command. [Information about the "Message of the Day" service, including current status, information about documentation, and the linked command.]

On macOS, cron is also deprecated, but its replacement is launchd instead of systemd. Again, launchd does a lot more than just scheduling tasks, but it does act as a cron upgrade, with features like better handling of tasks that may need to run when your computer is powered off.

ifconfig: ip replaces it

It's shorter and easier to remember, too

The ip command tells you anything you might need to know about your network connection, including its IP address, route to the public internet, and network devices. Its a low-level tool whose full power youll only really unlock if youre a network or system administrator. For most users, it replaces the old ifconfig tool for one purpose: discovering your public IP address:

ip address

Of course, you can get the same information from a website like ifconfig.me, which reports the IP address you send it, along with other diagnostics. You can even access it from the command line to see your IP in plain text:

Output from a curl command to ifconfig.me which echos the clients public IP address. [Output from a curl command to ifconfig.me which echos the clients public IP address.]

But if youre debugging a network problem, these options may be unavailable, and a local tool will always be more reliable than a remote website that may one day be deprecated too.

nslookup: dig is more powerful

Get more info with a better, shorter command

The ns in nslookup stands for name server, so this tool provides an interface to query DNS. dig is the same thing, with more features and better formatting. Although nslookups status has flipped a couple of times, to deprecated and back again, dig is a useful replacement.

In practice, dig is a drop-in replacement for nslookup: pass it a domain name and youll get back the IP address (or addresses) that domain maps to:

Output from the dig command showing several A records for google.com alongside query time and other low-level networking details. [Output from the dig command showing several A records for google.com alongside query time and other low-level networking details.]

If you need a really simple tool, nslookup will do the job. But as soon as you want detailed debugging info or more advanced record querying, dig should be your first choice.

neofetch: many successors are available

There are better ways to show off your Linux build

Some commands are so popular that, when deprecated, they spawn a slew of replacements. The Neofetch program was responsible for all those colorful ASCII logos you see brightening up Linux terminal screenshots:

neofetch command output on an Ubuntu operating system. [neofetch command output on an Ubuntu operating system.]

Sadly, the tool was retired in 2024, but fortunately, there are many alternatives. It seems as if every programming language has its own version of this utility, from Bash scripts to C and Rust.

Fastfetch is the leading contender, presenting a colorful logo alongside detailed system specs and stats. You can configure everything about its output, from the layout to the precise information it reports, and how it presents it:

A fastfetch configuration showing system specs grouped into different sections, using ASCII art and custom fonts for icons. [A fastfetch configuration showing system specs grouped into different sections, using ASCII art and custom fonts for icons.]

Although many options exist, fastfetch is probably the best, not least because it is actively maintained. Other alternatives, like ufetch or pfetch, have been archived or are no longer being updated. And some other tools may clearly be inspired by fastfetchs design, but they perform different functions; onefetch, for example, displays summary info about a git project:

The onefetch program showing a summary of the onefetch git repository. [The onefetch program showing a summary of the onefetch git repository.]

scp: rsync can be much faster

Wait, you're still using scp?

scpfor secure copyis a quick and easy command that securely copies files over a network, using an SSH connection. It was an upgrade to FTP, but is now deprecated in favor of rsync, depending on your required use.

In the simple case, you can use either tool in the same way to upload a file to a remote computer:

rsync foo.txt user@some-computer:/path/to/remote/foo.txt

scp foo.txt user@some-computer:/path/to/remote/foo.txt

While scp works perfectly fine to upload files, rsync is better for more complex directory structures that you may want to upload (or download) more than once. As its name suggests, rsync ensures that a remote set of files and a local set are in sync. If there are differences, it intelligently transfers a set of deltas, rather than complete files, making it much more efficient than scp.

netstat: ss is the upgrade to reach for

Troubleshoot your network the new way

The netstat toolshort for network statusis yet another networking tool that is now deprecated because it was part of the net-tools package. The modern equivalent is ss.

netstat shows open network sockets, routing tables, and other networking statistics. Its useful for troubleshooting network problems and checking the performance of network traffic.

ss, which belongs to the iproute2 collection, shows various networking statistics. Its similar to ip route, but is available as a standalone command.

which: type is a better option

Understand what you're doing in the command line

Another aspect of Linux that can be tricky to get your head around is exactly what happens when you run a command. For example, running a command seems fairly straightforward:

ls

However, behind the scenes, one of several things could happen, including:

There are several commands to help you discover exactly whats going on. These include the following, with descriptions from their man or tldr pages:

The whatis command is yet another one thats related to the task, but with a slight difference. whatis -d keyword will show you detailed information about a command (and related commands) by searching man pages for keyword.

These all do pretty much the same kind of thing, with slight differences in their output. But the recommended replacement for which is another program altogether: type.

On macOS, the which command is a shell built-in, but my Ubuntu 24 system only has an executable program, at /usr/bin/which. This program cannot give as much information as a shell built-in because it doesnt have access to that data. So running which cd on Ubuntu gives me no output at all, while macOS tells me cd: shell built-in command.

The type command, meanwhile, is a builtin. On both macOS and Ubuntu (and any other Linux distro), it should tell you exactly what a command is, and where it is, if appropriate:

Output from the type command explaining that cd is a shell builtin while grep is an executable located at /usr/bin/grep. [Output from the type command explaining that cd is a shell builtin while grep is an executable located at /usr/bin/grep.]

Note that type also supports the same useful -a option that which does, to show all instances of a command, not just the first:

The type command running with the -a option to show that cd is a shell builtin and also exists as an executable in /usr/bin. [The type command running with the -a option to show that cd is a shell builtin and also exists as an executable in /usr/bin.]

If the presence of cd as an executable, in addition to a builtin, seems weird to youit should! On macOS, the program is simply a shell script that calls the cd builtin, so its just a dummy wrapper. This is for POSIX compliance, and youll probably never need to use it.

Like
Share
Add Us
Readers like you help support How-To Geek. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.
How-To Geek logo [How-To Geek logo] See more How-To Geek stories on Google. Add us on Google

Web Proxy Viewer  |  New URL  |  Original Page