hwclock
Wed 18 Oct 2017 07:24:51 PM EEST -1.042307 seconds
timedatectl
Control the system time and date
123456789101112131415
timedatectl
Local time: Wed 2017-10-18 17:26:49 EEST
Universal time: Wed 2017-10-18 14:26:49 UTC
RTC time: Wed 2017-10-18 17:26:49
Time zone: Europe/Bucharest (EEST, +0300)
NTP enabled: no
NTP synchronized: no
RTC in local TZ: no
DST active: yes
Last DST change: DST began at
Sun 2017-03-26 02:59:59 EET
Sun 2017-03-26 04:00:00 EEST
Next DST change: DST ends (the clock jumps one hour backwards) at
Sun 2017-10-29 03:59:59 EEST
Sun 2017-10-29 03:00:00 EET
date
print or set the system date and time
12
[root@tron ~]# date
Tue Sep 19 12:40:58 EEST 2017
get the date of a relative point in time
1234
date -d "50 days"
Wed Nov 8 11:42:08 EET 2017
date -d "50 days ago"
Mon Jul 31 12:43:24 EEST 2017
ifconfig
configure a network interface
ifconfig up / down – activate / deactivate interface
show / manipulate routing, devices, policy routing and tunnels
show information about all interfaces
12345678910111213141516171819
ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN qlen 1
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: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:47:d7:a8 brd ff:ff:ff:ff:ff:ff
inet 192.168.241.130/24 brd 192.168.241.255 scope global dynamic enp0s3
valid_lft 1665sec preferred_lft 1665sec
inet6 fe80::d7e8:7b48:831f:a1de/64 scope link
valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN qlen 1000
link/ether 52:54:00:e8:ed:ae 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: <BROADCAST,MULTICAST> mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 1000
link/ether 52:54:00:e8:ed:ae brd ff:ff:ff:ff:ff:ff
show routing table
1234
ip r
default via 192.168.241.2 dev enp0s3 proto static metric 100
192.168.122.0/24 dev virbr0 proto kernel scope link src 192.168.122.1
192.168.241.0/24 dev enp0s3 proto kernel scope link src 192.168.241.130 metric 100
show network interface statistics
1234567
ip -s link show enp0s3
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
link/ether 00:0c:29:47:d7:a8 brd ff:ff:ff:ff:ff:ff
RX: bytes packets errors dropped overrun mcast
26927 137 0 0 0 0
TX: bytes packets errors dropped carrier collsns
112697 201 0 0 0 0
hostnamectl
Control the system hostname
1234567891011
hostnamectl
Static hostname: tron
Icon name: computer-vm
Chassis: vm
Machine ID: bae5d656813c4d17a18bc5ac0a89cfc2
Boot ID: b0bbeef032cf4f6b9f4f764f9a043cb5
Virtualization: vmware
Operating System: Red Hat Enterprise Linux
CPE OS Name: cpe:/o:redhat:enterprise_linux:7.3:GA:server
Kernel: Linux 3.10.0-514.26.2.el7.x86_64
Architecture: x86-64
To make hostname changes permanent, modify the content of /etc/hostname. You can set it with hostnamectl set-hostname name
nmcli
command-line tool for controlling NetworkManager
1234567891011121314151617
nmcli -p
virbr0: connected to virbr0
bridge, 52:54:00:E8:ED:AE, sw, mtu 1500
inet4 192.168.122.1/24
enp0s3: connected to Wired connection 1
"Intel 82545EM Gigabit Ethernet Controller (Copper) (PRO/1000 MT Single Port Adapter)"
ethernet (e1000), 00:0C:29:47:D7:A8, hw, mtu 1500
ip4 default
inet4 192.168.241.130/24
inet6 fe80::d7e8:7b48:831f:a1de/64
lo: unmanaged
loopback (unknown), 00:00:00:00:00:00, sw, mtu 65536
virbr0-nic: unmanaged
tun, 52:54:00:E8:ED:AE, sw, mtu 1500
netstat -s
Ip:
190 total packets received
0 forwarded
0 incoming packets discarded
180 incoming packets delivered
216 requests sent out
65 dropped because of missing route
Icmp:
3 ICMP messages received
0 input ICMP message failed.
ICMP input histogram:
timeout in transit: 2
echo requests: 1
1 ICMP messages sent
0 ICMP messages failed
ICMP output histogram:
echo replies: 1
IcmpMsg:
InType8: 1
InType11: 2
OutType0: 1
Tcp:
34 active connections openings
0 passive connection openings
34 failed connection attempts
0 connection resets received
0 connections established
68 segments received
68 segments send out
0 segments retransmited
0 bad segments received.
34 resets sent
Udp:
104 packets received
0 packets to unknown port received.
0 packet receive errors
143 packets sent
0 receive buffer errors
0 send buffer errors
UdpLite:
TcpExt:
0 packet headers predicted
IpExt:
InNoRoutes: 3
InMcastPkts: 18
OutMcastPkts: 26
InBcastPkts: 12
InOctets: 31730
OutOctets: 105262
InMcastOctets: 4252
OutMcastOctets: 5054
InBcastOctets: 4212
InNoECTPkts: 190
ss
another utility to investigate sockets
show statistics
1234567891011
ss -s
Total: 1114 (kernel 1133)
TCP: 0 (estab 0, closed 0, orphaned 0, synrecv 0, timewait 0/0), ports 0
Transport Total IP IPv6
* 1133 - -
RAW 1 0 1
UDP 1 1 0
TCP 0 0 0
INET 2 1 1
FRAG 0 0 0
show all TCP sockets
123
ss -t -a
State Recv-Q Send-Q Local Address:Port Peer Address:Port
ESTAB 0 0 192.168.217.132:40382 87.243.6.137:http
12345678910
_______________________________________
/ Q: Why did the programmer call his \
| mother long distance? A: Because that |
\ was her name. /
---------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||