Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Four methods of quickly self-learning Linux command

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

If you want to be a Linux master, it is essential to master some Linux commands. Here are four ways to teach yourself the Linux command.

Daily Tips

One gradual way to learn the Linux command is to have it display a "daily prompt" each time you open the terminal. This will introduce you to some useful commands and their advanced techniques.

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

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

All you have to do is add this line! If you want to make it more entertaining, you can install cowsay. Install cowsay under Ubuntu/Debian:

Sudo apt-get install cowsay

Install cowsay under Fedora:

Yum install cowsay

In addition to installing cowsay, you need to add 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 under all Linux distributions.

Second, use "whatis"

If you don't like learning random commands, maybe you like to learn its usage when using a certain command. At this point, you just need to add whatis in front of it.

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

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

1) sudo gives you administrator privileges

2) yun is the package manager

3) install allows YUM to install the software package

4) cheese is the software you plan to install.

This method does not work well in front of complex or unusual commands. But if you want to know the general purpose of a command, it's worth a try.

Browse all available options for the command

If you are using a new command, there are two ways to see its detailed usage. One way is "man", where 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 quickly look at the main usage of a command-"- help". For example, "cp-help" prints out a large number of uses of the cp command directly in the terminal. In other words, the-help option has the same meaning in all Linux commands.

IV. Quick-Linux command syntax structure

Finally, you can learn the syntax of the Linux command here! Understanding the basic syntax of Linux commands is good for understanding 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 analyze the above structure in sections:

If a command requires administrator privileges (root access) to run, you must precede it with "sudo". This allows the administrator's password to be entered at the point where the command is run.

Program is the name of the application. It includes yum, apt-get, cheese, tar, cp, mv, firefox and so on.

Without additional configuration, all commands that can be accessed through this method are placed in the / usr/bin directory. For many programs, you only need to enter their name in the terminal. For example, type "firefox" in the terminal, then press enter, and Firefox will run.

After the name of the program, you can use different parameters and flags. Different programs vary greatly in this respect.

For example, the command "cp file1 file2" makes a copy of file1 in the directory where it is located and saves it as file2.

Here "file1" and "file2" are two arguments to the command "cp". Some commands also change their behavior by using different flags.

For example, "install" in the command "sudo yum install cheese-y" is the parameter of yum, "cheese" is the parameter of install, and "- y" is the flag of yum-when yum asks you if you want to continue, it always answers "yes" by default.

It is important to note that some flags have their own parameters, while others do not. No specific examples will be given here.

Each Linux name has its own set of logo settings, which take a long time to master.

Summary

Learning Linux commands is really not difficult once you have made up your mind and mastered the basic structure of Linux commands. However, generally speaking, studying for a few hours will not have an obvious effect, so please don't give up at this time. Repetition is the best way to learn. What you need to do is to strengthen your memory through constant practice.

There are hundreds of commands in the Linux system. We don't need to remember how to use each command, we only need to remember some commonly used commands, and it takes a long time of operation practice to learn Linux well.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report