Linux Beginner Essentials Command

Source: Internet
Author: User

By default Enter the system, we will see such characters: [[email protected] ~]#, where # represents the current root user login, if the $ represents the current user as normal.


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

Cd/root enter 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)


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

ls -A view all files, including hidden files, beginning with.


pwd Displays the directory where you are currently located.


mkdir Create the directory, use mkdir test, the name of the command followed by the directory, and the-p parameter can be created at the same time.


rmdir Delete empty directory


RM To delete a file or directory, use RM–RF test.txt (-R for recursion,-F for coercion).


CP Copy files, usage, CP old.txt/tmp/new.txt, commonly used to backup; if copy directory

You need to add the-r parameter.


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


Touch Create a file, usage, touch test.txt, if the file exists, it means to modify the current file time.


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


Groupadd Create a group, use Groupadd wugk1, Groupdel delete the group.

Find To find a file or directory, use Find/home-name "test.txt", the command format is:

Find after you find the directory,-name specifies the name of the file that needs to be looked up, and the name can be used to represent all.

Find/home-name "*.txt"; Find all files or directories that end with. txt in the/home directory.


VI to modify a file, VI has three modes:

command-line mode, text input mode, and last-line mode.

Default VI open a file, the first is the command line mode, and then press I into the text input mode, you can write characters in the file and so on information.

After writing, press ESC to enter command mode, then enter: Enter the last line mode, for example, enter: Wq means save exit.

If you want to exit directly, do not save, you can do: q!, q! exclamation mark indicates forced exit.


Cat View the contents of a file, use cat test.txt to see Test.txt content


More viewing the contents of a file, paging through it, Cat is all viewed, and if you have a lot of space, you can 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 Echo , the usage echoes OK, will show OK, enter what to print what.

echo OK > Test.txt The OK character overwrites the test.txt content,> means append and overwrite.

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


This article is from the "canvas shoes can walk the cat step" blog, please be sure to keep this source http://9409270.blog.51cto.com/9399270/1709407

Linux Beginner Essentials Command

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.