Linux Common commands

Source: Internet
Author: User

Linux Common commands:

-Init [0123456], specifying the operating level of the system, similar to Windows Normal operating mode or Safe mode

-0: Shutdown

-1: Single user

-2: Multi-user status No NETWORK service

-3: Network Service with multi-user status

-4: The system is not used reserved to the user

-5: Graphical interface

-6: System Restart

The common RunLevel is 3 and 5, to modify the default RunLevel to change The id:5 of the file/etc/inittab : Initdefault: The numbers in this line

FAQ: Accidentally set 6, causing the system to start - reboot - boot loop, what to do?

-When entering the grub Boot interface, in a few seconds, enter e

-then select the second line, enter e

-In the interface that appears, enter 1"1 for Single User Level",1 need to add a space before, single user mode can modify the mode, and can change the password, Enter

-After returning, press b

-PWD, showing the current working directory (print working directory)

-Pwd-p shows the actual path instead of using the link path .

-CD, Change directory

-LS, listing files and directories

-Ls‐a, displays all files in the directory, including hidden files

-Ls‐l, display long list format

-mkdir, creating directory (make directory)

-M: set permissions for the file , set it directly , and do not control the default permissions . as : mkdir –m 711 Test2

-P: helps you to complete the directory recursion required for direct setup . ( set up multi-level catalogs , such as : TEST1/TEST2/TEST3/TEST4)

-RmDir, delete empty directory ( Note : only empty directories can be deleted , All files in the deleted directory are available : RM –RF Test

-Touch, create empty files and modify file time

-Mtime (Modification time): This is updated when the contents of the file are changed .

-CTime (Status time): When the "state" of a file changes , it is updated , such as when you change permissions and attributes.

-Atime (Access time): when "read file contents" , it will update the read times .

-Example ls-l/etc/man.config The default is to display mtime modification Time

-Ls-l--time=atime/etc/man.config display access time

-Ls-l--time=ctime/etc/man.config display status Time

-Touch [-ACDMT] file name

-A: modify access time only

-C: Modify time only , not create file

-D: date can be followed or --date="date or time" can be used

-M: modify mtime only

-T: can be followed by Time , in the format [YYMMDDHHMM]

-CP, Copy command

-----this option is typically used when copying a directory. It retains links, file attributes, and recursively copies the entries

Equal to the combination of-PDR options.

--D If the source file is the disposition of the connection file , the copy retains the link instead of the file pointed to.

--F Delete the existing target file without prompting.

-the-I and f options, in contrast, will prompt the user for confirmation before overwriting the target file. Answer y - eye

The standard file will be overwritten and is an interactive copy.

-P At this point, the CP will copy the contents of the source file, and the modified time and access rights are also copied to the new

File.

-R If the given source file is a directory file, the CP will recursively replicate all subdirectories in that directory

and files. The destination file must be a directory name at this time.

--L do not make a copy, just link the file.

-S is copied into the symbolic connection file (symbolic link), which is the "shortcut" file .

-U if the target file is older than the source file, update the target file

-To prevent users from inadvertently using the CP command to destroy another file, such as the user specified target file name already exists, with the CP command to copy the file, the file will be overwritten by the Xinyuan file, therefore, It is recommended that users use the I option when copying files using the CP command . backup generally with –a, copying files to other people generally use no parameters .

"Case"CP ‐r dir1 dir2, recursive copy command (copy subdirectory information)

-MV, move files and change file name ( rename ) ( bird brother Linux second Edition p123 page )

-RM, deleting files and directories

-RM‐RF *, delete all content, including directories and files,R for recursion,F to Force

-LN,LN [-SF] source file destination file ( Creates a symbolic connection, similar to a shortcut for creating a file )

U ( bird brother Linux second Edition p153 page )

-‐s if ln makes a hard connection without any arguments ,- s is the symbolic connection

--F If the destination file exists , the target file is actively deleted and then established .

"Case"ln ‐s/etc/inittab inittab,inittab pointing to the actual file /etc/inittab inittab

-More, show file contents with paging,Ctrl + Page up, Sky grid down

-less, displaying file contents with pagination

-grep, querying content in text

-grep [-acinv] ' search string ' filename ( bird brother Linux second Edition p233 page )

-A: Search for data as a text file in a binary file

-C: Count the number of ' search strings ' found

-I: Ignoring case is different , so case is considered the same

-N: Output line number by the way

-V: Reverse selection , which shows the line without the ' search string ' content

"Case" assumes that there is a file Aaa.java contains shunping keywords, you can use the grep name command to find, Grep-n "shunping" Aaa.java,n indicates that the nth row appears

-|, pipeline commands, on Linux and Unix Systems

-How to understand? Give the result of the previous command | The following command handles

"Case"ls ‐l/etc/| More

-Man [command], helper, similar to help in dos ; man is actually manual ( operating instructions ),

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