Rhcsa Linux is used for the first time for simple operation

1. Modify the host name; View host name:

[root@ccw ~]# hostname -i
fe80::6917:8a7b:dcb7:d4db%ens160 192.168.186.128 192.168.122.1
[root@ccw ~]# hostnamectl set-hostname ctt
[root@ccw ~]# su -
[root@ctt ~]#

First, enter hostname -i and wait for a period of time. The following IP will appear: fe80::6917:8a7b:dcb7:d4db%ens160 192.168.186.128 192.168.122.1
Then we enter: hostnamectl set hostname + the host name we want to modify. After we modify it, it will not display the host name we have modified. We need to shut down and restart to display the host name we have changed

 

Command for shutdown and restart:

reboot

poweroff

halt

Shutdown: shutdown using time node

-H, --halt          
             Halt the machine.
​-P, --poweroff          
             Power-off the machine (the default).
-r, --reboot           
              Reboot the machine.​

2. View date:

Requirement: use fixed format to output date YY MM DD HH: mm: SS

We can enter date to find the current date   Week year time (time can be accurate to seconds)

[root@ccw ~]# date
Fri Nov  5 22:05:19 CST 2021

The date command is used to display or set the system time and date. The syntax format is: "date [+ specified format]".
So we can edit our time according to the table below

The following is the time we need to output according to the format. Here I expand it by adding the number of days in the week, quarter and AM/PM.

[root@ccw ~]# Date "+% Y -% m -% d% H:% m:% s% a, quarter% q, day% j,% p"
2021-11-05 22:15:45 Friday,Q4,Day 309,PM

3. Next, we will use Xshell to output   "We are learning RHCSA"

Xshell has several ways to output statements:

[root@ccw ~]# echo We are learning RHCSA
We are learning RHCSA
[root@ccw ~]# echo "We are learning RHCSA"
We are learning RHCSA
[root@ccw ~]# printf "We are learning RHCSA"
We are learning RHCSA[root@ccw ~]# printf "We are learning RHCSA\n"
We are learning RHCSA
[root@ccw ~]# echo -n "We are learning RHCSA"
We are learning RHCSA[root@ccw ~]# 

We can see from the above program that we can use echo and printf to output statements, but the difference is that echo can automatically wrap lines after the statement is output, while printf cannot. However, we can add line wrap after the statement like editing C language, and echo -n can prevent the statement from wrapping lines automatically, To learn more about how to use echo, you can enter man echo to find more ways to use it.

4. Use timedatectl to view the time status
         List all known time zones
         Modify the time zone to one of the listed time zones

[root@ccw ~]# timedatectl status
               Local time: Fri 2021-11-05 22:35:17 CST
           Universal time: Fri 2021-11-05 14:35:17 UTC
                 RTC time: Fri 2021-11-05 14:35:17
                Time zone: Asia/Shanghai (CST, +0800)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no
