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
exitto stop recording
- Use
Root Password Recovery
- Reboot → enter GRUB menu
- Press
e→ edit boot params - Add
rd.breakat end of kernel line Ctrl + Xto 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
(19)