ls /var/ | xargs | sed 's/ /,/g'
sed -e '/option=/{s/.*/option=value/;:a;n;:ba;q}' -e 'aoption=value' /dir/filename
find / -printf "%h\n" | cut -d/ -f-2 | sort | uniq -c | sort -rn
ls, ls (hd0,gptX)
set root=(hd0,gptX)
linux /vmlinux-(some-version-of-kernel) root=/dev/sdX ro
initrd /initrd-(some-version-of-kernel)
boot
iscsiadm -m discovery -t st -p <iSCSI IP address>:<iSCSI port>
iscsiadm -m node -T <volume IQN> -p <iSCSI IP address>:<iSCSI port> -o update -n node.session.auth.authmethod -v CHAP
iscsiadm -m node -T <volume IQN> -p <iSCSI IP address>:<iSCSI port> -o update -n node.session.auth.username -v <CHAP user name>
iscsiadm -m node -T <volume's IQN> -p <iSCSI IP address>:<iSCSI port> -o update -n node.session.auth.password -v <CHAP password>
iscsiadm -m node -T <volume's IQN> -p <iSCSI IP Address>:<iSCSI port> -l
iscsiadm -m node –l
iscsiadm -m node -T <target_iqn> -p <iSCSI IP address>:<iSCSI port> -u
iscsiadm -m node -T <target_iqn> -p <iSCSI IP address>:<iSCSI port>
swapoff /dev/vg_system/swap
lvresize /dev/vg_system/swap -L +2G
mkswap /dev/vg_system/swap
swapon -a
mkswap /dev/sdb
swapon -a
/dev/sdb none swap defaults 0 0
ls -d /root/folder/ | xargs -n1 -P10 -I{} rsync -Pa {} dest.server:/folder/
ls -d /root/folder/ | xargs -n1 -P10 -I{} scp -r {} dest.server:/folder/
tar -czf - /manyfiles | ssh dest.server 'tar -xzf - -C /manyfiles'
du -sh * | sort -rh | head -n10
lsof | grep deleted
cd /proc/<PID>/fd
ls -l | grep deleted
> 1
free -m
swapoff -a
swapon -a
dnf -y install tigervnc-server xinetd
sed -i 's/\[xdmcp\]/&\nEnable=true/' /etc/gdm/custom.conf
cat << EOF > /etc/xinetd.d/vncserver
service vncserver
{
disable = no
socket_type = stream
protocol = tcp
group = tty
wait = no
user = nobody
server = /usr/bin/Xvnc
server_args = -inetd -query localhost -geometry 1024x768 -depth 32 -once -securitytypes=none
}
EOF
echo -e 'vncserver\t5900/tcp\t\t# VNC xinet GDM base' >> /etc/services
firewall-cmd --add-service=vnc-server --permanent && firewall-cmd --reload
systemctl restart gdm.service
systemctl enable --now xinetd.service
cat /proc/mdstat
mdadm /dev/md0 --fail /dev/sdc
mdadm /dev/md0 --remove /dev/sdc
fdisk -l
sfdisk -d /dev/sdb | sfdisk /dev/sdc
mdadm --add /dev/md0 /dev/sdc
watch cat /proc/mdstat
# vgrename system_old system
# lvrename /dev/system_old/root_old /dev/system/root
# vim /etc/fstab
/dev/mapper/system-root / xfs defaults 1 1
/dev/mapper/system-swap none swap defaults 0 0
# vim /etc/default/grub
GRUB_CMDLINE_LINUX="crashkernel=auto resume=/dev/mapper/system-swap rd.lvm.lv=system/root rd.lvm.lv=system/swap rhgb quiet"
# vgchange -ay
# lvchange /dev/system/root --refresh
# lvchange /dev/system/swap --refresh
# for i in $(ls /boot/initramfs-*.img); do cp $i $i.bak; done
# dracut -v -f --regenerate-all
# cp /boot/grub2/grub.cfg /boot/grub2/grub.cfg.bak
# grub2-mkconfig -o /boot/grub2/grub.cfg
# cp /boot/efi/EFI/redhat/grub.cfg /boot/efi/EFI/redhat/grub.cfg.bak
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
/usr/sbin/grub2-probe: error: failed to get canonical path of ‘/dev/mapper/ system-root’.
# chroot /mnt/sysimage
# grub2-mkconfig -o /boot/grub2/grub.cfg
# chroot /mnt/sysimage
# grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
- Press
e
on grub screen - Append
rd.break
to end of linux line and pressctrl-x
mount -o remount,rw /sysroot/
chroot /sysroot/
passwd
touch /.autorelabel
1. First boot the system into Rescue Mode from the media. For best results use media that matches the version and service pack of the system.
# mount /dev/<device name> /mnt
If it's not known where the root file system is, it needs to be guessed until found by mounting each possibility and checking its contents. Run the following command to list all available partitions:
# cat /proc/partitions
List all available logical volumes with this command:
# lvdisplay
After mounting each one check its contents by listing the mounted directory. For example if mounted to /mnt run:
# ls /mnt
Some directories that should be listed to verify it is a root file system are /root /boot and /home.
# for i in proc sys dev; do mount --rbind /$i /mnt/$i ; done
Alternatively, mount them each separately rather than using the for-loop:
# mount --rbind /proc /mnt/proc
# mount --rbind /sys /mnt/sys
# mount --rbind /dev /mnt/dev
# chroot /mnt
After chrooted in it is a best-practice to run this command to make sure all other necessary partitions are also mounted:
# mount -a