Register now for better personalized quote!

5 Linux network-related commands every new user should know

Apr, 02, 2024 Hi-network.com
Ultimate Hacking Keyboard closeup.
Jack Wallen/

I've been using Linux for what seems like forever. Over the years, I've noticed that I use thecommand line less and less, because the GUIs have just gotten so much better.

Even still, there are certain things I still do from the terminal window, especially when it comes to the network. There are aplethora of commands centered around configuring, managing, working with, and controlling your network, but these five are the most handy.

Also: Thefirst 5 Linux commands every new user should learn

I'm not saying you haveto use these tools. You could go for years without ever having to open the terminal app. Although you mightneverrun a single command on Linux, you'll be glad you know these commands, should that time come around.

Let's dive in. All these commands should be installed on your machine by default and free to use.

1. ip

I use the ipcommand almost every day to get the IP address of a machine on my network. Although this command is far more powerful than for this single purpose, this is likely the main reason you'll use it for (especially early on with Linux).

To find out the IP address of your machine, open the terminal window, and type:

ip a

Thea option is forall. If you only want to view IPv4 listings, the command gets a bit more complicated:

ip -4 addr show

You should see something like this in the output:

inet 192.168.1.134/24 brd 192.168.1.255 scope global dynamic noprefixroute wlp15s0

TheIP address of the machine I'm on is 192.168.1.134.

Simple.

Also: My 5 favorite Linux text editors (and why you should be using one)

2. ping

The pingcommand has been around since the dawn of humankind... or so it seems. This command lets you check to see if a remote machine is reachable. If our network seems to be having trouble, one of the first things I do is run the command:

ping google.com

If the command succeeds, I know the problem isn't our WAN. If the ping time is slow (it should be around 30ms to 50ms), it could be a DNS issue.

The ping command is very handy for troubleshooting your network connection.

3. netstat

I also use thenetstatcommand to troubleshoot networking connections. Although this is a very powerful command, I tend to only use it to find out what is connected to the machine I'm working on.

To view all connections to your machine, issue the command:

netstat -a

The output might be confusing at first, but all you're looking for is unfamiliar addresses or domains. If you see anything suspect, do yourself a favor and Google it to ensure it's okay.

4. wget

The wgetcommand is used for downloading files from the internet. You might be asking yourself, "Isn't a web browser used for that?" Yes, it is. When you don't have a GUI available, however, this is your best option. For instance, you might be on a server without a desktop environment, or maybe you're connected to a remote computer and can't access it's GUI. When that happens,wgetis there for you.

Also: 5 Linux file and folder management commands you need to know

This command is also simple to use. Say there's a file you want to download at http://example.com/test_file.zip. To download that withwget, the command would be:

wget http://example.com/test_file.zip

It's that simple. I find that wget is not only faster than using a web browser, but it's also possible to resume an interrupted download with the command:

wget -c -r http://example.com/test_file.zip

5. ssh

At some point, you'll need to log into a remote Linux machine using SSH (which stands for Secure Shell). Secure Shell is quite easy to use, but you need to have an account on the remote machine (which doesn't have to have the same username as you have on your local machine). Let's say you need to connect to a machine at IP address 192.168.1.134 and your user accounts are the same on both local and remote machines. For that, the command would be:

ssh 192.168.1.134

If the usernames are not the same, the command would be (where USERNAME is the remote username):

If this is the first time connecting, you'll be prompted to accept the remote fingerprint, so typeyand hit Enter. You'll then be prompted to type the remote user password. Once connected, you're ready to do whatever remote work you need.

There you go -- the first five network-related commands you'll want to know if you're using Linux.

tag-icon Hot Tags : Tech

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.