| [ Web Proxy ] |
| Viewing: https://www.howtogeek.com/stop-using-deprecated-linux-commands/ | [Back] [Original] |
[Laptop with the Linux terminal open.]
Credit: Lucas Gouveia / Hannah Stryker / How-To Geek
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.
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:
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.
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:
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.
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:
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.
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:
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:
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:
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.
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.
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:
Note that type also supports the same useful -a option that which does, to show all instances of a command, not just the first:
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.
We want to hear from you. Share your perspective in the comments below, and please keep the conversation respectful.
Your comment has not been saved
Send confirmation email
[User Display Picture]
I still use cron and crontab. I run current and cutting edge distributions that do not have SystemD, so that is not even an option. As for the rest:
[User Display Picture]
Bingo.. Use distros that YOU control.. not that control you!
SysV Init.. all the way..
[User Display Picture]
Cron is simple. I can list the crontab quickly and know what runs when. Systems- gotta list then delve into a overly complicated configuration etc.
Most of these examples are overly complex, just like windoze. Let's bundle 5 or 6 simple commands into one massive program with dozens if not hundreds of flags or options. No thanks.
[User Display Picture]
I would say several of these options are just alternatives, but not because the original is outdated.
[User Display Picture]
Yeah, basic tools like "which" aren't going anywhere. Especially for shell scripts, less is sometimes more (accidental joke there), and you want classic commands that don't require regex to grab the information you want out of formatted text.
"Deprecated" is a heavily over and misused term in the *nix world, many commands aren't going anywhere or are now just aliases for newer tools. And things like nslookup were going to be deprecated but reversed course and got maintained again anyways (over 20 years ago now in that case), so a lot of it is just misinformation.
Also.... scp/sftp and rsync are different protocols.....
[User Display Picture]
Except for ifconfig.. aaannnd... nslookup... aaaannndd.. netstat.. They're literally deprecated and disappearing from the installs.
[User Display Picture]
T nslookup is not deprecated. At one point it was going to be and old redhat users will remember the warning messages to use dig instead, but it has not been in a deprecated state since 2004 and isn't going anywhere.
[User Display Picture]
Cron is tricky and awkward? I know he added that one for engagement because cron is dead simple and the author knows this.
[User Display Picture]
I hate how we now have to use the command `ip` to examine and configure network interface options that are unrelated to IP. It's one of the things that I always made fun of Windows about.
In a similar vein, `ss` is still missing many features that `netstat` had.
ISC, the folks who wrote `dig`, claim that you should really be using `delv` instead. Or at least they used to.
[User Display Picture]
scp is not deprecated by rsync, but I suppose you could say sftp can be used instead of scp.
[User Display Picture]
In OpenSSH at least, the scp command has been just an sftp call by default for a few years.
[User Display Picture]
I tried the fastfetch command and received this error: command not found. Running Linux Mint v22.3 Cinnamon.
[User Display Picture]
Stop using simple readable-text-based cron for the several steps longer and overcomplicated systemclt way, just for the sake of being more modern??? I am open to check pros and cons, but meanwhile I'd rather stay with tested and true.
[User Display Picture]
What irks me is developers are still using wireless extensions, and their utilities like iwconfig. The kernel wireless extensions have been deprecated for years. Developers should use netlink along with the wireless utility iw.
The best of How-To Geek, directly in your inbox.
By subscribing, you agree to receive newsletter and marketing emails, and accept our Terms of Use and Privacy Policy. You can unsubscribe anytime.
| Web Proxy Viewer | New URL | Original Page |