0% found this document useful (0 votes)
16 views7 pages

Essential Linux Networking Commands

The document provides a comprehensive guide on essential Linux networking commands, including checking network configuration, testing connectivity, and using DNS tools. It also covers using SSH for secure remote server access and file transfers, along with troubleshooting common issues. Additionally, it introduces gFTP as a user-friendly FTP client for file transfers, detailing installation, connection, and transfer processes.

Uploaded by

binduann
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views7 pages

Essential Linux Networking Commands

The document provides a comprehensive guide on essential Linux networking commands, including checking network configuration, testing connectivity, and using DNS tools. It also covers using SSH for secure remote server access and file transfers, along with troubleshooting common issues. Additionally, it introduces gFTP as a user-friendly FTP client for file transfers, detailing installation, connection, and transfer processes.

Uploaded by

binduann
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Networking : Basics

Linux Networking Commands


Linux provides a wide range of networking tools for managing and
troubleshooting network connections. Below is a quick guide to essential
networking commands.

1. Check Network Configuration


ifconfig (deprecated, use ip instead)
 Displays network interfaces and IP configurations.
ifconfig
ip
 Modern replacement for ifconfig.
 Show all interfaces:
ip addr show
 Display a specific interface:
ip addr show eth0

2. Test Connectivity
ping
 Tests connectivity to another host.
ping hostname_or_ip
Example:
ping [Link]
 To limit the number of packets sent:
ping -c 4 [Link]
traceroute
 Traces the route packets take to a destination.
traceroute hostname_or_ip
Example:
traceroute [Link]
(Install with sudo apt install traceroute on some systems.)

3. DNS Tools
nslookup
 Queries DNS to obtain domain/IP address information.
nslookup hostname
6. File Transfer
scp
 Securely copy files between hosts.
scp source_file user@remote_host:/path/to/destination
Example:
scp [Link] user@[Link]:/home/user/
7. Network Diagnostics
curl
 Fetch data from a URL.
curl [Link]
wget
 Download files from a URL.
wget [Link]
tcpdump
 Captures network packets for troubleshooting.
sudo tcpdump -i eth0
(Install with sudo apt install tcpdump on some systems.)

8. Monitoring and Troubleshooting


nmap
 Network scanning tool for discovering hosts and services.
nmap hostname_or_ip
(Install with sudo apt install nmap on some systems.)
Networking :SSH
Tutorial: Using SSH to Access Remote Servers and Transfer Files
Secure Shell (SSH) is a protocol for securely accessing and managing remote
servers over a network. This tutorial covers installing OpenSSH, logging into a
remote server, and copying files.

1. Installing OpenSSH
Step 1.1: Install OpenSSH Server and Client
1. On your local machine, check if SSH is installed:
ssh -V
If not installed, proceed to install OpenSSH:
o On Debian/Ubuntu:

o sudo apt update

sudo apt install openssh-server openssh-client


Step 1.2: Start and Enable SSH Service
1. Start the SSH service:
sudo systemctl start ssh
2. Enable SSH to start on boot:
sudo systemctl enable ssh
Step 1.3: Check SSH Status
1. Verify that the SSH service is running:
sudo systemctl status ssh

2. Logging into a Remote Server


Step 2.1: Obtain Server Information
 You need:
o IP address or hostname of the remote server.

o Username of the account on the remote server.

Step 2.2: Connect to the Remote Server


1. Use the ssh command:
ssh username@remote_server_ip
Example:
ssh user@[Link]
2. If prompted, confirm the connection by typing yes. This will add the server
to your known hosts.
3. Enter the password for the username when prompted.

3. Copying Files to and from the Remote Server


Step 3.1: Using scp for Secure File Transfer
Copy a File from Local to Remote
1. Use the scp command:
scp /path/to/local/file username@remote_server_ip:/path/to/remote/destination
Example:
scp [Link] user@[Link]:/home/user/
Copy a File from Remote to Local
1. Use scp:
scp username@remote_server_ip:/path/to/remote/file /path/to/local/destination
Example:
scp user@[Link]:/home/user/[Link] ~/Documents/
Copy an Entire Directory
 From local to remote:
scp -r /path/to/local/directory
username@remote_server_ip:/path/to/remote/destination
 From remote to local:
scp -r username@remote_server_ip:/path/to/remote/directory
/path/to/local/destination

5. Troubleshooting
Issue 1: SSH Connection Refused
 Ensure the SSH service is running:
sudo systemctl start ssh
 Verify the server's IP and username are correct.
Issue 2: Host Key Verification Failed
 Remove the old key from ~/.ssh/known_hosts:
ssh-keygen -R remote_server_ip
Issue 3: Permission Denied (Public Key)
 Ensure the key was copied to the correct location on the server
(~/.ssh/authorized_keys).
 Check the permissions of the .ssh directory and authorized_keys file:
 chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
6. Summary of Commands

Task Command Example

Connect to a server ssh user@[Link]

Copy file (local to


scp [Link] user@[Link]:/home/user/
remote)

Copy file (remote to


scp user@[Link]:/home/user/[Link] ~/Documents/
local)

Tutorial: Using gFTP for File Transfers


gFTP is a simple and user-friendly FTP client for Linux systems, providing a
graphical interface for transferring files between local and remote systems. It
supports protocols such as FTP, FTPS, SFTP, HTTP, and more.

1. Installing gFTP
Step 1.1: Install gFTP
 On Debian/Ubuntu:
 sudo apt update
sudo apt install gftp
Step 1.2: Verify Installation
After installation, launch gFTP from the terminal or application menu:
gftp

2. Launching gFTP
 Open gFTP from your system menu or by typing gftp in the terminal.
 You will see a graphical interface with:
o Local File Browser: Displays your local directories.

o Remote File Browser: Displays the remote server's files after


connection.
o Connection Bar: Fields to input server details (e.g., hostname,
username).

3. Connecting to a Server
Step 3.1: Input Connection Details
1. In the connection bar at the top:
o Host: Enter the hostname or IP address of the remote server
(e.g., [Link] or [Link]).
o Port: Default is 21 for FTP or 22 for SFTP.

o Username: Enter the remote account's username.

o Password: Enter the corresponding password.

2. Select the appropriate protocol from the dropdown menu (e.g., FTP, SSH2
for SFTP).
Step 3.2: Connect
Click the Connect button or press Enter. Once connected, the remote file system
will appear on the right panel.

4. Transferring Files
Step 4.1: Upload Files
1. Navigate to the directory on the remote server where you want to upload
files (right panel).
2. On the left panel, navigate to the file you wish to upload.
3. Select the file and click the Upload button (the right-pointing arrow).
Step 4.2: Download Files
1. Navigate to the file you want to download on the remote server (right
panel).
2. Select the file.
3. Click the Download button (the left-pointing arrow).
Step 4.3: Transfer Multiple Files
 To transfer multiple files or directories, use Ctrl or Shift to select multiple
items, then upload/download as described above.

Click the Disconnect button to end the session.

5. Summary of Key Features


Feature How to Use

Connect to a Enter host, username, and password in the connection bar and
Server press Connect.

Upload Files Select a file on the local panel and click the Upload button.

Download Files Select a file on the remote panel and click the Download button.

Additional Tips
 Use gFTP for quick and simple file transfers, but for advanced scripting or
automation, consider tools like rsync or scp.
 For secure transfers, always prefer SFTP (SSH2) over plain FTP.
By following this tutorial, you can efficiently use gFTP to manage file transfers
between local and remote systems. Happy transferring!

You might also like