[root@ccw ~]# timedatectl list-timezones
Africa/Abidjan
Africa/Accra
Africa/Addis_Ababa
Africa/Algiers
Africa/Asmara
Africa/Bamako
Africa/Bangui
Africa/Banjul
Africa/Bissau
Africa/Blantyre
Africa/Brazzaville
Africa/Bujumbura
Africa/Cairo
Africa/Casablanca
Africa/Ceuta
Africa/Conakry
Africa/Dakar
Africa/Dar_es_Salaam
Africa/Djibouti
Africa/Douala
Africa/El_Aaiun
Africa/Freetown
Africa/Gaborone
Africa/Harare
Africa/Johannesburg
Africa/Juba
Africa/Kampala
Africa/Khartoum
Africa/Kigali
Africa/Kinshasa
Africa/Lagos
Africa/Libreville
Africa/Lome
Africa/Luanda
Africa/Lubumbashi
Africa/Lusaka
Africa/Malabo
Africa/Maputo
Africa/Maseru
Africa/Mbabane
Africa/Mogadishu
Africa/Monrovia
Africa/Nairobi
Africa/Ndjamena
Africa/Niamey
Africa/Nouakchott
Africa/Ouagadougou
Africa/Porto-Novo
Africa/Sao_Tome
Africa/Tripoli
Africa/Tunis
Africa/Windhoek
America/Adak
America/Anchorage
America/Anguilla
America/Antigua
America/Araguaina
America/Argentina/Buenos_Aires
America/Argentina/Catamarca
America/Argentina/Cordoba
America/Argentina/Jujuy
America/Argentina/La_Rioja
America/Argentina/Mendoza
America/Argentina/Rio_Gallegos
America/Argentina/Salta
America/Argentina/San_Juan
America/Argentina/San_Luis
America/Argentina/Tucuman
America/Argentina/Ushuaia
America/Aruba
America/Asuncion
America/Atikokan
America/Bahia
America/Bahia_Banderas
America/Barbados
America/Belem
America/Belize
America/Blanc-Sablon
America/Boa_Vista
America/Bogota
America/Boise
America/Cambridge_Bay
America/Campo_Grande
America/Cancun
America/Caracas
America/Cayenne
America/Cayman
America/Chicago
America/Chihuahua
America/Costa_Rica
America/Creston
America/Cuiaba
America/Curacao
America/Danmarkshavn
America/Dawson
America/Dawson_Creek
America/Denver
America/Detroit
America/Dominica
America/Edmonton
America/Eirunepe
America/El_Salvador
America/Fort_Nelson
America/Fortaleza
America/Glace_Bay
America/Godthab
America/Goose_Bay
America/Grand_Turk
America/Grenada
America/Guadeloupe
America/Guatemala
America/Guayaquil
America/Guyana
America/Halifax
America/Havana
America/Hermosillo
America/Indiana/Indianapolis
America/Indiana/Knox
America/Indiana/Marengo
America/Indiana/Petersburg
America/Indiana/Tell_City
America/Indiana/Vevay
America/Indiana/Vincennes
America/Indiana/Winamac
America/Inuvik
America/Iqaluit
America/Jamaica
America/Juneau
America/Kentucky/Louisville
America/Kentucky/Monticello
America/Kralendijk
America/La_Paz
America/Lima
America/Los_Angeles
America/Lower_Princes
America/Maceio
America/Managua
America/Manaus
America/Marigot
America/Martinique
America/Matamoros
America/Mazatlan
America/Menominee
America/Merida
America/Metlakatla
America/Mexico_City
America/Miquelon
America/Moncton
America/Monterrey
America/Montevideo
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
America/North_Dakota/Beulah
America/North_Dakota/Center
America/North_Dakota/New_Salem
America/Ojinaga
America/Panama
America/Pangnirtung
America/Paramaribo
America/Phoenix
America/Port-au-Prince
America/Port_of_Spain
America/Porto_Velho
America/Puerto_Rico
America/Punta_Arenas
America/Rainy_River
America/Rankin_Inlet
America/Recife
America/Regina
America/Resolute
America/Rio_Branco
America/Santarem
America/Santiago
America/Santo_Domingo
America/Sao_Paulo
America/Scoresbysund
America/Sitka
America/St_Barthelemy
America/St_Johns
America/St_Kitts
America/St_Lucia
America/St_Thomas
America/St_Vincent
America/Swift_Current
America/Tegucigalpa
America/Thule
America/Thunder_Bay
America/Tijuana
America/Toronto
America/Tortola
America/Vancouver
America/Whitehorse
America/Winnipeg
America/Yakutat
America/Yellowknife
Antarctica/Casey
Antarctica/Davis
Antarctica/DumontDUrville
Antarctica/Macquarie
Antarctica/Mawson
Antarctica/McMurdo
Antarctica/Palmer
Antarctica/Rothera
Antarctica/Syowa
Antarctica/Troll
Antarctica/Vostok
Arctic/Longyearbyen
Asia/Aden
Asia/Almaty
Asia/Amman
Asia/Anadyr
Asia/Aqtau
Asia/Aqtobe
Asia/Ashgabat
Asia/Atyrau
Asia/Baghdad
Asia/Bahrain
Asia/Baku
Asia/Bangkok
Asia/Barnaul
Asia/Beirut
Asia/Bishkek
Asia/Brunei
Asia/Chita
Asia/Choibalsan
Asia/Colombo
Asia/Damascus
Asia/Dhaka
Asia/Dili
Asia/Dubai
Asia/Dushanbe
Asia/Famagusta
Asia/Gaza
Asia/Hebron
Asia/Ho_Chi_Minh
Asia/Hong_Kong
Asia/Hovd
Asia/Irkutsk
Asia/Jakarta
Asia/Jayapura
Asia/Jerusalem
Asia/Kabul
Asia/Kamchatka
Asia/Karachi
Asia/Kathmandu
Asia/Khandyga
Asia/Kolkata
Asia/Krasnoyarsk
Asia/Kuala_Lumpur
Asia/Kuching
Asia/Kuwait
Asia/Macau
Asia/Magadan
Asia/Makassar
Asia/Manila
Asia/Muscat
Asia/Nicosia
Asia/Novokuznetsk
Asia/Novosibirsk
Asia/Omsk
Asia/Oral
Asia/Phnom_Penh
Asia/Pontianak
Asia/Pyongyang
Asia/Qatar
Asia/Qostanay
Asia/Qyzylorda
Asia/Riyadh
Asia/Sakhalin
Asia/Samarkand
Asia/Seoul
Asia/Shanghai
Asia/Singapore
Asia/Srednekolymsk
Asia/Taipei
Asia/Tashkent
Asia/Tbilisi
Asia/Tehran
Asia/Thimphu
Asia/Tokyo
Asia/Tomsk
Asia/Ulaanbaatar
Asia/Urumqi
Asia/Ust-Nera
Asia/Vientiane
Asia/Vladivostok
Asia/Yakutsk
Asia/Yangon
Asia/Yekaterinburg
Asia/Yerevan
Atlantic/Azores
Atlantic/Bermuda
Atlantic/Canary
Atlantic/Cape_Verde
Atlantic/Faroe
Atlantic/Madeira
Atlantic/Reykjavik
Atlantic/South_Georgia
Atlantic/St_Helena
Atlantic/Stanley
Australia/Adelaide
Australia/Brisbane
Australia/Broken_Hill
Australia/Currie
Australia/Darwin
Australia/Eucla
Australia/Hobart
Australia/Lindeman
Australia/Lord_Howe
Australia/Melbourne
Australia/Perth
Australia/Sydney
Europe/Amsterdam
Europe/Andorra
Europe/Astrakhan
Europe/Athens
Europe/Belgrade
Europe/Berlin
Europe/Bratislava
Europe/Brussels
Europe/Bucharest
Europe/Budapest
Europe/Busingen
Europe/Chisinau
Europe/Copenhagen
Europe/Dublin
Europe/Gibraltar
Europe/Guernsey
Europe/Helsinki
Europe/Isle_of_Man
Europe/Istanbul
Europe/Jersey
Europe/Kaliningrad
Europe/Kiev
Europe/Kirov
Europe/Lisbon
Europe/Ljubljana
Europe/London
Europe/Luxembourg
Europe/Madrid
Europe/Malta
Europe/Mariehamn
Europe/Minsk
Europe/Monaco
Europe/Moscow
Europe/Oslo
Europe/Paris
Europe/Podgorica
Europe/Prague
Europe/Riga
Europe/Rome
Europe/Samara
Europe/San_Marino
Europe/Sarajevo
Europe/Saratov
Europe/Simferopol
Europe/Skopje
Europe/Sofia
Europe/Stockholm
Europe/Tallinn
Europe/Tirane
Europe/Ulyanovsk
Europe/Uzhgorod
Europe/Vaduz
Europe/Vatican
Europe/Vienna
Europe/Vilnius
Europe/Volgograd
Europe/Warsaw
Europe/Zagreb
Europe/Zaporozhye
Europe/Zurich
Indian/Antananarivo
Indian/Chagos
Indian/Christmas
Indian/Cocos
Indian/Comoro
Indian/Kerguelen
Indian/Mahe
Indian/Maldives
Indian/Mauritius
Indian/Mayotte
Indian/Reunion
Pacific/Apia
Pacific/Auckland
Pacific/Bougainville
Pacific/Chatham
Pacific/Chuuk
Pacific/Easter
Pacific/Efate
Pacific/Enderbury
Pacific/Fakaofo
Pacific/Fiji
Pacific/Funafuti
Pacific/Galapagos
Pacific/Gambier
Pacific/Guadalcanal
Pacific/Guam
Pacific/Honolulu
Pacific/Kiritimati
Pacific/Kosrae
Pacific/Kwajalein
Pacific/Majuro
Pacific/Marquesas
Pacific/Midway
Pacific/Nauru
Pacific/Niue
Pacific/Norfolk
Pacific/Noumea
Pacific/Pago_Pago
Pacific/Palau
Pacific/Pitcairn
Pacific/Pohnpei
Pacific/Port_Moresby
Pacific/Rarotonga
Pacific/Saipan
Pacific/Tahiti
Pacific/Tarawa
Pacific/Tongatapu
Pacific/Wake
Pacific/Wallis
UTC

