Linux

Published on 2019-03-18 by Mohd

high power use

docker: sudo ifconfig docker0 down

wired: sudo ifconfig enp0s25 down

Restoring GRUB

First, fdisk -l to identity main drive on which to install Grub. Replace sda1 with your main drive:

sudo mount /dev/sda1 /mnt
sudo mount --bind /dev /mnt/dev
sudo mount --bind /proc /mnt/proc
sudo mount --bind /sys /mnt/sys
sudo chroot /mnt
update-initramfs -u
update-grub

reboot

Connect to wifi with cmd line

You can use Network Manager's command line tool called nmcli.

  1. Use nmcli dev wifi to locate the access point(AP) name.
  2. Use nmcli device wifi connect APname password

Also, nmtui

Set capslock as mod key in i3

create ~/.Xmodmap

	clear Lock 
	keycode 66 = Hyper_L
	add mod4 = Hyper_L

then run xmodmap ~/.Xmodmap

Change volume from command line

amixer -q -D pulse sset Master 10%+
amixer -q -D pulse sset Master 10%-
amixer -q -D pulse sset Master toggle

Steam auto-mount USB storage partition in linux

to figure out volume: sudo fdisk -l /etc/fstab: /dev/sdb /media/mohd/7E8A-664F vfat defaults,uid=1000,umask=007 0 0

restart snapd service

systemctl start snapd.service

mount: target is busy

umount -l /PATH/OF/BUSY-DEVICE

mount bind

mount --bind /media/tc1/folder /home/dvad/home

mount refresh fstab

sudo mount -a

list vulnerabilities

grep . /sys/devices/system/cpu/vulnerabilities/*

bootable usb

sudo dd bs=4M if=path/to/input.iso of=/dev/sd<?> conv=fdatasync  status=progress

example:

sudo dd bs=4M if=linuxmint-19.3-cinnamon-64bit.iso of=/dev/sdb conv=fdatasync  status=progress

disable middle mouse button on thinkpad trackpads

xinput command lists the input devices:

⎡ Virtual core pointer                    		id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ SynPS/2 Synaptics TouchPad              	id=11	[slave  pointer  (2)]
⎜   ↳ TPPS/2 IBM TrackPoint                   	id=12	[slave  pointer  (2)]
⎣ Virtual core keyboard                   		id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=8	[slave  keyboard (3)]
    ↳ Integrated Camera: Integrated C         	id=9	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=10	[slave  keyboard (3)]
    ↳ ThinkPad Extra Buttons                  	id=13	[slave  keyboard (3)]

We are interested in the SynPS/2 Synaptics TouchPad device, which has an id of 11.

xinput get-button-map 11
1 2 3 4 5 6 7

Here the 2 stands for our middle mouse button. We can get rid of it like so:

xinput set-button-map 11 1 0 3 4 5 6 7

remove unused packages

sudo apt autoremove --purge

add ppa in ubuntu

eg. sudo add-apt-repository ppa:alexmurray/indicator-sensors

remove ppa in ubuntu

sudo add-apt-repository --remove ppa:alexmurray/indicator-sensors

remove epiphany web app

about:applications

mount usb

find the usb device identifier

sudo fdisk -l

Then mount:

udisksctl mount -b device_name

eg

udisksctl mount -b /dev/sdb1

run update-grub from live-cd

mount the linux system partition

sudo mount /dev/sda5 /mnt

mount these:

sudo mount --bind /dev /mnt/dev
sudo mount --bind /sys /mnt/sys
sudo mount --bind /proc /mnt/proc

chroot:

sudo chroot /mnt
sudo update-grub

https://askubuntu.com/questions/145241/how-do-i-run-update-grub-from-a-livecd

create .desktop file

gnome-desktop-item-edit --create-new ~/.local/share/applications