Skip to content

Linux cheatsheet

Dmitriy Popov edited this page Dec 28, 2020 · 9 revisions

Show available size on disk

df -h 

See https://opensource.com/article/18/7/how-check-free-disk-space-linux

Show sizes in current dir, including directories

du -sh *

See https://stackoverflow.com/a/1019124/8534088

List current directory with file size in megabytes

ls -l --block-size=M

See https://unix.stackexchange.com/a/64150/360633

Get count of files in the current directory

ls | wc -l

See https://devconnected.com/how-to-count-files-in-directory-on-linux/

Remove everything from current dir recursively

rm -r *

See https://askubuntu.com/a/740808/975890

Zip a file

zip log-2020.12.28.zip ./kg.log

See https://linuxize.com/post/how-to-zip-files-and-directories-in-linux/

Zip a directory

todo: add*

Clone this wiki locally