stat

You can check status of file with stat commands. This provide more details of file than ls -l  output. Like this:-

[root@urclouds log]# stat messages
File: ‘messages’
Size: 230290 Blocks: 456 IO Block: 4096 regular file
Device: fd00h/64768d Inode: 67304224 Links: 1
Access: (0600/-rw-------) Uid: ( 0/ root) Gid: ( 0/ root)
Context: system_u:object_r:var_log_t:s0
Access: 2018-05-11 18:28:51.913735092 +0200
Modify: 2018-05-11 19:01:01.566620076 +0200
Change: 2018-05-11 19:01:01.566620076 +0200
Birth: -
[root@urclouds log]#

cal

You can use cal command to display calendar of current month. Like this:-

[root@urclouds log]# cal
May 2018
Su Mo Tu We Th Fr Sa
1    2     3   4      5
6   7     8    9   10  11    12
13 14   15  16   17  18   19
20 21  22  23  24  25  26
27 28  29  30  31

[root@urclouds log]#

You can also display calendar of any month. Like this:-

[root@urclouds log]# cal 07 1982
July 1982
Su Mo Tu We Th Fr Sa
1   2   3
4    5     6    7     8   9  10
11 12   13  14   15  16  17
18 19  20 21   22  23 24
25 26 27 28   29  30 31

[root@urclouds log]#

echo

You can use echo command to print some test. Like this:-

[root@urclouds ~]# echo "urclouds.com"
urclouds.com
[root@urclouds ~]#

The ‘echo’ command is also used to display the values of  a variable. One such variable is ‘HOME’ To check the value of a variable precede the variable with a $ sign.

[root@urclouds ~]# echo $HOME
/root
[root@urclouds ~]#

date

You can use date command to display current date, you can also use date command to set the date. Like this:-

[root@urclouds ~]# date
Fri May 11 19:36:24 CEST 2018
[root@urclouds ~]# date 0511181838
Tue May 11 18:18:00 CEST 2038
[root@urclouds ~]# date
Tue May 11 18:18:05 CEST 2038
[root@urclouds ~]#

timedatectl

You can check date and time zone with timedatectl commands.

[root@urclouds ~]# timedatectl
Local time: Sat 2018-05-12 15:41:00 CEST
Universal time: Sat 2018-05-12 13:41:00 UTC
RTC time: Sat 2018-05-12 13:41:00
Time zone: Europe/Brussels (CEST, +0200)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2018-03-25 01:59:59 CET
Sun 2018-03-25 03:00:00 CEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2018-10-28 02:59:59 CEST
Sun 2018-10-28 02:00:00 CET
[root@urclouds ~]#

tty

This command use to display current terminal. Like this:-

[root@urclouds ~]# tty
/dev/pts/0
[root@urclouds ~]#

whoami

This command use to find out current logged user. Like this:-

[root@urclouds ~]# whoami
root
[root@urclouds ~]#

ifconfig

You can check network interface details with ifconfig -a commands. Its provide details of all interfaces. Like this:-

[root@urclouds ~]# ifconfig -a
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.95 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::a00:27ff:fe00:5dc6 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:00:5d:c6 txqueuelen 1000 (Ethernet)
RX packets 150 bytes 14040 (13.7 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 97 bytes 12223 (11.9 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 base 0xd020

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 12 bytes 1404 (1.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 1404 (1.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:d3:32:d2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

virbr0-nic: flags=4098<BROADCAST,MULTICAST> mtu 1500
ether 52:54:00:d3:32:d2 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

[root@urclouds ~]#

ifconfig interface-name

You can display only one interface if you want to display only one interface details with ifconfig interface name command. Like this:-

[root@urclouds ~]# ifconfig enp0s3
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.43.95 netmask 255.255.255.0 broadcast 192.168.43.255
inet6 fe80::a00:27ff:fe00:5dc6 prefixlen 64 scopeid 0x20<link>
ether 08:00:27:00:5d:c6 txqueuelen 1000 (Ethernet)
RX packets 253 bytes 21766 (21.2 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 140 bytes 16785 (16.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device interrupt 19 base 0xd020

[root@urclouds ~]#

nmtui

You can configure network on your server interface with nmtui commands when you type this command in you server as root user, there is one GUI windows will be open then you can select Edit to connection to configure network interface.

[root@urclouds ~]# nmtui
[root@urclouds ~]#

netstat -lnpt |grep (ports-number)

You can check open ports on your system with netstat commands. if ports are currently open on your system then you will get like this massage other wise you will not get any massage. Below this commands output means currently 22 port is open on my server, and 80 port is not open on my server.

For more details about netstat command you can Click-Here

[root@urclouds ~]# netstat -lnpt |grep 80
[root@urclouds ~]# netstat -lnpt |grep 22
tcp 0 0 192.168.122.1:53 0.0.0.0:* LISTEN 1344/dnsmasq
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 939/sshd
tcp6 0 0 :::22 :::* LISTEN 939/sshd
[root@urclouds ~]# netstat -lnpt |grep 80
[root@urclouds ~]#

route -n

You can check routing table with route -n commands where you can find default gateway or static gateway of your server.

test@urclouds:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 172.21.144.1 0.0.0.0 UG 100 0 0 brq31483d3c-ae
172.21.144.0 0.0.0.0 255.255.255.0 U 0 0 0 brq31483d3c-ae
172.21.149.0 0.0.0.0 255.255.255.0 U 0 0 0 em2
192.168.122.0 0.0.0.0 255.255.255.0 U 0 0 0 virbr0
test@urclouds:~$

How to find un comments line in Linux file

test@urclouds:~$ egrep -v "^#|^$" /etc/fstab
/dev/mapper/urclouds--vg-root / ext4 errors=remount-ro 0 1
UUID=3ba03e9d-7ce4-4f10-ae2b-9d92b44e26d4 /boot ext2 defaults 0 2
/dev/mapper/urclouds--vg-swap_1 none swap sw 0 0
test@urclouds:~$

How to attach created volume in OpenStack VM?

Exp:-

openstack server add volume <VM-name> <volume-name> –device /dev/sdb

openstack server add volume test-vm2 test-volume2 –device /dev/vdb

How to detach volume from OpenStack VM?

Exp: –

openstack server remove volume <VM-name> <volume-name>

openstack server remove volume coetest-vm2 test-volume