My personal cheatsheet for using the Linux command line.
.tar.bz2
tar -jxvf file.tar.bz2
.tar.xz
tar xvfJ file.tar.xz
.tar.gz
tar -zxvf file.tar.gz
.gz
gunzip file.gz
Zip something
zip foo foo.zip
Zip recursively
zip -r file.zip directory/
Configure GIT
git config --global user.email "[email protected]"
git config --global user.name "Name Surname"
Commit to master
git init
git add README.md
git commit -m "initial commit"
git remote add origin https://github.com/user/repo.git
git push -u origin master
To add a new Samba user, you first have to create a new Unix user.
sudo useradd --shell /bin/false USER # new unix user
sudo passwd USER # set password
sudo smbpasswd -a USER # create samba user
lsblk -l #find the usb drive
umount /dev/sdX
dd bs=4MB if=file.iso of=/dev/sdX
Check for how long your SSL certificate remains valid.
openssl x509 -noout -dates -in /etc/letsencrypt/live/yourdomain.tld/cert.pem
Nixcraft: How To Compile And Run a C/C++ Code In Linux
Compile a C++ file
g++ CODE.cpp -o BINARY.exe
Compile a C file
gcc CODE.c -o BINARY.exe
Size of a directory
du -sh DIR/
Random Filename argument
echo `ls dir | sort -R | tail -n 1`
sudo dpkg -i pack.deb
nohup command > /dev/null 2>&1
SSH tunnel
-D [Bind Port]
-p [Remote Port]
ssh -CnN -D 9999 -p 22 [email protected] # forwards local port 9999 via ssl tunnel
SSH tunnel settings for PuTTY
Connection > SSH > Tunnels :
Source Port: port
☒ Dynamic
☒ Auto
[Add]
Session :
Host Name: server
Port: port
Saved Sessions: name
[Save]
[Load]