Various commands.
Disk Space
df -h
Lists all partitions and their disk usage
du -hs directoryname/
Returns the total size of everything inside directoryname
sudo du -cha -d 1 /directoryname | sort -nr | head -20
Lists the size of all subdirectories of directoryname
Download Videos
youtube-dl -f 'bestvideo[ext=mp4]+bestaudio[ext=m4a]/best[ext=mp4]/best' video_URL
Downloading a video in best quality
youtube-dl -x --audio-format mp3 video_URL
Download audio only
String Manipulations
sed -i "s/$OLD/$NEW/g" *.txt
Replace string in multiple files
for file in *; do mv "$file" echo $file | tr ' ' '_' | tr '[:upper:]' '[:lower:]'
; done
Change all filenames to lowercase and replace all spaces with underscores in a directory:
xclip -selection clipboard -t image/png -i example.png
Copy an image to the clipboard
cat filename | grep -C 3 searchterm
Display's the content of a file searching for searchterm
and displaying 3 lines of context before and after a match.
Time
date --date='TZ="Continent/City" localTZTime Date/Day'
Print local time of a date and time in a different timezone
tzselect
Find the available timezones
Miscellaneous
command | more
Paging long-scrolling output
whereis applicationname
Find the location of an application
trash-restore filename
Restoring deleted files
pdfunite file01.pdf file02.pdf output.pdf
Combine two pdfs to one
for f in *.zip; do unzip "$f" -d "${f%.zip}"; done
Extract all .zip files in folder creating a new director with the name of the file for each
Packages
Install .deb files
sudo dpkg --install packagename.deb
List installed dpkg packages sorted by size
dpkg-query --show --showformat='${Package;-50}\t${Installed-Size}\n' | sort -k 2 -n | grep -v deinstall | awk '{printf "%.3f MB \t %s\n", $2/(1024), $1}'
Updating python packages
python3 -m pip install --upgrade packagename
Clearing System Logs
journalctl --disk-usage
journalctl --rotate
sudo journalctl --vacuum-files=5
Set SystemMaxUse=100M
in /etc/systemd/journald.conf
to limit maximum journaling space.
Use systemctl daemon-reload
to update.
For printing commands, see printer.
chmod
Permission control on who can access files, search directories and run scripts.cmus
A command line music player.feh
Simple image viewerffmpeg
Commonly used commands to edit videos.firefox
A complex beast.gemini
A simple protocol for serving content over the internet.git
Notes on the version control systemimagemagick
Commmonly used imagemagick commands.launcher
How to add any file to the application launcher.neomutt
A command line based e-mail clientmicro
A terminal based text editor.mime
Handling mime types.pass
A command line password manager.resilio sync
Peer to peer file syncingrsync
Battle tested file synchronisation.stardict
A command line dictionary.tarballs
A container archive.w3m
Notes on the command line browser.incoming(1) | software