Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Shell Scripting
  • Kali Linux
  • Ubuntu
  • Red Hat
  • CentOS
  • Docker in Linux
  • Kubernetes in Linux
  • Linux interview question
  • Python
  • R
  • Java
  • C
  • C++
  • JavaScript
  • DSA
Open In App
Next Article:
Netstat command in Linux
Next article icon

netsh Equivalent on Linux

Last Updated : 26 Dec, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

The netsh is the popular command in Windows CMD (Command Prompt) that permits you to retrieve network configuration information running on the PC. If you recently shifted to the Linux OS and are looking for the Netsh command there, unfortunately, Linux doesn't have this command support. Instead, several networking tools are available in Linux to troubleshoot/display the network statistics.

Linux Alternatives for Netsh Command in Linux

Linux is preferred the most regarding security and hardware compatibility to manage networks. As a network administrator, consider the following Linux utilities for network configuration or troubleshooting.

  1. ifconfig
  2. ip
  3. route
  4. netstat
  5. systemd (Service Manager)

All the above-mentioned commands come with the net-tools package. Below is the installation of the net-tools package on different Linux distros.

1. For Ubuntu/Debian:

$ sudo apt install net-tools

Installing net-tools package
Installing net-tools package

2. For Fedora/RedHat/CentOS:

$ sudo dnf install net-tools

1. ifconfig

ifconfig is the abbreviation of Interface Configuration, a basic network command in Linux having core functionality to configure/debug/display the network interfaces. Moreover, it also permits the dynamic configuration of network interfaces, assigning IP addresses, and subnetmasks.

Example 1: View All Available Network Interfaces

The network interface is a bridge between the the computer and the public/private network. To view all available network interfaces on the system use the -a flag with ifconfig command.

ifconfig -a

Viewing all available network interfaces
Viewing all available network interfaces

The above output shows all network interfaces. In our case, the network interface "ens33" and "lo" (loopback interface) are listed.

Example 2: Enable/Disable Network Interfaces

To disable a particular network interface, provide the interface name with a "down" option. Correspondingly, to enable the network interface, use the "up" option. Please note that the root privileges will be required for both enabling/disabling processes.

$ sudo ifconfig ens33 down $ sudo ifconfig ens33 up

Enabling/Disabling Network Interfaces
Enabling/Disabling Network Interfaces

2. ip

The "ip" stands for Internet Protocol, a built-in command in Linux that shows/manipulates routing, network devices, interfaces, and tunnels. It shares similar functionality as the "ifconfig" command but has some extra advanced features such as configuring policy routing, network namespace, and VLAN (Virtual Lan).

Example 1: Show Network Interfaces

The following IP command with the "addr show" flag displays all available network interfaces on the network.

$ ip addr show

Showing Network Interfaces
Showing Network Interfaces

In case, if multiple interfaces are running, specify it at the end of the command to retrieve its information:

$ ip addr show <interface name>

Example 2: Get Routing Packets Information

In a network, communication takes place through packets and the routing table holds the routing packets to be sent to the destination. To get routing packet information on the network, this command is considered:

$ ip route

Getting Routing Packets Information
Getting Routing Packets Information

3. route

route is a Linux command that gives the routing table information. The routing table is the set of defined rules for the data packets to be transferred. Moreover, it allows to add, delete, and change the routing entries. You can consider this command if your focus main focus is to manage the IP routing table on the network.

Example 1: Display Routing Table

To obtain the Kernel (manage resources for OS ) IP routing table for the network, simply run the "route" command.

$ route

Disabling Route Table
Disabling Route Table


Example 2: Set/Add Default Gateway IP

Default gateway is used to route the information for a device/network. To set the default gateway on the network, use the "add default" option and specify the IP address. Let's say, you want to set the default gateway IP "192.168.119. 1". For this objective, see this command.

$ sudo route add default gw 192.168.119.1

Setting/Adding Default Gateway IP
Setting/Adding Default Gateway IP

The default gateway "192.168.119. 1" is set.

4. netstat

