Do You Need to Memorize Linux Commands?

Many people have this confusion: they want to learn Linux but are intimidated by the command line.In fact, there are methods to learn commands, and there is no need for rote memorization. This series of articles is designed to help everyone overcome their fear of the command line. As long as you keep reading, you will easily master most of the commands you need in daily use.This series is called “One Linux Command a Day.” As an introduction, we won’t rush to discuss specific commands but will first help you form a holistic understanding of Linux commands.From the perspective of naming conventions, the design of Linux commands is actually quite regular:Some commands are named directly after the objects they operate on, such as tar and zip;Others are abbreviations of English words, such as mkdir = make directory.From a functional perspective, we can categorize commonly used commands into the following types:1. Process and memory management commands2. File and storage device management commands3. Security-related commands: user management, firewall configuration, etc.4. Network-related commands: routing, bridging, connection testing, etc.5. System configuration commands: such as timezone and language settings6. Utility commands: such as calculators, date queries, etc.The most commonly used are the commands related to process management and file management. By organizing them in this way, it’s like building a “command hash table” in your brain, so when you see a new command, it won’t seem overwhelming.✦•——————–•✦Besides the commands themselves, what can be even more daunting are the various parameters—but don’t worry, parameters also follow certain rules.Many commands with similar functions share similar parameters. For example, commands related to checking capacity: du, df, ls, free, they usually support the -h parameter, which converts the capacity into a more readable format (e.g., 1K, 234M, 2G).

-h, --human-readable              print sizes in human readable format (e.g., 1K 234M 2G)

The actual effect is as follows:

>$ ls -lh
-rw-r--r--. 1 dybai dybai 1.8K Apr 12 19:04 gnome-software-log.txt
>$ du -sh
88K     .
>$ df -Th
Filesystem                  Type      Size  Used Avail Use% Mounted on
/dev/sda3                   btrfs     200G   52G  146G  27% /
/devtmpfs                    devtmpfs  7.8G     0  7.8G   0% /dev
/devtmpfs                       tmpfs     7.9G  7.6M  7.8G   1% /tmp
/dev/sda2                   vfat      243M   20M  224M   8% /boot/efi
/dev/sda5                   btrfs     820G  322G  499G  40% /home
>$ free -h
               total        used        free      shared  buff/cache   available
Mem:            15Gi       3.1Gi       553Mi        92Mi        11Gi        12Gi
Swap:           11Gi       485Mi        11Gi

Another example, the tar command is used for packaging and unpacking, and it has many options, but the commonly used options are:-c: which means create, to create an archive.-x: which means extract, to extract from a compressed package. Therefore, it can be understood that a command cannot both package and unpack at the same time, so c and x can only be used one at a time.-v: which means verbose, to display the files being packaged or unpacked.-f: which means file, followed by the name of the file to be packaged or unpacked. If combined with the -c parameter, it is the name of the newly created archive file. If combined with the -x parameter, it is the file from which to extract files.Now that we understand these parameters, we can package or unpack:

# cvf means package, show detailed information, and the name of the archive is ble.tar
>$ tar cvf ble.tar ble/ble/ble/0x10.dat ble/cipher_prefix.dat ble/decrypted_prefix.dat ble/encrypted.dat ble/mac.dat ble/pid.dat ble/plain.dat ble/random.dat ble/secret.dat
# xf means unpack, but do not display the list of processed files
>$ tar xf ble.tar
>$ ls -l
total 0
drwxr-xr-x. 1 dybai dybai   202 Feb 14  2025 ble

Now let’s look at a few new parameters:-z: use gzip algorithm for compression, so the resulting package name will have a .tar.gz or .tgz extension-j: use bzip2 algorithm for compression, resulting in a package name with a .bz2 extension-J: use xz algorithm for compression, resulting in a package name with a .xz extensionSince these parameters are all related to compression algorithms, it can be inferred that they are mutually exclusive, and only one can be selected at a time.Now we can add parameters with compression capabilities to the previous commands:

# czf means package, use gzip algorithm for compression, and the name of the compressed package is ble.tar.gz
>$ tar czf ble.tar.gz ble/
>$ ls -lh
total 4.0K
drwxr-xr-x. 1 dybai dybai 202 Feb 14  2025 ble
-rw-r--r--. 1 dybai dybai 588 Sep  8 14:16 ble.tar.gz
# Unpacking is just as simple, give it a try?

How does it feel? Much clearer, right? This series will guide you to master commonly used commands and their parameters one by one.Congratulations, you have gained useful knowledge again!✨

Leave a Comment