System information, root recovery, environment variables, shortcuts/shaare/cNgv6w
Finding System Information
cat /etc/redhat-release
→ Red Hat versionuname -a
→ Linux hostname, kernel, architecturedmidecode
→ hardware, BIOS, system infoarch
→ x86_64 or i386/32-bit
Common Keyboard Shortcuts
Ctrl + U
→ erase command lineCtrl + C
→ stop/kill current commandCtrl + Z
→ suspend commandCtrl + D
→ exit interactive session
Record Terminal Session
-
script mylog.log
→ record shell session- Use
exit
to stop recording
- Use
Root Password Recovery
- Reboot → enter GRUB menu
- Press
e
→ edit boot params - Add
rd.break
at end of kernel line Ctrl + X
to boot- Mount root with
chroot /sysroot
passwd root
→ change passwordtouch /.autorelabel
→ SELinux relabeling on reboot
View Environment Variables
printenv
,echo $PATH
,echo $SHELL
Set Environment Variables
- Temporary:
export TEST=1
,echo $TEST
-
Permanent:
vi ~/.bashrc TEST=123 export TEST
Global → vi /etc/profile or /etc/bashrc