Linux basic commands

Source: Internet
Author: User

Ctrl+alt+t: Virtual machine Open command line

Virtual machine root user forgot password: reset password: sudo passwd root-switch to ROOT-SU root

1. Basic shortcut keys

Ctrl+d keyboard input end or exit terminal

CTRL + A moves the cursor to the input wardrobe

Ctrl+e move the cursor to the end of the input line

Ctrl+k Delete from the cursor position to the end of the line

Tab Completion-command. Directory

2. Linux file permissions

Ls-l Viewing file permissions

d (file type) rwx (owner rights) R-x (owning user group permissions) r-x (other user rights)

LS-DL < directory name > show file Size

3. Modify File Permissions

Chmod <file>

chmod go-rw iphone6 g, O and U respectively represent group, others, and user,+ and-respectively, adding and removing the appropriate permissions.

4, touch new blank files Touch file

5. New

L mkdir new directory mkdir Mydir

L mkdir–p Father/son New Multilevel Directory

6. Copy

L CP Copy files to the specified directory CP file Father/son

L cp–r Copy directory Cp–r mydir father

7. Delete

RM Delete Files RM file

Rm–f forcing files to be deleted

Rm–r Delete directory Rm–r father

8. Moving files

MV Original directory file destination MV File1 Mydir (cut)

9. Renaming files

MV old filename New file name MV File1 file2

10. View Files

Cat is a positive sequence display

TAC for reverse display

Cat–n Test Display line number

Head view first ten lines tail view end 10 rows (more for viewing log files)

11. Search for Files

Which to determine if a specified software is installed

Find find [path] [option] [action]

sudo find/etc/-name interfaces

12, file packaging and decompression

L ZIP

? Package : Zip-r-q-o Shiyanlou.zip/home/shiyanlou

The-r parameter indicates that the recursive package contains the entire contents of the subdirectory, and the-Q parameter is expressed in quiet mode, that is, not outputting information to the screen,-O, representing the output file, followed by the packaging of the output filename.

? to view the size of a packaged file : Du–h shiyanlou.zip

Compatible with win: Zip-r-l-o Shiyanlou.zip/home/shiyanlou

Unzip–o GBK Chinese compressed file. zip (capital O)

? decompression : Unzip Shiyanlou.zip

? Specify directory: Unzip shiyanlou.zip–d ziptest

Ls–r Ziptest

L Tar

? Package : TAR–ZCVF Shiyanlou.tar Something

-cRepresents the creation of a tar package file that -f specifies the file name created by the –v visualization

? Unpacking to the specified directory: TAR–ZXVF shiyanlou.tar–c tardir

13. Permission class:

? Modify the owner of the directory: Chown-r apache:apache/home/www/web

? Modify permissions for the directory: Chmod-r 777/home/www/web (chmod go+rwx iphone6)

14. Service

? Systemctl start Nginx

? Service start-up: Systemctl enable Nginx

? Restart Service: Systemctl Reload Nginx

15. Help command:

L Help

Built-in command: Help CD

External command: LS–HELP

L Mans

Man LS content more than help

Info ls

16. Regular Expressions

() the part that is to be extracted, matches one of the preceding characters

. Point matches any string

? 0 Times , one time

+ once, many times

* 0 Times , one time, multiple shi* (can match: shi, shii, sh, shikjksdkjd)

|   vertical separators indicate selections, such as "Boy|girl" to Match "boy" or "Girl"

[List] matches any single character in the list

[!list] matches characters other than any single character in the list

[C1-C2] matches any single word in c1-c2 such as: [0-9] [A-z]

{String1,string2,...} Match string1 or string2 (or more) one string

{C1.. C2} matches all characters in c1-c2 such as {1..10}

17. Install the Software

Ubuntu

Installation: Sudo apt-get install w3m

Reload: Sudo Apt-get–reinstall Install w3m

Uninstall: Sudo apt-get Remove w3m

Search software: Sudo apt-cache search w3m

Linux basic 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.