Over the course of my Linux use, I've found these three commands to be very helpful and they are worth committing to memory.
DD, the low-level data dumping utility is a dangerous but also one of the most useful commands when used lucidly. For instance, burning an ISO image to USB stick is just one command away:
sudo dd if=ubuntu-18.04.1-desktop-amd64.iso of=/dev/sdb bs=1MFurthermore, if you want to "hard-wipe" your disk completely so that all data is permanently erased beyond recovery (for example, before handing your laptop in an exchange offer, or to a technician for repairs), all you need to remember is this one command:
This will wipe your disk entirely and there is no recovery possible, though some sysadmins are of the opinion that you should repeat the above at least three times to be absolutely sure!
sudo dd if=/dev/zero of=/dev/sda
DU, or the disk usage command is used for quickly estimating the drive space used in a folder or partition. For example, to display the space used by each file and folder in the current directory, you can simply run:
techtudor@ubuntu:/data/iso$ du -sh * 2.2G ubuntu-18.04.1-desktop-amd64.iso techtudor@ubuntu:/data/iso$
Another common use case is that you want to sort all current folder contents in the order of their size:
techtudor@ubuntu:/data/java$ du -sh * | sort -h 512 apache-ant-1.9.4-bin.tar.bz2.sha512 44K hamcrest-core-1.3.jar 112K flyingsaucer-R8-users-guide.pdf 112K gs-serving-web-content-master.zip 136K sqlite-jdbc-3.7.2-javadoc.jar 772K yuicompressor-2.4.8.jar 848K libGDX 957K log4j 15M tomcat 21M javafx_samples-2_2_55-linux.zip 63M gradle-2.4-all.zip
DF is finally used for estimating disk space but for the entire disk rather than a directory or folder. df -l is all you need to show which partition is how much full.
techtudor@ubuntu:/data/java$ df -l Filesystem 1K-blocks Used Available Use% Mounted on udev 1936212 0 1936212 0% /dev tmpfs 393184 1380 391804 1% /run /dev/sda2 51343840 12112488 36593528 25% / tmpfs 1965900 25860 1940040 2% /dev/shm tmpfs 5120 4 5116 1% /run/lock tmpfs 1965900 0 1965900 0% /sys/fs/cgroup /dev/sda3 383526908 133183184 250343724 35% /data tmpfs 393180 20 393160 1% /run/user/1000
After mastering DD, DU & DF commands, and making a habit of using them in your daily errands, you'll rarely ever need to open your actual file-manager such as nautilus or thunar!