Skip to content

Instantly share code, notes, and snippets.

@atb00ker
Last active Mar 7, 2021
Embed
What would you like to do?
linux commands and information i find useful.
permissions : information about getting file permissions
flaskdrive : flashdrive commands
pipeline : redirecting stdout and stderr
wget : wget to save a site offline
openssl : openssl options
certificates : types of certs and their purpose
commands : general useful commands
ssh : Useful SSH configurations
torrent : Torrent client
audio : Audio configuration help
# Record Audio (10 seconds)
arecord -f cd -d 10 test-mic.wav
# Play audio
aplay test-mic.wav
Filename || Needed By || Purpose || Secret
===============++============================++================================++===========
ca.crt || Server + Clients || Root CA certificate || NO
ca.key || Key Signing Machine only || Root CA key || YES
dh.pem || Server only || Diffie Hellman parameters || NO
server.crt || Server only || Server Certificate || NO
server.key || Server only || Server Key || YES
client.crt || Client only || Client Certificate || NO
client.key || Client only || Client Key || YES
xinput --list --short
xinput --list-props <device>
xinput set-prop <device> <property> <value>
xrandr -q # Show all display options
xrandr -s 1366x768 -r 40 # Set display refresh rate
# LuksFormat
sudo cryptsetup --key-size 512 --hash sha512 -v luksFormat /dev/<drive> --verify-passphrase
sudo cryptsetup config /dev/<drive> --label <LABEL>
# LuksOpen
sudo cryptsetup luksOpen /dev/<drive> <LABEL>
# LuksFormat (w/ header)
sudo cryptsetup --key-size 512 --hash sha512 -v luksFormat /dev/<drive> --verify-passphrase --header ~/<header-name>
sudo cryptsetup config /dev/<drive> --label <LABEL>
# LuksOpen (w/ header)
sudo cryptsetup luksOpen /dev/<drive> <LABEL> --header ~/<header-name>
# Mount & Format
sudo mkfs.ext4 /dev/mapper/<drive>
sudo mkdir -p /media/<drive>
sudo mount /dev/mapper/<drive> /media/<drive>
sudo chown -R <user>:<user> /media/<drive>
# LuksClose & umount
sudo umount /dev/mapper/<drive>
sudo cryptsetup luksClose /dev/mapper/<drive>
sudo rm -rf /media/<drive>
apt-get download $(apt-cache depends --recurse --no-recommends --no-suggests \
--no-conflicts --no-breaks --no-replaces --no-enhances \
--no-pre-depends network-manager | grep "^\w")
sudo fdisk -l
sudo umount /dev/sdb1
sudo wipefs --all /dev/sdb1
sudo cfdisk /dev/sdb1
sudo dd bs=4M if=/path/to/iso of=/dev/sdb status=progress && sync
# Running unetbootin
sudo QT_X11_NO_MITSHM=1 unetbootin
# Recover Corrupt GPT
sudo gdisk /dev/sdb
OpenSSL 1.1.1d 10 Sep 2019
Encrypt Large Files: openssl enc -aes-256-cbc -salt -pbkdf2 -in file.txt -out file.txt.enc
Options Description
openssl OpenSSL command line tool
enc Encoding with Ciphers
-aes-256-cbc The encryption cipher to be used
-salt Adds strength to the encryption
-in Specifies the input file
-out Specifies the output file.
Decrypt Large Files: openssl enc -aes-256-cbc -d -pbkdf2 -in file.txt.enc -out file.txt
Options Description:
-d Decrypts data
-in Specifies the data to decrypt
-out Specifies the file to put the decrypted data in
0 – no permission
1 – execute
2 – write
3 – write and execute
4 – read
5 – read and execute
6 – read and write
7 – read, write, and execute
owner group other
read (r) 4 4 4
write (w) 2 2 2
execute (x) 1 1 1
----------- ----- ----- -----
total value 7 7 7
stat FILE_NAME
stat -c %a FILE_NAME
|| visible in terminal || visible in file || existing
Syntax || StdOut | StdErr || StdOut | StdErr || file
==========++==========+==========++==========+==========++===========
> || no | yes || yes | no || overwrite
>> || no | yes || yes | no || append
|| | || | ||
2> || yes | no || no | yes || overwrite
2>> || yes | no || no | yes || append
|| | || | ||
&> || no | no || yes | yes || overwrite
&>> || no | no || yes | yes || append
|| | || | ||
| tee || yes | yes || yes | no || overwrite
| tee -a || yes | yes || yes | no || append
|| | || | ||
n.e. (*) || yes | yes || no | yes || overwrite
n.e. (*) || yes | yes || no | yes || append
|| | || | ||
|& tee || yes | yes || yes | yes || overwrite
|& tee -a || yes | yes || yes | yes || append
# Exit automatically on network interruptions. In your .ssh/config, add:
ServerAliveInterval 5
ServerAliveCountMax 1
docker run -d \
--name=rutorrent \
-e PUID=1000 \
-e PGID=1000 \
-p 8090:80 \
-p 5000:5000 \
-p 51413:51413 \
-p 6881:6881/udp \
-v /<path>/config:/config \
-v /<path>/downloads:/downloads \
ghcr.io/linuxserver/rutorrent
wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains example.com \
--no-parent \
example.com/section/topic/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment