My personal cheatsheet for using the Linux command line.
Linux Subsystem
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-LinuxList of installed programms
Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize > C:\Users\Kelly\Desktop\InstalledPrograms.txtGet Windows License Key
wmic path softwarelicensingservice get OA3xOriginalProductKeypowercfg.bat
powercfg -requests
pause
exit-
download LineageOS Upgrade
-
download OpenGApps
-
download Magisk
-
Backup
-
reboot to recovery
-
wipe system / cache / dalvik
-
install LineageOS
-
install GApps
-
install Magisk
-
wipe cache / dalvik
-
Power off
-
Reboot manually
dd if=/dev/zero of=/dev/block/bootdevice/by-name/misc bs=256 count=1 conv=notrunc cp $(ls | grep -i audio) ../TFaudioFiles/@InLaTeXbot \[\dfrac{df}{dx}=f_{(x)}=\lim_{\Delta{x} \to \infty}\dfrac{f_{(x-\Delta{x}}-f_{(x)}}{\Delta{x}}\]
youtube-dl -x —audio-format mp3 -f bestaudio -l https://www.youtube.com/playlist?list=-rfor recursive
scp your_username@remotehost.edu:foobar.txt /local/dir
scp -r pi@192.168.1.42:/home/pi/workspace ./Desktop/echo "ping" >/dev/udp/$host/$port.tar.bz2
tar -jxvf file.tar.bz2.tar.xz
tar xvfJ file.tar.xz.tar.gz
tar -zxvf file.tar.gz.gz
gunzip file.gzZip something
zip foo foo.zipZip recursively
zip -r file.zip directory/Configure GIT
git config --global user.email "user.name@email.ch"
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 mastergit pull
git status
git branch
git branch dingsbums
git checkout dingsbums
git git add -A
git commit
git push
(git push --set-upstream origin dingsbums)
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 userlsblk -l #the usb drive
umount /dev/sdX
bs=4MB if=file.iso of=/dev/sdXCheck for how long your SSL certificate remains valid.
openssl x509 -noout -dates -in /etc/letsencrypt/live/yourdomain.tld/cert.pemsudo grep "Failed password" /var/log/auth.log
sudo cat /var/log/fail2ban.logCrop a bunch of screenshots and make a PDF.
for f in *.png; do echo "Processing $f file.."; convert $f -crop 1580x254+1+390 $f; done
convert *.png ebssd-HS19-test-3.pdfconvert in.png -crop widthxheight+left+top out.jpgNixcraft: How To Compile And Run a C/C++ Code In Linux
Compile a C++ file
g++ CODE.cpp -o BINARY.exeCompile a C file
gcc CODE.c -o BINARY.exeRecursively download
wget -r -np -nH —cut-dirs=2 -R index.html http://maven.jzy3d.org/releases/org/jzy3d/Size of a directory
du -sh DIR/Recursively copy all files of type
find DIR -iname \*.TXT -exec cp {} DESTINATION \;
find ExampleGame/ -name '*.bnk' -exec cp '{}' ./audio/ \;Recursively search/find for string/pattern in all files
grep -rnw '/path/to/somewhere/' -e 'pattern'
grep --include=\*.{c,h} -rn -e usart
grep --include=\*.c -rn -e usartror -R is recursive,nis line number, andwstands for match the whole word.l(lower-case L) can be added to just give the file name of matching files.eis the pattern used during the search
Recursively delete all files of type
Use PowerShell ADB to Android Phone.
cd /storage/3FB1-1D06
find ./Music/ -name "*.jpg" -type f -deleteCopy a file from a remote location via SSH (ssh copy)
(download from remote)
scp user@remote:/path/to/file /path/to/destination(push to remote)
scp /path/to/file user@remote:/path/to/destinationRandom Filename argument
echo `ls dir | sort -R | tail -n 1`sudo dpkg -i pack.debnohup command > /dev/null 2>&1nmap -F domain.org
ncrack -p 22 --user root -P 'SecLists/Passwords/darkweb2017-top10000.txt' domain.org
- find all files and print their last edited date
- count date occurrances and sort them
find . -name '*.flac' -o -name '*.mp3' -printf "%TY-%Tm-%Td\n" > all-files.txt
sort all-dates.txt | uniq -c | awk '{ print $2 "," $1}' > histogram.csvSSH tunnel
-D [Bind Port]
-p [Remote Port]
ssh -CnN -D 9999 -p 22 user@server.ch # forwards local port 9999 via ssl tunnelSSH tunnel settings for PuTTY
Connection > SSH > Tunnels :
Source Port: port
☒ Dynamic
☒ Auto
[Add]
Session :
Host Name: server
Port: port
Saved Sessions: name
[Save]
[Load]
cat /dev/urandom | xxd -p -c 92 | lolcat
figlet -c Happy Birthday | lolcat
toilet -f mono12 -F metal Hello
espeak "Hello"
sl
mplayer -vo caca video.mp4