ip Command in Linux

Learn via video courses
Topics Covered

Build an AI-First Career, Master the Complete Skillset

Choose from our industry-leading programs designed for career success

NSDC Certified

Modern Software and AI Engineering Program

Master full-stack development with AI integration

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Modern Data Science and ML with specialisation in AI

Advanced data science techniques with AI specialization

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

Advanced AIML with Specialisation in Agentic AI

Deep dive into AIML with focus on Agentic systems

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

DevOps, Cloud & AI Platform Engineering

Build and manage AI-powered cloud infrastructure

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program
NSDC Certified

AI Engineering Advanced Certification by IIT-Roorkee

Premier AI engineering certification from IIT-Roorkee

3 MonthsDuration
AI-LedCurriculum
Career SupportSupport
Program highlights
Go to Program
NSDC Certified

AI Forward Deployed Engineer Program

Full-stack engineering, production AI and client-facing consulting

12 MonthsDuration
AI-LedCurriculum
Career SupportSupport
GoogleAmazonPaytm+1000 more
Go to Program

Overview

The ip command in Linux is a versatile tool used to manage network interfaces, routing tables, and IP addresses. It is part of the iproute2 package and has largely replaced the old ifconfig command, offering more features and flexibility. This command is essential for anyone dealing with networking in Linux.

Syntax of ip Command in Linux

The basic syntax of the ip command in Linux is as follows:

Where:

  • options: This can be various flags that modify the behavior of the command.
  • OBJECT: This refers to the type of object we are interacting with, such as 'address', 'route', 'link', etc.
  • command: The action to be performed on the object. Some examples include 'add', 'del', 'show', etc.
  • arguments: These are additional parameters needed for the command to execute.
Sharpen Your Fundamentals with Free Learning

Options in ip Command in Linux

  1. -s, --statistics: This option makes the command output more detailed information.

    For example -

    Output:

    This command will provide detailed statistics such as the number of received and transmitted packets, errors, dropped packets, etc.

  2. -4, -6: These options force the ip command to use either IPv4 (-4) or IPv6 (-6).

    For example -

    Output:

    This command allows the user to specifically interact with IPv4 addresses.

  3. -o, --oneline: This option makes the output to be printed on one line, which is very useful when dealing with multiple entries.

    For example -

    Output:

    This command makes it easier to read or parse the output.

How Scaler Transformed Careers in Different Fields

₹23L
AVG CTC
SCALER PLACEMENT PROOF

Scaler learners achieved 2.5x salary growth with average post-Scaler CTC reaching ₹23L.

11,000+placements
650+companies
Verified data
Hiring Partners:
GoogleGoogleAmazonAmazonMicrosoftMicrosoftFlipkartFlipkartAdobeAdobe1200+ more

Example Usages

  • To display all network interfaces:

    Output:

    Explanation: This command provides a list of all active and inactive network interfaces on the system.

  • To add a new IP address to an interface:

    Output:

    Explanation: This command is useful when configuring a new network interface.

Tips

  • To make changes permanent across reboots, you should put these commands in a startup script or use the Network Manager interface.

  • While using 'ip command linux' for network troubleshooting, the '-s' (statistics) option can provide useful detailed information.

Turn Learning into Career Growth

1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary
1200+Hiring Partners
89%Placement Rate
11,000+Placements
147%Avg Salary Increment
2.5XCareer Growth
₹23 LPAAvg Post-Scaler Salary

Advanced Use Cases of ip Command in Linux

  • Setting up a new static route:

    Output:

    Explanation: This command is necessary when you want to manually manage the routing table.

  • Deleting an IP address:

    Output:

    Explanation: This command is useful when you want to remove an IP address from an interface.

  • Displaying all IP addresses on your machine in a concise way:

    Output:

    Explanation: This command makes it easier to get a quick overview of the IP configuration on the system.

Conclusion

  • The 'ip command linux' is a powerful tool for managing networking in Linux.

  • It can be used to configure and modify network interfaces, IP addresses, and routing tables.

  • The output of the ip command can be made more detailed or concise with various options.