Or press ESC to close.

Linux: How to use basic commands [Part 4]

02 October 2025 19:50 Computer

Some of those commands only works on Arch, but they have an equivalent in other Linux distributions.


Networking commands

                    

ping Send an ICMP ECHO_REQUEST to network hosts

traceroute print the route packets trace to a network host

(sometimes replaced by tracepath)

ip show/manipulate routing, devices, policy routing

and tunnels

netstat Print network connections, routing tables, interface

statistics, masquerade connections and multicast

memberships

ftp Internet file transfer program (also lftp)

wget Non-interactive network downloader

ssh OpenSSH SSH client (remote login program)


ip a show network interface

netstat -ie examine network interfaces in our system

netstat -r kernel network routing table

use "ftp" and then "help" to see commands

netstat -lntu list all open ports (-l all listening sockets,

-n port number, -t TCP, -u UDP)

ss -lntu same thing but with consistent outputs


To open port 22 (It can be something else than iptables)

iptables -A INPUT -p tcp --dport 22 -j ACCEPT

To save the rules

iptables-save -f /etc/iptables/iptables.rules

To reload

iptables-restore /etc/iptables/iptables.rules

Server

systemctl start sshd to start ssh server

systemctl stop sshd stop server

systemctl status sshd server status

systemctl restart sshd server restart

sudo systemctl enable sshd server start at boot

sudo systemctl disable sshd disable start at boot


ssh localhost connect to localhost (itself)

ssh username@systemname connect as another user

ssh "systemname" free use the free command (show memory)

ssh "systemname" 'ls *' > dirlist.txt Logs in the ssh, and print

the output of ls * into a file

named dirlist

ssh "systemname" 'ls * > dirlist.txt' this time, creates the file

inside the remote system

ssh -X "systemname" allow graphical output

(then use xload) and you can see

xload

            

~/.ssh/known_hosts where you change keys

                    

scp secure copy

-r to get folders and whats in it

scp remote-sys:document.txt . copy a document from our home dir on

the remote system "remote-sys", to the

current working directory on our local

system (don't forget the '.')

scp bob@remote-sys:document.txt . same thing but with a username

To copy to the Desktop of a Mac, scp remote-sys:document.txt Desktop

The procedure is as followed : Open a terminal, log via ssh, find the

path to the file. Open another terminal, use :

scp user@remote-sys:/path/to/file ~/path/destination

                    

sftp remote-sys connect to system

sftp username@remote-sys connect with username

then, you can do:

ls

lcd Desktop

get "file"

bye

And the downloaded file will be on the

local Desktop

Those were the essentials of my networking notes, which concludes the last part on Linux basic commands.

Most of my studying of Linux was done using the book: The Linux Command Line by William Shotts, while daily driving Arch Linux.

I highly recommend the book for anyone wanting to learn Linux.

Hedi0410

based in France.