Linux Command Line Reference


Show the IP Address


ip address show 

# Show only the addresses. 
ip address show | grep inet


Network Manager


Manjaro uses the RedHat NetworkManager suite to manage network interfaces. The command-line tool is nmcli.


List Interfaces and Status


Use the nmcli command with no arguments to list the interfaces and status.


For example, below, the enp4s0 device is connected and using the "Wired connection 1" connection. A "connection" is a group of settings in NetworkManager. The IP address is 172.16.0.14.


nmcli

enp4s0: connected to Wired connection 1
        "Marvell 88E8056"
        ethernet (sky2), 00:26:18:52:64:7B, hw, mtu 1500
        ip4 default, ip6 default
        inet4 172.16.0.14/16
        route4 172.16.0.0/16 metric 100
        route4 default via 172.16.1.254 metric 100
        inet6 2600:1700:1e80:7880::2f/128
        inet6 2600:1700:1e80:7880:fb86:cb6f:ecef:936a/64
        inet6 fe80::ac6:af13:8796:70c9/64
        route6 fe80::/64 metric 1024
        route6 2600:1700:1e80:7880::/64 metric 100
        route6 2600:1700:1e80:7880::/60 via fe80::4e12:65ff:fe6c:7620 metric 100
        route6 2600:1700:1e80:7880::2f/128 metric 100
        route6 default via fe80::4e12:65ff:fe6c:7620 metric 100

enp5s0: unavailable
        "Marvell 88E8056"
        ethernet (sky2), 00:26:18:52:64:7C, hw, mtu 1500

wlp1s0: unavailable
        "Intel 7260"
        wifi (iwlwifi), DA:B3:7C:5D:1F:C8, sw disabled, hw, mtu 1500

lo: unmanaged
        "lo"
        loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536

DNS configuration:
        servers: 172.16.1.254
        domains: attlocal.net
        interface: enp4s0

        servers: 2600:1700:1e80:7880::1
        domains: attlocal.net
        interface: enp4s0

Use "nmcli device show" to get complete information about known devices and
"nmcli connection show" to get an overview on active connection profiles.

Consult nmcli(1) and [PwshNotes Edit] manual pages for complete usage details.


List Connections


NetworkManager is organized around "connections". NetworkManager connections are groups of settings which can be saved and applied to a device. A device is just your network card.


You can list the available connections with nmcli connection show.


For example, below, the connections are "Wired connection 1" and "Wired connection 2". And Wired connection 1 is applied to the "enp4s0" device (network card).


nmcli connection show

NAME                UUID                                  TYPE      DEVICE 
Wired connection 1  a722df7b-a8b1-32ad-8b18-a694919a8d03  ethernet  enp4s0 
Wired connection 2  03c99f3b-d2b5-3b5d-8b8f-2e0ec4bf182f  ethernet  --     


Renew DHCP Lease


Renew the DHCP lease with the nmcli device up ifname command.


Since we're renewing the DHCP lease, I will choose the device that is already connected.


# List the current IP address. 
nmcli | grep inet

        inet4 172.16.0.14/16
        inet6 2600:1700:1e80:7880::2f/128
        inet6 2600:1700:1e80:7880:fb86:cb6f:ecef:936a/64
        inet6 fe80::ac6:af13:8796:70c9/64

# List the devices. 
nmcli device status

DEVICE  TYPE      STATE        CONNECTION         
enp4s0  ethernet  connected    Wired connection 1 
enp5s0  ethernet  unavailable  --                 
wlp1s0  wifi      unavailable  --                 
lo      loopback  unmanaged    --                 

# Renew the IP address and include the device name. 
nmcli device up enp4s0

Device 'enp4s0' successfully activated with 'a722df7b-a8b1-32ad-8b18-a694919a8d03'.

# Check the new IP address. 
nmcli | grep inet

	inet4 192.168.1.51/24
	inet6 2600:1700:1e80:7880::2f/128
	inet6 2600:1700:1e80:7880:fb86:cb6f:ecef:936a/64
	inet6 fe80::ac6:af13:8796:70c9/64


List File System Types


Here we can see that my hard drives (/dev/sdX) are both using EXT4.


df -Th

Filesystem     Type      Size  Used Avail Use% Mounted on
dev            devtmpfs   12G     0   12G   0% /dev
run            tmpfs      12G  1.9M   12G   1% /run
/dev/sda1      ext4      916G   46G  824G   6% /
tmpfs          tmpfs      12G  147M   12G   2% /dev/shm
tmpfs          tmpfs      12G  8.2M   12G   1% /tmp
/dev/sdb       ext4      458G  9.2G  425G   3% /data
tmpfs          tmpfs     2.4G  108K  2.4G   1% /run/user/1000


Reboot


shutdown -r 0 


Restart the Print Queue


Sometimes documents get stuck in my print queue after waking from sleep. The solution is to restart the print service: CUPS. My Linux distribution, Manjaro, uses systemctl to manage services.


sudo systemctl restart cups


You can check the status of the local queue by visiting the web server for CUPS.


http://localhost:631/


Though, I believe version 3.0 of CUPS will have a new interface besides the web server.



netstat


netstat has been replaced with ss Here is the basic usage.


# Display all TCP sockets.
ss -t -a

State      Recv-Q   Send-Q  Local Address:Port     Peer Address:Port                         
...
TIME-WAIT  0        0        192.168.1.68:45552  34.117.237.239:https                        
ESTAB      0        0        192.168.1.68:34660  104.16.122.175:https                        
ESTAB      0        0        192.168.1.68:52806  34.117.237.239:https 
...



References


If you’re still using ifconfig, you’re living in the past | Ubuntu

Linux Force DHCP Client (dhclient) to Renew IP Address - nixCraft

nmcli(1) — Arch manual pages

How to Show File System Type in Linux

CUPS 3.0 Continues Being Crafted To Overhaul Linux Printing | Phoronix

How to Use the ss Command on Linux | How-to Geek

ss | Arch manual pages


Created: Thursday, June 16, 2022

Updated: Tuesday, March 12, 2024




/gemlog/