What is the primary purpose of the ifconfig command?
The ifconfig command is used to display or configure network interfaces on a Linux system. It shows IP addresses, network masks, and interface status.
Click to reveal answer
beginner
What does the ip addr command do?
The ip addr command shows detailed information about all network interfaces, including IP addresses, link status, and more. It is a modern replacement for ifconfig.
Click to reveal answer
beginner
How do you display all network interfaces using ifconfig?
Simply type ifconfig without any arguments to list all active network interfaces and their details.
Click to reveal answer
intermediate
How can you show both active and inactive interfaces using ip addr?
Use ip addr show or just ip addr. It lists all interfaces, whether active or inactive, with their IP addresses and status.
Click to reveal answer
intermediate
Why is ip addr preferred over ifconfig in modern Linux systems?
ip addr is part of the newer iproute2 suite. It provides more detailed info, supports more features, and is actively maintained, unlike ifconfig which is deprecated.
Click to reveal answer
Which command shows IP addresses and network interfaces on Linux?
Als
Bifconfig
Ccd
Dmkdir
✗ Incorrect
ifconfig displays network interfaces and IP addresses.
What is the modern replacement for ifconfig?
Aip addr
Bnetstat
Cping
Dtraceroute
✗ Incorrect
ip addr is the modern command to show network interface info.
How do you show all network interfaces including inactive ones?
Aip addr show
Bifconfig -a
Cls -l
Dip link down
✗ Incorrect
ip addr show and ifconfig -a both list all interfaces, active or inactive.
Which command is deprecated but still commonly used?
Ass
Bip addr
Cifconfig
Dip route
✗ Incorrect
ifconfig is deprecated but still found on many systems.
What information does ip addr NOT show?
AIP addresses
BInterface status
CMAC addresses
DRouting table
✗ Incorrect
ip addr shows addresses and status, but routing info is shown by ip route.
Explain the differences between ifconfig and ip addr commands.
Think about which command is older and which one is recommended now.
You got /4 concepts.
Describe how to check all network interfaces and their IP addresses on a Linux system.
Remember both commands can show interfaces but differ in details.
You got /3 concepts.
Practice
(1/5)
1. What is the main purpose of the ifconfig and ip addr commands in Linux?
easy
A. To manage user accounts
B. To edit text files in the system
C. To monitor CPU usage
D. To display network interface details and IP addresses
Solution
Step 1: Understand command purpose
The commands ifconfig and ip addr are used to show details about network interfaces and their IP addresses.
Step 2: Eliminate unrelated options
Options about editing files, managing users, or CPU monitoring do not relate to network interfaces.
Final Answer:
To display network interface details and IP addresses -> Option D
Quick Check:
Network info = C [OK]
Hint: Remember: both commands show network info, not files or users [OK]
Common Mistakes:
Confusing network commands with file editing tools
Thinking these commands manage users
Assuming they monitor CPU or memory
2. Which of the following is the correct syntax to display all IP addresses using the ip command?
easy
A. ip address list all
B. ip show addr
C. ip addr show
D. ip display ip
Solution
Step 1: Recall correct command syntax
The correct syntax to show IP addresses is ip addr show or simply ip addr.
Step 2: Check other options for errors
Options B, C, and D use incorrect order or invalid keywords.
Final Answer:
ip addr show -> Option C
Quick Check:
Correct syntax = A [OK]
Hint: Remember: 'ip addr show' is the standard order [OK]
Common Mistakes:
Swapping 'addr' and 'show' order
Using invalid keywords like 'display' or 'list all'
Adding unnecessary words
3. What will be the output of the command ifconfig eth0 if the interface eth0 is up with IP 192.168.1.10 and netmask 255.255.255.0?
medium
A. Shows interface eth0 details including IP 192.168.1.10 and netmask 255.255.255.0
B. Shows only the MAC address of eth0
C. Shows error: interface eth0 not found
D. Shows CPU usage statistics
Solution
Step 1: Understand ifconfig eth0 output
This command displays detailed info about the eth0 interface, including IP address and netmask if the interface is up.
Step 2: Eliminate unrelated outputs
It does not show only MAC address, CPU stats, or error if interface exists and is up.
Final Answer:
Shows interface eth0 details including IP 192.168.1.10 and netmask 255.255.255.0 -> Option A
Quick Check:
ifconfig eth0 shows IP and netmask = D [OK]
Hint: ifconfig with interface name shows full details [OK]
Common Mistakes:
Expecting only MAC address output
Assuming error if interface is active
Confusing with CPU or system stats
4. You run ip addr show eth0 but get no output. What is the most likely reason?
medium
A. The eth0 interface does not exist or is down
B. You need to run the command as root
C. The command syntax is incorrect
D. The IP address is not assigned yet
Solution
Step 1: Analyze command behavior
If ip addr show eth0 returns no output, it usually means the interface eth0 does not exist or is disabled.
Step 2: Check other options
Running as root is not required to show interfaces; syntax is correct; lack of IP alone does not cause no output.
Final Answer:
The eth0 interface does not exist or is down -> Option A
Quick Check:
No output means interface missing/down = B [OK]
Hint: No output usually means interface missing or down [OK]
Common Mistakes:
Assuming root is needed to view interfaces
Thinking syntax is wrong
Confusing no IP with no output
5. You want to write a script that checks if the interface eth1 has an IP address assigned using ip addr. Which command snippet correctly tests this?
hard
A. ifconfig eth1 | grep -q 'inet6 '; then echo 'IP assigned'; else echo 'No IP'; fi
B. if ip addr show eth1 | grep -q 'inet '; then echo 'IP assigned'; else echo 'No IP'; fi
C. ip addr show eth1 | grep -q 'ether '; then echo 'IP assigned'; else echo 'No IP'; fi
D. if ip link show eth1 | grep -q 'UP'; then echo 'IP assigned'; else echo 'No IP'; fi
Solution
Step 1: Identify correct IP address check
The command ip addr show eth1 lists addresses; searching for 'inet ' finds IPv4 addresses assigned.
Step 2: Evaluate other options
ifconfig eth1 | grep -q 'inet6 '; then echo 'IP assigned'; else echo 'No IP'; fi checks IPv6 with ifconfig but question asks for ip addr. ip addr show eth1 | grep -q 'ether '; then echo 'IP assigned'; else echo 'No IP'; fi looks for MAC address ('ether'), not IP. if ip link show eth1 | grep -q 'UP'; then echo 'IP assigned'; else echo 'No IP'; fi checks interface status, not IP assignment.
Final Answer:
if ip addr show eth1 | grep -q 'inet '; then echo 'IP assigned'; else echo 'No IP'; fi -> Option B
Quick Check:
Check 'inet ' in ip addr output = A [OK]
Hint: Search 'inet ' in ip addr output to find IPv4 address [OK]
Common Mistakes:
Checking MAC address instead of IP
Using ip link instead of ip addr
Confusing IPv6 with IPv4 check
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.