Linux common commands that need to be memorized

Source: Internet
Author: User

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

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

Next, continue to learn more commands:
ls./ View all files and directories in the current directory.

ls-a view all files, including hidden files , in . the beginning of the file.

pwd Displays the directory where you are currently located.

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

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 –r parameters.

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 find a file or directory, usage 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 "Technical Achievement Dream" blog, please be sure to keep this source http://jokes.blog.51cto.com/9004589/1834099

Linux common commands that need to be memorized

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.