4 Ways to Quickly Teach Yourself Linux Commands

4 Ways to Quickly Teach Yourself Linux Commands

If you want to become a Linux master, then mastering some Linux commands is essential. Here are 4 ways to teach yourself Linux commands.

1. Daily Tips

An incremental way to learn Linux commands is to have the Tip of the Day appear every time you open a terminal. This will introduce you to some useful commands and their advanced usage tips.

Add the following line to .bashrc (/home/.bashrc):

echo "Did you know that:"; whatis$(ls /bin | shuf -n 1)

You just need to add this line! If you want to make it more entertaining, you can install cowsay. Install cowsay in Ubuntu/Debian:

sudo apt-get install cowsay

Install cowsay under Fedora:

yum install cowsay

In addition to installing cowsay, you also need to add the following to .bashrc:

cowsay -f $(ls /usr/share/cowsay/cows | shuf -n 1 | cut -d. -f1) $(whatis $(ls /bin) 2> /dev/null | shuf -n 1)

However, the above method of using cowsay does not work successfully on all Linux distributions.

2. Use “whatis”

If you don't like learning random commands, maybe you like learning how to use a command while using it. At this time, you just need to add whatis in front of it.

. Whatis will interpret the commands you enter one by one.

The whatis sudo yum install cheese example above clearly tells you:

1) sudo gives you administrator privileges;

2) Yun is a package manager;

3) install is to let YUM install the software package;

4) cheese is the software you want to install.

This approach does not work well when executed before complex or uncommon commands. But if you want to get a rough idea of ​​what a command does, this method is worth a try.

3. Browse all available options of the command

If you are using a new command, there are two ways to view its detailed usage. One way is "man <program>", where <program> is the name of the program you want to run. For example, "man cp" will tell you the detailed usage of cp in the man file browser.

Another way to view the main usage of a command more quickly is "-help". For example, "cp -help" will print out a lot of usage of the cp command directly in the terminal. In other words, the -help option has the same meaning in all Linux commands.

4. Quick Start - Linux Command Syntax Structure

Finally, you can learn the syntax of Linux commands here! Understanding the basic syntax of Linux commands is very helpful for understanding the commands and is worth learning.
All Linux commands have the same structure:

[sudo] program [parameter] [parameter] … [parameter] [-flag] [parameter] [-flag] [parameter] … [flag] [parameter]

Let me break down the above structure into sections:

If a command requires administrator privileges (root access) to run, it must be preceded by "sudo". This will cause the administrator's password to be entered before running the command.

program is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv and firefox etc.

Without additional configuration, all commands accessible this way are placed in the /usr/bin directory. For many programs, you only need to type their name into the terminal. For example, type "firefox" in the terminal and press Enter to start Firefox.

After the program name, you can use various parameters and flags. Different programs vary greatly in this regard.

For example, the command "cp file1 file2" copies file1 to the directory where it is located and saves it as file2.

Here "file1" and "file2" are two parameters of the command "cp". Some commands also have their behavior altered by using different flags.

For example, in the command "sudo yum install cheese -y", "install" is the parameter of yum, "cheese" is the parameter of install, and "-y" is the flag of yum - when yum asks you whether to continue, the default answer is always "yes".

Note that some flags have their own parameters, while others do not. I won’t give specific examples here.

Each Linux name has its own set of logo settings, and mastering them requires a long time of accumulation.

Summarize

Learning Linux commands is really not difficult once you put your mind to it and master the basic structure of Linux commands. However, studying for a few hours generally will not produce obvious results, so please don't give up at this time. Repetition is the best way to learn. All you have to do is strengthen your memory through constant practice.

There are hundreds of commands in Linux. We don't need to remember how to use every command. We only need to remember some commonly used commands. It also takes a long time of operation practice to learn Linux well.

You may also be interested in:
  • Linux driver Kconfig file and Makefile file example
  • Detailed explanation of chkconfig command under Linux
  • Linux command detailed explanation of chkconfig command usage
  • A complete list of common Linux system commands for beginners
  • 27 Linux document editing commands worth collecting
  • Best tools for taking screenshots and editing them in Linux
  • Detailed tutorial on how to delete Linux users using userdel command
  • Two ways to completely delete users under Linux
  • Exploring the Linux Kernel: The Secrets of Kconfig

<<:  JavaScript to achieve digital clock effect

>>:  Example of implementing circular progress bar in Vue

Recommend

Implementation of React virtual list

Table of contents 1. Background 2. What is a virt...

CSS flex several multi-column layout

Basic three-column layout .container{ display: fl...

Vue implements the digital thousands separator format globally

This article example shares the specific code for...

Vue implements simple image switching effect

This article example shares the specific code of ...

Reasons why MySQL queries are slow

Table of contents 1. Where is the slowness? 2. Ha...

MySQL tutorial DML data manipulation language example detailed explanation

Table of contents 1. Data Manipulation Language (...

Detailed steps for creating a Vue scaffolding project

vue scaffolding -> vue.cli Quickly create a la...

Which scenarios in JavaScript cannot use arrow functions

Table of contents 1. Define object methods 2. Def...

How to set static IP for Ubuntu 18.04 Server

1. Background Netplan is a new command-line netwo...

Install mysql5.7.13 using RPM in CentOS 7

0. Environment Operating system for this article:...

WeChat Mini Program video barrage position random

This article shares the specific code for randomi...