The above content is that we entered timedatectl status to find the display status of the current time zone. We found the time zone of Asia\Shanghai. Then we entered timedatectl list timezones to find all the time zones. Then we entered timedatectl set timezone Asia/Aden to change the time zone to Asia/Aden, and then we entered timedatectl status, We found that our time zone changed to Asia/Aden.

[root@ccw ~]# timedatectl set-timezone Asia/Aden
[root@ccw ~]# timedatectl status
               Local time: Fri 2021-11-05 17:39:41 +03
           Universal time: Fri 2021-11-05 14:39:41 UTC
                 RTC time: Fri 2021-11-05 14:39:41
                Time zone: Asia/Aden (+03, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

If the time is still incorrect, we can manually modify the system date:

[root@ccw ~]# timedatectl set-time 2021-11-05

If you want to modify the time, it is also very simple:

[root@ccw ~]# timedatectl set-time 22:50
[root@ccw ~]# date
Fri Nov  5 22:50:25 CST 2021

5. Use the wget command to https://www.pearvideo.com/ Download any video from this website
We can enter WGet www.pearlvideo.com to operate.

wget command is used to download network files in the terminal command line. Its English full name is "web get", and its syntax format is "wget [parameter] website". You can download files directly from the command interface without opening the browser.

[root@ccw ~]# wget www.pearvideo.com
--2021-11-05 22:52:33--  http://www.pearvideo.com/
Resolving www.pearvideo.com (www.pearvideo.com)... 203.107.47.49
Connecting to www.pearvideo.com (www.pearvideo.com)|203.107.47.49|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://www.pearvideo.com [following]
--2021-11-05 22:52:38--  https://www.pearvideo.com/
Connecting to www.pearvideo.com (www.pearvideo.com)|203.107.47.49|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: 'index.html.1'

index.html.1           [         <=>    ]  84.44K  27.5KB/s    in 3.1s    

2021-11-05 22:52:41 (27.5 KB/s) - 'index.html.1' saved [86471]

[root@ccw ~]# ls
anaconda-ks.cfg  Downloads     initial-setup-ks.cfg  Public
Desktop          index.html    Music                 Templates
Documents        index.html.1  Pictures              Videos

Then we operate according to the following figure

 

  After we transfer it to the desktop, we need to change the suffix html.1 to html, otherwise we will open the web page source code, and then click to enter the web page

  6. View ip commands (multiple)

  We can use #ifconfig and #ip a to find IP addresses.

#A notable feature between IP a and #ifconfig is that ifconfig only displays enabled interfaces, and IP displays whether all interfaces are enabled or disabled

[root@ccw ~]# ifconfig
ens160: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.186.128  netmask 255.255.255.0  broadcast 192.168.186.255
        inet6 fe80::6917:8a7b:dcb7:d4db  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:ad:78:c8  txqueuelen 1000  (Ethernet)
        RX packets 3307  bytes 464808 (453.9 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1718  bytes 279525 (272.9 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

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 1000  (Local Loopback)
        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: 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:1f:36:0a  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@ccw ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    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: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
    link/ether 00:0c:29:ad:78:c8 brd ff:ff:ff:ff:ff:ff
    inet 192.168.186.128/24 brd 192.168.186.255 scope global dynamic noprefixroute ens160
       valid_lft 1525sec preferred_lft 1525sec
    inet6 fe80::6917:8a7b:dcb7:d4db/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:1f:36:0a 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 fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:1f:36:0a brd ff:ff:ff:ff:ff:ff

Tags: Linux

Posted on Fri, 05 Nov 2021 13:37:18 -0400 by jsantama