Linux Common commands

Source: Internet
Author: User

Enter the system terminal, we will see such characters: [[email protected] ~]#, where # represents the current root user login, if the $ represents the current user for the average.

Learn the first Linux command first:

cd command, Cd/home; parse: Enter/home directory;

Cd/root into the/root directory; CD. /return to the previous level directory; CD./current directory; (. and.. Can be understood as relative path, e.g. Cd/hom/test, CD plus complete path, can be understood as absolute path)

Next, learn more commands:

ls./view all files and directories in the current directory.

Ls-a view all files, including hidden files, to the. start file.

The PWD displays the directory where you are currently located.

mkdir Create the directory, use mkdir test, and then the name of the directory after the command.

RmDir Delete Empty Directory

RM deletes files or directories, uses RM–RF test.txt (-R for recursion,-F for coercion).

CP copy file, usage, CP old.txt/tmp/new.txt, commonly used to backup, if the copy directory needs to add –r parameter.

MV Rename or move files or directories, usage, MV Old.txt new.txt

Touch creates a file, usage, touch test.txt, or, if the file exists, modifies the current file time.

Useradd create user, use Useradd kxx,userdel Delete user.

Group create groups, use Groupadd Kxx1,groupdel delete groups.

Find file or directory, usage find/home-name "test.txt", command format: Find after the search directory,-name Specify the name of the file you need to find, name can use * to represent all. Find/home-name "*.txt"; Find all files or directories ending in. txt in the/home directory

VI Modify a file, VI has three modes: command line mode, text input mode, last line mode

The default vi opens a file, first the command line mode, and then enter: Enter the last line mode, for example enter: Wq means save exit

If you want to exit without saving, you can execute: q!,q! indicates forced exit.

Cat View the contents of the file and use cat test.txt to see the test.txt content.

More view of the contents of the file, paged view, cat is all view, if a lot of space, only see the last space. You can use cat and more at the same time, for example: The Cat test.txt |more page displays the text content, the | symbol is a pipe character used to input the output of the | previous command.

echo Echoes, use echo OK, show OK, enter what you print.

echo OK > test.txt; overwrite the OK character test.txt content,> means append and overwrite.

>> two greater than, indicates append, echo OK >> test.txt, indicates appending the OK character to the Test.txt file, does not overwrite the contents of the original file.

As a beginner, I will learn these commands, and continue to learn more commands later.

Linux Common commands

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.