Linux basic Instructions (i)

Source: Internet
Author: User

One, managing virtual machines

[[email protected] desktop]$ rht-vmctl start Desktop//Open virtual machine

[[email protected] desktop]$ rht-vmctl view Desktop//Display virtual machine

[[email protected] desktop]$ rht-vmctl stop Desktop//gracefully shut down virtual machine

Stopping Desktop.^c[[email protected] desktop]$ //ctrl+c exiting the current operation

[[email protected] desktop]$ rht-vmctl poweroff Desktop//force shutdown virtual Machine

[[email protected] desktop]$ rht-vmctl reset Desktop//Reset virtual machine and power on

[[email protected] desktop]$ gedit//Open Notepad

Second, time

Cal//Bring up the calendar of the month-H to see its parameters

Date MMDDHHMMCCYY.SS//Set time

date-d +/-digit Day//display not today's date

Date +format//Displays the time in the specified format (do not forget the plus sign)--h can view its parameters

Third, the password

Watch-n 1 Instruction //monitoring This instruction is updated every 1s

Watch-n 1 passwd-s Student


passwd//Change Password

Su-student//toggle user su Space-space user name

Passwd-l student//Lock the user's password

Passwd-u student//unlock the user password

Passwd-n 1 student//Only one password is allowed per day (minimum validity)

Passwd-x student//The password can only be locked after 30 days (maximum validity)

Passwd-w 2 student//Password period remaining 2 days reminder (warning period)

Passwd-i 3 Student//password expires after 3 days (inactive days)

Passwd-s student//view password information

Iv. File and directory operations

Cat Myfile//view file Myfile

Less Myfile//Paging view MyfileQ launch

Head-n 5 Myfile//view Top 5 rows

Tail-n 5 Myfile//view after 5 rows

WC Myfile//View files Myfile information line number of words number of bytes file name

wc-l//number of rows-w//number of words-c//bytes-m//characters


Touch file//modify timestamp of files create file

mkdir directory//Create directories

Mkdir-p directory//Iteration Create a Catalog

RM file//delete file

Rm-f file//force Delete files

Rm-r directory//Iteration first-level removal of directories

RM-RF directory//forcibly deleting directories

RM-RF *//delete current directory All

V. Common viewing instructions

History//view historical operations

! 127//Perform 127-line historical operations

Ctrl+r Enter keywords //Perform recent historical operations related to keywords

History-c//Delete all historical operation Records


PWD//Show current path

Stat file/directory//Display file/directory information

Vim File//press the editor to open files i//edit esc:q!/wq//exit


CD-//return to last directory

Cd.. //Return to previous level

CD ~//Back to home directory


LS//Displays the files and directories in the current directory

Ls-a//Displays all files and directories (included) in the current directory. .. Hidden files)

Ls-l file/directory//Detailed display file/directory

ls-d//listing the directory itself

Ls-r directory//page contents

VI. Copy move operation

MV file file1direcotry//Move file file1 into directory

MV Presence file does not exist file//rename file

MV Westos/linux. //Move Linux in Westos to the current directory. Represents the current directory


CP file File1 file2 ... Directory//Copy file File1 file2 to Directory

CP file Test//Build test file template as file

Cp-r directorydirecotry1//copy Directories

Vii. Regular Expressions

*# # #匹配0到任意字符

? # # #匹配单个字符

[[: Alpha:]] # # #匹配单个字母

[[: Lower:]] # # #匹配单个小写字母

[[: Upper:]] # # #匹配单个大写字母

[[:d Igit:]] # # #匹配单个数字

[[: Alnum:]] # # #匹配单个数字或字母

[[:p UNCT:]] # # #匹配单个符号

[[: Space:]] # # #匹配单个空格


{} indicates a nonexistent or existing

{1..9} # # #1-9

{A.. f}# # #a-F

{1,3,5} # # #135

{A,c,e} # # #a C E

{1..3} {A.. C}# # #1a 2a 3a 2a 2b 2c 3a 3b 3c


[] Indicates the existence of the

[A-c] # # #aA BB CC

[A-c] # # #aA或者bB或者c

[1-3] # # #1或者2或者3

[145] # # #1或者4或者5

[^abc]| [!ABC] # # #除了a并且除了b并且除了c

Egg

Touch Fiale fiale fi2le fi_le "fi le"

Rm-f fi[[:alpha:]]le//Match Letter

Rm-f fi[[:upper:]]le//matching uppercase letters

Rm-f fi[[:lower:]]le//matching lowercase letters

Rm-f fi[[:alnum:]]le//matching numbers

Rm-f fi[[:p unct:]]le//Match symbol

Rm-f fi[[:space:]]le//matching spaces


Touch file{1..10}

Touch File{a. Z

Touch File{a,b,c}

Rm-f file{1..10}

Rm-f file[1..9]//[] Max to 9 and can only be used to delete cannot be used to create

Rm-f file\[1..9\]//delete a file file[1..9]

rm-f [!ABC]

rm-f [^ABC]//quite with! Take Non-


Linux basic Instructions (i)

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.