Linux

Encodings

From CP1252 to UTF-8:

$ iconv -f CP1252 -t UTF8 inputfile.txt -o outputfile.txt
Or
$ enconv -x UTF8 somefile.txt

Check:

$ enconv -d somefile.txt
Or
$ file -i somefile.txt

Remove ANSI escape codes:

$ awk '{ gsub("\\x1B\\[[0-?]*[ -/]*[@-~]", ""); print }' somefile.txt

Windows/Unix Text

input.txt: ASCII text
VS
input.txt: ASCII text, with CRLF line terminators

From Win to Unix:

$ awk '{ sub("\r$", ""); print }' input.txt > output.txt
Or
$ dos2unix input.txt

From Unix to Win:

Network

Connections

Public IP

Internet Speed

Virtual Terminal

Process Kill

OpenSSL

Encrypt/Decrypt

Generate Keys

GPG

List keychain:

Gen key:

Gen revoke cert:

Export user's public key:

Import recipient's public key:

Sign and encrypt:

List recipients:

Verify signature:

Decrypt and verify:

Cleanup

Log Files

.bash_history

.zsh_history

Secure Delete

Recover Deleted Files

Partitions

List devices:

Manage partitions:

Format:

Floppy

Checksums

Compare file hashes:

Compare directory hashes:

Permissions

Set defaults for files:

Set defaults for directories:

Fix Linux Freezes while Copying

Kernel

Remove old kernels:

Xfce4

Install xfce4:

GIFs

NTP

ImageMagick

XOR 2 images:

Utilities Syntax

tar

.tar

Pack:

Unpack:

.tar.gz

Pack:

Unpack:

.tar.bz

Pack:

Unpack:

scp

Local file to a remote system:

Remote file to a local system:

7z

Encrypt and pack all files in directory::

Decrypt and unpack:

Best compression:

grep / find / sed

Recursive grep:

Recursive find and replace:

Exec strings and grep on the result (with filenames):

Find and xargs grep the results:

Find and xargs less/grep the results:

Enhanced variant using parallel and tre-agrep:

Get absolute path of a file:

paste

Concatenate text files with a delimeter line by line:

tmux

Send a bunch of lines to a tmux pane:

dpkg

veracrypt

openconnect

GlobalProtect

Connect:

Bypass HIP:

LAMP

Fun

CMatrix

screenfetch

Last updated