Access the Linux shell by using a virtual console or terminal application, and learn commands to gather information about a Linux system.
Outcomes
Log in to a Linux shell.
Use non-interactive commands to view information about a Linux system.
Modify a user's password.
As the student user on the workstation machine, open a terminal.
You can open a terminal by clicking and then .
On the command line, use the following lab command to prepare your system for this exercise, and to ensure that all required resources are available.
[student@workstation ~]$ lab start access-cli
Instructions
View information about your login session:
[student@workstation ~]$ who
student pts/0 2023-09-27 22:01 (172.25.250.254)View the current date, time, and time zone:
[student@workstation ~]$ timedatectl
Local time: Wed 2023-09-27 22:01:46 EDT
Universal time: Thu 2023-09-28 02:01:46 UTC
RTC time: Thu 2023-09-28 02:01:46
Time zone: America/New_York (EDT, -0400)
System clock synchronized: yes
NTP service: active
RTC in local TZ: noView the machine name:
[student@workstation ~]$ hostname
workstation.lab.example.comReview the information about the operating system, kernel, and hardware.
Use the tab completion feature to run the hostnamectl command.
Type hostn and then press Tab.
The shell completes the hostname command, but this is not the intended command.
Review the suggestions by pressing Tab twice, type c, and press Tab again.
Then run the command.
[student@workstation ~]$hostn[student@workstation ~]$ hostnameTabhostname hostnamectl [student@workstation ~]$ hostnameTab+Tabc[student@workstation ~]$TabhostnamectlStatic hostname: workstation.lab.example.com Icon name: computer-vm Chassis: vm Machine ID: 633680e38e32491899fbd3a7f6129842 Boot ID: f97b2fbc043a4de7803a4e8b46d3ac33 Virtualization: kvm Operating System: Red Hat Enterprise Linux 9.0 (Plow) CPE OS Name: cpe:/o:redhat:enterprise_linux:9::baseos Kernel: Linux 5.14.0-70.13.1.el9_0.x86_64 Architecture: x86-64 Hardware Vendor: Red Hat Hardware Model: OpenStack Compute
Most of this information is the same as the information shown in the section of the GNOME control panel.
On the third virtual console, log in as the operator2 user and use redhat as the password.
Update the user's password to rh104.cli.
Switch to the third virtual console by pressing Alt+Ctrl+F3.
Log in as the operator2 user and use redhat as the password.
Review the passwd command help.
The --help (or -h) option prints information about the command itself, including the options you can use to alter the command's outcome.
[operator2@workstation ~]$ passwd --help
Usage: passwd [OPTION...] <accountName>
-k, --keep-tokens keep non-expired authentication tokens
-d, --delete delete the password for the named account (root only); also removes password lock if any
-l, --lock lock the password for the named account (root only)
-u, --unlock unlock the password for the named account (root only)
...output omitted...Update the operator2 user password to rh104.cli.
[operator2@workstation ~]$passwdChanging password for user operator2. Current password:redhatNew password:rh104.cliRetype new password:rh104.clipasswd: all authentication tokens updated successfully.
Test the new password by closing the session and logging back in.
[operator2@workstation ~]$exitworkstation login:operator2Password:rh104.cli[operator2@workstation ~]$
Close the virtual console session and return to the desktop session.
Close the virtual console session.
[operator2@workstation ~]$ exitReturn to the desktop session by pressing Alt+Ctrl+F2.
$ Alt+Ctrl+F2