Linux notes
Files/Hardware
- USB copy iso :
sudo dd bs=4M if=~/Downloads/archlinux-2016.09.03-dual.iso of=/dev/sdb && sync
- List disk devices and partitions :
lsblk
ORblkid
- List PCI devices :
lspci
- List USB devices :
lsusb
- CPU info :
lscpu
- List boots of system :
journalctl --list-boots
- List kernel messages :
journalctl -k (-b bootID)
- List kernel hardware messages :
dmesg
fzf
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf
~/.fzf/install
vim plugins
curl -fLo ~/.vim/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
tmux plugins
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
gogh (terminal colors)
bash -c "$(wget -qO- https://git.io/vQgMr)"
nordic wallpapers
cd Pictures
git clone https://github.com/linuxdotexe/nordic-wallpapers.git
yt-dlp
# get playlist
yt-dlp -w --ignore-errors --format bestaudio --extract-audio --audio-format mp3 --audio-quality 160K --output "%(title)s.%(ext)s" --yes-playlist 'https://music.youtube.com/playlist?list=PLZa1UYHdqvjDtp9f1P2enloz7ivuqGuFU'
mpv
# Playing a playlist with an mpv window showing album art
mpv --quiet --geometry=300x300+0+0 --shuffle https://music.youtube.com/playlist?list=PLZa1UYHdqvjBplPTAfU8kxA2LR4DGlt4t"
# Playing a playlist of album playlists
# albums.m3u contains playlist of youtube urls with EXIF info for titles
alias albums="mpv --quiet --no-terminal --geometry=300x300+15+140 ~/dotfiles/albums.m3u &"
light-dm
For remembering the last session a user logged in (that way each user can have a different preference)
edit /etc/lightdm/lightdm.conf
on section [Seat:*]
add or uncomment this: user-session=default
Create zip archive
# add -e flag to encrypt
zip -r /tmp/ziparchive.zip ~/Documents/
Deactivate and activate the build in camera
# deactivate :
sudo modprobe -r uvcvideo
# activate:
sudo modprobe uvcvideo
GPG/SSH setup - encrypt/decrypt files
General instructions for creating an idendity and
encrypt/decrypt files
with it.
- Check for existing keys with
gpg --list-keys
- Create new with
gpg --full-generate-key
- if timeout: create ~/.gnupg/gpg.conf and add line:
pinentry-mode
loopback - you can backup the whole .gnupg dir and transfer it (if using
same
versions). Otherwise use --export - decrypt:
gpg --output outputfile.txt --decrypt inputfile.gpg
- encrypt:
gpg -r -e
- also editing the gpg-agent.conf you can set how many
days the
password is kept in cache and other options, like which pinentry
program to use.
SSH keys
The SSH keys are used for secure connections using the SSH
protocol.
Instructions for creating can be found on github
help
pages
They can be copied to another computer using the
scp
command from one
~/.ssh folder to another but afterwards you still need to create
an
identity with ssh-add
(although it's not considered a
good practice)
Image Magick
Resize images to another folder
mogrify -path "new" -resize 50% -format jpg *.jpg
Crop images to another folder
mogrify -path "new" -crop 320x320+0+0 -format jpg *.jpg
HD monitor resolution on Linux
copy this to
/etc/X11/xorg.conf.d/10-monitor.conf
Section "Monitor"
Identifier "VGA-1"
Modeline "1920x1080R" 138.50 1920 1968 2000 2080 1080 1083 1088 1111 +hsync -vsync
Option "PreferredMode" "1920x1080R"
EndSection
Correct time when dual booting Windows
Linux part commands
sudo ntpdate pool.ntp.org
sudo hwclock --systohc --utc
sudo timedatectl set-local-rtc 1
Windows part Regedit .reg file
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\TimeZoneInformation]
"RealTimeIsUniversal"=dword:00000001
Analyze boot time
systemd-analyze # show total boot time
systemd-analyze blame # show list from most slow services
Firefox
Autosave bookmarks when firefox is closed
about:config
browser.bookmarks.autoExportHTML = true
browser.bookmarks.file = {full path to file}