Skills on five Linux terminal commands

Source: Internet
Author: User
Tags root access arch linux

Skills on five Linux terminal commands
GuideI personally use iron powder from the Gospel warriors of the new century. Therefore, I reference a line: "People are afraid of darkness, so they try to portray the outline of the flame ." For many new Linux users, the gloomy screen on the terminal is also dark-so people desperately use the GUI to replace it.

Although the graphical user interface represents the friendly side of modern computing, it is easier to use in most cases. However, sometimes the command line still has its unique advantages. With some basic knowledge, you can use the command line tool to easily solve the problem when the user interface cannot be started or requires maintenance.

For beginners, you only need to master the following five commands to easily switch to Linux.

Sudo

If commands are also divided into classes, sudo is the most worthy of respect. Sudo is very simple: it runs any command with the superuser (or root) permission. Whether updating the system or changing the configuration file, running commands with sudo is essential.

Because/mnt belongs to root, you need to use sudo to create a directory in/mnt.

Sudo also allows users to damage the system or view the privacy of other users. Because of this, the system will give the following prompt when using sudo for the first time:

We believe that you have obtained general guidance from the local system administrator. The specific content generally comes down to the following three points:

(1) respect the privacy of others.

(2) Think twice before input.

(3) the greater the capability, the greater the responsibility.

If you want to edit or modify any file outside the home directory of your own user, you often need to use sudo. To use sudo, your user must be in the sudoers file or be a member of the Super User Group (usually 'wheel' or 'sudo.

A typical sudoers file, which specifies the groups that allow root access. Please note that do not assign sudo access permissions to users or groups without passwords.

Because sudo has a huge amount of energy, if you do not know the specific role of the command, do not add sudo at will. Many of my friends may have heard of the sudorm-R/prank command, which recursively deletes every file on the system without any additional prompts from the operating system. So, as we mentioned earlier, "I think twice before I input it ."

Software Package Manager Tool

The top reason for using sudo is to add or delete programs to or from the PC through the software package manager. Although the three major software package managers mentioned here have different command parameters and syntaxes, they can all implement the same three basic functions: Install software packages, delete software packages, and upgrade all software packages on the system. (Note: Unless you log on as a root user, you need to add sudo to run these commands .)

Use pacman to upgrade the system on Arch Linux. Note that sudo is used before the pacman command.

Yum (Red Hat/Fedora/CentOS)

Installation package:

yum install <package>

Remove software package:

yumremove<package>

Upgrade system:

yumupdate
apt(Debian/Ubuntu/Mint)

Installation package:

aptinstall<package>

Remove software package:

aptremove<package>

Upgrade system:

aptupdate
aptupgrade
pacman(Arch/Manjaro)

Installation package:

pacman-S<package>

Remove software package:

pacman-R<package>

Upgrade system:

pacman-Syu

The functions of each Software Package Manager are not limited to this, but the three most commonly used functions are listed here. No matter which Linux release you choose, you should be familiar with the usage of the Software Package Manager and learn where to find instructions.

Systemctl

For a long time, the Linux background program, namely the daemon, uses a series of scripts named initscripts. For new users, initscript is often difficult to read, interpret, or modify. Recently, initscript has been replaced by a service management application named Systemd. If you are using a newer Linux release, it is appropriate to learn how to use Systemd to start the services you need.

Disable and re-enable the NetworkManager service during boot

There are a variety of functions that can be implemented using Systemd (Unix programs usually focus only on one function and achieve its perfection). However, the following five keywords should be considered when using systemd.

When starting the service, use the start Keyword:

systemctlstart<servicename>

Similarly, if you need to restart a faulty service or change its configuration, use restart:

systemctlrestart<servicename>

To stop the service, use stop:

systemctlstop<servicename>

Enable:

systemctlenable<servicename>

Finally, use disable to disable Service Startup at boot:

systemctldisable<servicename>
Ls

Although simple and intuitive, the role of ls is beyond everyone's ideas. In terms of the effect, the ls command can list all files and folders in a specific path. By default, it lists the files and folders in the current working directory (usually the user's main directory. Of course, you can also use it to find content in a specific path.

You can add multiple options for the ls command. The most common option is-l, which displays the File Permission and ownership.

So why does ls play such an important role as the dir of Linux? First, it helps you find subdirectories in the configuration file. It can also view the file name in a certain environment without the need for GUI. Linux File Names and commands are case sensitive, so they can easily understand the exact spelling method. In short, you can use ls as your own reconnaissance plane to explore peripheral systems.

Man

Sometimes, we may need help but cannot access the Internet. In this terrible situation, man can help everyone out of the predicament.

In fact, the man command is manual, short for the manual, which can display the information stored in the computer in "online" mode. If you need to understand the role of chmod, you only need to enter man chmod in the terminal. In addition, you can use the up and down arrows or PgUp and PgDn keys to flip pages. After reading, press Q to exit.

Ls command manual page

Despite man's great help in the absence of the Internet, Google is still the most powerful tool for obtaining resources. It should be pointed out that the first display in Google's search results is a web version like man's page.

Summary

Of course, the Five Commands introduced today are just the beginning. You also need to learn more commands to better understand your Linux system. Although tasks can be completed in multiple ways on the GUI, console commands are still the fastest way to update the system.

In addition, console commands also have unique advantages in displaying error messages. This means that when a software package fails or cannot access the Internet, the command line can better solve the current problem.

All in all, as long as you are diligent in practice, everyone can confidently use terminal commands to deal with all kinds of work and life needs.

From: http:// OS .51cto.com/art/201611/521327.htm

Address: http://www.linuxprobe.com/linux-order.html


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.