nyk0
nyk0-nomikon - Linux notes

Linux notes

File permissions

Processes

Files/Hardware

Networking

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 {} ’;’

Duplicity

# Create an encrypted backup
duplicity --progress ~/Documents file:///media/nick/backup-dir/
                                                         
# Restore backup
duplicity --progress file:///media/nick/backup-dir/ /home/nick/Documents/restore/

Find and remove found files using -exec.

$ find -name "*.swp" -exec rm {} ’;

The same, but ask first :

$ find -name "*.swp" -ok rm {} ’;

Find duplicate files

Using fdupes to find duplicate files

 sudo apt-get install fdupes
# find duplicates
 fdupes -r /media/nick/Data/iTunes/
# find and delete after confirmation duplicates
 fdupes -r -d /media/nick/Data/iTunes/iTunes\ Media/Music/A*

```

Deactivate and activate the build in camera

- deactivate : `sudo modprobe -r uvcvideo`
- activate: `sudo modprobe uvcvideo`

Lightdm set default user

Edit this file

/usr/share/lightdm/lightdm.conf.d/01\_debian.conf

Then change the command greeter-hide-users from false to true and save

greeter-hide-users=true

Install Quake 3 on Linux

https://www.videogames.ai/How-to-Install-Quake3-on-Linux

GPG/SSH setup - encrypt/decrypt files

General instructions for creating an idendity and encrypt/decrypt files
with it.

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

from this reddit thread

systemd-analyze               # show total boot time
systemd-analyze blame         # show list from most slow services

Auto Mount filesystem (NTFS) at startup