Linux Common commands

Source: Internet
Author: User

Command format command +[optional parameter]+ file or directory CD command cd/home-enter the/home directory CD. /return to the previous directory PWD displays the current directory LS./view all files and directories in the current directory ls-a view all files, including hidden files, to. start file ls./-A To view all files in the specified folder ls [directory] | More page-by-page display for easy viewing of all files in a directory
ls-l [file name] View file permissions; do not add [filename] to view the details of all the files in the current directory, plus [directory name] means to view the details of all the files under the [directory name].
ls-ld [Directory] View directory permissions, do not add [directory] to see the current directory details
mkdir Create a directory, the command is followed by the directory name, or you can create a directory in the specified directory Mkdir/root/test
mkdir-p [Directory path] Create a recursive directory, the parent directory does not exist also automatically created  rmdir delete empty directory rm Delete file or directory, usage rm-rf [filename/path file name] (-R for recursion,-F to force) CP copy File  CP [ source file path] [target path]    Copy directory  cp-r [directory path] [target path] The current directory can be used./for MV 1. Renaming usage mv Old.txt new.txt   2. Moving files or directories m v [source file path] [destination path]   touch Create a file such as Touch Test.txt if the file exists, it means to modify the current file time Useradd create user useradd xiaowei   Userdel Delete user Groupadd Create group  groupadd zu    groupdel Delete Group find find files or directories find [in which directory to find]-name ["filename" or   "*. Format"] with "file name" or "*" . suffix name " cat   View file contents   such as Cat Test.txtvi  linux Editor, vi test.txt jump to new interface, input keyboard I into edit mode, press ESC, enter: WQ   then enter save exit, if you want to exit without saving, execute: q! (also without exclamation point, exclamation point indicates forced exit)   input:%d means empty content, X directly save and exit; the front Plus # indicates that this line of command does not perform  more view file content, Page view, cat is all view, use cat to view files, if much space, You can only see the last length of the space; use both cat and more, such as Cat Test.txt | More page shows the test content, | The symbol is a pipe character, used for the output of the previous command as the input echo echoes, use echo OK, will show OK, enter what to print echo OK > test.txt; append and overwrite the single-line OK character to test.txt content,> means append and overwrite the meaning,>> two greater than symbol, meaning append does not overwrite, echo OK >> Test.txt indicates that an OK character is appended to the Test.txt file and does not overwrite the contents of the original file.


History view commands for historical input

Linux Common commands

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.