The full form of netstat is Network Statistics, a powerful Linux tool for the configuration and troubleshooting the network statistics. It displays the network connections, interface statistics, routing tables, multicast memberships, and masquerade connections.

Example 1: Display All Network Interfaces

To display network all network interfaces using the netstat command, the "-i" is accomplished. For instance, see the following command execution.

$ netstat -i

Displaying all network Interfaces
Displaying all Network Interfaces


Example 2: Display Network Routing Table

As already explained in the "route" command section, the routing table holds destination addresses for the network. To print the routing table with netstat command give the "-r" flag:

$ netstat -r

Displaying Network Routing Table
Displaying Network Routing Table

5. systemd (Service Manager)

In modern Linux distributions, systemd is the default init system service manager. A network service can be managed through this i.e. enabling/disabling a controlled behavior. For instance, the commands are enabling and disabling the NetworkManager services.

$ sudo systemctl enable NetworkManager $ sudo systemctl disable NetworkManager

Managing Network Service
Managing Network Service

Conclusion

In conclusion, there's no Netsh command support available in Linux. However several alternative commands are available that share similar functionalities as netsh command does. You can use the ifocnfig, ip, route, and netstat commands. Additionally, the service manager (systemd) can be used to enable/disable the network services.


Next Article
Netstat command in Linux
author
linuxuser007
Improve
Article Tags :
  • Linux-Unix
  • Geeks Premier League
  • Geeks Premier League 2023

Similar Reads

  • How to Install Nessus on Linux?
    Nessus is a vulnerability management tool that helps organizations and network environments identify and address network security issues. It helps in identifying vulnerabilities, potential threats, and irregularities. It plays an important role in maintaining a strong cybersecurity posture. Features
    6 min read
  • Netstat command in Linux
    The netstat command is like a special tool in Linux that helps you understand and check things about how your computer connects to the internet. It can tell you about the connections your computer is making, the paths it uses to send information, and even some technical details like how many packets
    7 min read
  • Linux Network Commands Cheat Sheet
    Linux is a very popular operating system. Many people use it. Developers and network admins need to know Linux network commands well. This article will going explains most of the common Linux network commands in a very easy way and It also has a cheat sheet about these commands. The cheat sheet tell
    9 min read
  • How to Install ntopng in Linux?
    ntopng is an Open Source Tool to monitor the network. It is a security network monitoring tool, also monitors web activities passively. It is also used for packet capturing, Traffic Recording, and Network Probing. A huge number of companies like Google, HP, Cisco, IBM, and many more uses ntop. It ac
    2 min read
  • Nmap Command in Linux with Examples
    Nmap is Linux command-line tool for network exploration and security auditing. This tool is generally used by hackers and cybersecurity enthusiasts and even by network and system administrators. It is used for the following purposes:  Real time information of a networkDetailed information of all the
    6 min read
  • Telnet Command in Linux
    Telnet serves as a command line interface (CLI) tool that allows logging in and communication with a system through a TCP/IP network. Users can issue commands on a remote machine as Telnet users can log into a machine over a TCP/IP network with the use of Telnet addresses (e.g. telnet://user@hostnam
    7 min read
  • Best VOIP Clients for Linux
    VoIP systems offer significant improvements over the traditional modes of communication by providing an economic and superior mode of communication that is Voice on the Internet protocol. For users of Linux and other open source platforms, it sometimes becomes relatively hard to identify the best Vo
    6 min read
  • ip Command in Linux with Examples
    The ip command in Linux is a powerful utility for network configuration and management. It allows users to interact with various networking components such as network interfaces, routing tables, addresses, and more. Here, we will look into the 'ip' command, covering each aspect with examples, code,
    7 min read
  • How to Install nload in Linux?
    nload is a console-based application which monitors network traffic and bandwidth usage in real. It provides information about incoming and outgoing traffic using graphs, and additionally it provides information like current data transferring rate average data transferred, and minimum and maximum da
    3 min read
  • Network Input in Java
    In Java, Network Input is all about sending and getting data over a network. It's about making links, getting data from input sources, and dealing with the information we get. Java offers strong tools, like input streams and sockets. These help with these operations so communication between devices
    2 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences