Linux
Create zip archive
add -e flag to encrypt
zip -r /tmp/ziparchive.zip ~/Documents/
Create bootable USB
sudo dd bs=4M if=~/Downloads/linux-2016.09.03.iso of=/dev/sdb && sync
Find examples
# find files or directories: find /usr -name gcc # find files find /usr -type f -name test1 # find directories find /usr -type d -name gcc # find by modified date (3 days) find / -ctime 3 # find files (case insensitive) find / -iname gcc # find files with size find /etc -size +10M # find and remove found files using -exec find -name "*.swp" -ok rm {} ’;’
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