Notepad:Linux: Difference between revisions
From Amar
Jump to navigationJump to search
Generate encoded password for netplan |
→LVM: expand the qemu disk |
||
(7 intermediate revisions by the same user not shown) | |||
Line 80: | Line 80: | ||
* Get Ethernet Address of network (Exclude lo, virtual and ethernet) | * Get Ethernet Address of network (Exclude lo, virtual and ethernet) | ||
ip -br l | awk '$1 !~ "lo|vir|eth" { print $3 }' | ip -br l | awk '$1 !~ "lo|vir|eth" { print $3 }' | ||
* [https://www.linuxjournal.com/content/bash-trap-command bash TRAP command] | |||
tempfile=/tmp/tmpdata | |||
trap "rm -f $tempfile" EXIT | |||
== IoT == | == IoT == | ||
Line 85: | Line 88: | ||
* [https://raspberrypi.stackexchange.com/questions/139093/change-netplan-wifi-encrypted-password Generate Encoded Password for Netplan / network-config - use psk] | * [https://raspberrypi.stackexchange.com/questions/139093/change-netplan-wifi-encrypted-password Generate Encoded Password for Netplan / network-config - use psk] | ||
wpa_passphrase <ssid> [passphrase] | wpa_passphrase <ssid> [passphrase] | ||
* [https://stackoverflow.com/questions/73397110/how-to-stop-ubuntu-pop-up-daemons-using-outdated-libraries-when-using-apt-to-i Ubuntu stop pop-up for daemons for apt] | |||
Change the restart command in ```/etc/needrestart/needrestart.conf``` to 'i' | |||
sed "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf | |||
* Create a user password hash to automatically add | |||
mkpasswd -m sha-512 PASSWORD [SALT] | |||
* [https://www.simplylinuxfaq.com/2020/03/how-to-completely-disable-boot-or-startup-messages.html x86 Suppress message at boot] | |||
/etc/default/grub | |||
GRUB_TIMEOUT_STYLE=hidden | |||
GRUB_HIDDEN_TIMEOUT_QUIET=true | |||
GRUB_CMDLINE_LINUX_DEFAULT="rhgb quiet rd.plymouth=0 plymouth.enable=0 --log-level=0 systemd.log_level=0 systemd.show_status=0" | |||
grub2-mkconfig -o /boot/grub2/grub.cfg | |||
* Raspberry Pi4 ubuntu suppress log at boot | |||
/boot/firmware/cmdline.txt | |||
(eliminate console=tty1) | |||
rd.plymouth=0 plymouth.enable=0 --log-level=0 systemd.log_level=0 systemd.show_status=0 | |||
* RPi4 use ubuntu-frame from [https://github.com/MirServer/ubuntu-frame/issues/39] | |||
/boot/firmware/config.txt | |||
dtoverlay=vc4-fkms-v3d | |||
# dtoverlay=dwc2 | |||
or | |||
sed -i "/dtoverlay=dwc2/s/.*/dtoverlay=vc4-fkms-v3d/" /boot/firmware/config.txt | |||
== LVM == | == LVM == | ||
=== LVM Expand === | === LVM Expand === | ||
Shutdown the volume and use qemu to expand | |||
qemu-img resize <disk.qcow2> <+XXG> | |||
restart | |||
Expand the physical size | Expand the physical size | ||
gparted | gparted |
Latest revision as of 02:42, 20 July 2023
Linux Tips and Tricks
Linux stuff I often have to lookup. Just my personal list of things.
- NFS unload filesystem
- mysql slave skip error
- GRUB install
- Domain Keys
- Change Timezone
- Gigabit Network
- Syncookie
- Local Mount
- SWAP
- depmod
- Chain of IP addresses
- Xterm startup with different colors and font sizes
- Notepad:RPM - YUM Platform
- In place upgrade of Fedora Core by yum
- CentOS / Red Hat Linux: Install and manage iSCSI Volume
- Configure a LDAP directory service
- NetworkManager Configuration
- Accessing IMAP email accounts using telnet.
- Enable service syslog to have /var/log/messages populated
- Force a disk check on reboot
shutdown -rF now
- Create a network bridge for Virtual Machines
- Upgrade CentOS 4 to 5
- Create a CRT for an SSL certificate
- Properly configure Samba on Linux
- Postfix config
- Use wget to download full website
- Converting a running physical machine to a kvm virtual machine
- Generate XAUTH on a new host
xauth add `hostname`/unix:0 . `openssl rand -hex 32`
- yum versionlock - allows to lock an rpm
- install faster random for dns etc.
yum install haveged;
systemctl enable haveged;
systemctl start haveged
sudo visudo -f /mnt/etc/sudoers
- Converting a running physical machine into a KVM virtual machine
- Which Process is listening on a port
netstat -tulpn
- Recover GRUB 2
- Install all package from another machine
xargs yum -y install < file
- Create Default Home Directory
mkhomedir_helper username
- Schedule crontab with lock
- Configure UPS shutdown frmo Linux with nut
- Midnight Commander
- Nagios
- Google Authenticator Setup
- Boot from Centos 7 RAID 1 EUFI
- Create a directory under var at boot or startup
use tmpfiles.d and have your package create at startup or boot a file or directory /usr/lib/tmpfiles.d/mydaemon.conf : man tmpfiles.d #Type Path Mode UID GID Age Argument d /run/mydaemon 0755 myuser myuser - -
- lm_sensors
- Change systemd Timeout
- Google Authenticator Across Servers
- Yum install with missing deps
rpm -Uvh --nodeps $(repoquery --location <module>)
- Example routing iptables firewall
- Disable IPv6
- find the right device for smartctl
- ssh into a machine without a terminal -T
- Clean Out Journal
sudo journalctl --vacuum-time=3weeks
- Reclaim disk space from a sparse image file (qcow2/ vmdk)
- Make your Raspberry Pi file system read-only
- Linux Multiple Interface NAT
- Get Ethernet Address of network (Exclude lo, virtual and ethernet)
ip -br l | awk '$1 !~ "lo|vir|eth" { print $3 }'
tempfile=/tmp/tmpdata trap "rm -f $tempfile" EXIT
IoT
wpa_passphrase <ssid> [passphrase]
Change the restart command in ```/etc/needrestart/needrestart.conf``` to 'i'
sed "/#\$nrconf{restart} = 'i';/s/.*/\$nrconf{restart} = 'a';/" /etc/needrestart/needrestart.conf
- Create a user password hash to automatically add
mkpasswd -m sha-512 PASSWORD [SALT]
/etc/default/grub GRUB_TIMEOUT_STYLE=hidden GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_CMDLINE_LINUX_DEFAULT="rhgb quiet rd.plymouth=0 plymouth.enable=0 --log-level=0 systemd.log_level=0 systemd.show_status=0"
grub2-mkconfig -o /boot/grub2/grub.cfg
- Raspberry Pi4 ubuntu suppress log at boot
/boot/firmware/cmdline.txt (eliminate console=tty1) rd.plymouth=0 plymouth.enable=0 --log-level=0 systemd.log_level=0 systemd.show_status=0
- RPi4 use ubuntu-frame from [1]
/boot/firmware/config.txt dtoverlay=vc4-fkms-v3d # dtoverlay=dwc2
or
sed -i "/dtoverlay=dwc2/s/.*/dtoverlay=vc4-fkms-v3d/" /boot/firmware/config.txt
LVM
LVM Expand
Shutdown the volume and use qemu to expand
qemu-img resize <disk.qcow2> <+XXG>
restart Expand the physical size
gparted
Expand the logical volume
lvextend -l +100%FREE /dev/vg.../lv....
Resize the file system
resize2fs /dev/vg.../lv...
LVM Snapshot
← Back to Notepad
<insert>googlesearchwiki</insert> | <insert>paypal</insert> | <insert>analytics</insert> |