Showing posts with label debian. Show all posts
Showing posts with label debian. Show all posts

Tuesday, November 29, 2016

Find the UUID of your network interface or connection

Today I was looking at the /etc/sysconfig/network-scripts/ifcfg-enp0s3 file and I came across the line that says UUID. I was thinking what is UUID of a network interface? Then I started thinking about how to find UUIDs of network interfcaes. I looked on the internet but I got no solution. Then I thought of trying to find it myself using network management commands. I did find a solution.

To find the UUIDs of your network connection, run the following command.

nmcli connection show
NAME                UUID                                  TYPE            DEVICE 
virbr0              4e02750f-13d9-4662-bfc2-10f9ae1a71bd  bridge          virbr0 
Wired connection 1  09066de3-7eb7-4ee1-9059-c651b6dff7a6  802-3-ethernet  --     
enp0s3              5144084b-0537-4e4b-9f15-065431bc6d38  802-3-ethernet  --  

From the output of this command, you can find the UUID of a connection on CentOS, Fedora, RedHat(RHEL), Ubuntu, Debian operating systems.

Tested on: CentOS 7, Ubuntu 16.04 LTS

Monday, November 14, 2016

Clear the Command History of your Terminal on Linux

You may have a lots of command in your shells history. You can display your shell commands history by running the following command,

history
    1  history
    2  lscpu
    3  history

This is the output of the history command of my Ubuntu computer. In real scenario you may have hundreds of commands on the history.

To clear the command history of your terminal on Linux, run the following command,

history -c

That's how you remove the history of your shell on Linux.

Thursday, November 3, 2016

Find the IP Address of a Specific Network Interface on Linux

To Find the IP Address of a specific network interface on Linux, use the following command,

sudo ip addr show enp0s3
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:45:4e:87 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 85650sec preferred_lft 85650sec
    inet6 fe80::a00:27ff:fe45:4e87/64 scope link 
       valid_lft forever preferred_lft forever

Here enp0s3 is the network interface that I want to see the address of.

The output shows that, enp0s3 has an ipv4 address of 10.0.2.15 and an ipv6 address of fe80::a00:27ff:fe45:4e87



Find the IP Addresses of the Available Network Interfaces of your Linux System

To find the ip addresses of the available network interfaces on Linux, use the following command,

sudo ip addr show
1: lo:  mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s3:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:45:4e:87 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.15/24 brd 10.0.2.255 scope global dynamic enp0s3
       valid_lft 86403sec preferred_lft 86403sec
    inet6 fe80::a00:27ff:fe45:4e87/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0:  mtu 1500 qdisc noqueue state DOWN 
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic:  mtu 1500 qdisc pfifo_fast state DOWN qlen 500
    link/ether 52:54:00:bb:2e:64 brd ff:ff:ff:ff:ff:ff

You can see that, the result shows the network interfaces with numbers 1,2,3,4 and so on. I have 4 network interfaces on my Linux system.

You can see lines that start with inet or inet6. These lines represent ipv4 and ipv6 addresses respectively.

The first network interface which is a loopback interface has an ipv4 address of 127.0.0.1 and an ipv6 address of ::1

The second network interface enp0s3 has an ipv4 address of 10.0.2.15 and an ipv6 address of fe80::a00:27ff:fe45:4e87

The third network interface virbr0 has an ipv4 address of 192.168.122.1. It doesn't have an ipv6 address set.

The fourth network interface virbr0-nic doesn't have any ip address set at the moment.