Common Linux commands

Source: Internet
Author: User

1. Man provides help explanations for familiar or unfamiliar commands

For example: man ls, you can view the LS-related usage.

Note: Press Q or Ctrl + C to exit. in Linux, you can use Ctrl + C to terminate the currentProgramRun.

2. ls view the directory or file owner * and list the files under any directory

Eg: ls/usr/man

Ls-l

A. D indicates the directory. If it is a "-", it indicates a file. If it is l, it indicates a connection file (link)

B. Permission for file or directory permission. Read (R), write (w), and run (x) respectively ).

3. Copy files using CP

Eg: CP filename1 filename2 // copy filename1 to filename2

CP 1.C netseek/2.c // copy 1.C to the netseek directory and name it 2.c.

4. rm delete files and directories

Eg: Rm 1.C // Delete the. c file.

5. Remove the directory or change the file name.

Eg: MV filename1 filename2 // rename filename1 to filename2

MV qib. tgz ../qib. tgz // move to the upper-level directory

6. Change the current directory pwd on CD to view the complete path of the current directory

Eg: Pwd // view the current directory path

CD netseek // enter the netseek directory

CD // exit the current directory

7. Cat, more command

Displays the content of a file. The two commands are different: cat prints the file content all the time, and more is displayed on the split screen.

Eg; CAT> 1.C // you canCodePaste the post to the 1.C file and press Ctrl + D to save the code.

Cat 1.C or more 1.C // you can view the content in it.

Gcc-O 1 1.C // compile 1.C into the. exe file. We can compile the Code with this command.

8. Modify the CHMOD command permission usage: chmod one-digit octal number filename.

Eg: chmod U + x filenmame // you only want to run the command for yourself.

The u table shows the file owner. G indicates the group where the file is located. O indicates others; r table readable; W table writable; X table can run

Chmod g + x filename // the same group of people to execute

9. Clear, date command

Clear: clear screen, equivalent to CLS in DOS; date: displays the current time.

10. mount a hardware device

Usage: Mount [parameter] device load point to be loaded

Eg: Mount/dev/CDROM

CD/mnt/CDROM // enter the CD directory

11. Su switches to another person's identity without logging out.

Usage: su-l user name (if the user name defaults, the user name is switched to the root state)

Eg: su-l netseek (switch to the netseek user and the user will be prompted to enter the password)

12. whoami, whereis, Which, ID

Whoami: confirm your identity

Whereis: query the command directory and help document directory

Which: query the directory where the command is located (similar to whereis)

ID: print your UID and GID. (UID: the unique ID of a user. GID: the unique ID of a user group. Each user can have only one unique UID and gid)

Eg: whoami // display your login user name

Whereis bin: the directory where the bin is located. The directory is/usr/local/bin.

Which Bin

13. grep, find

Grep: Text Content Search; find: file or directory name and permission owner matching search

Eg: grep success */* Find all files in the current directory that contain success characters

14. Kill can kill a running or DEST process.

Eg; PS ax

15. passwd can be used to set a password

16. commands used by the history user

Eg: History // displays the commands used by the user in the past.

17 .!! Execute the last command

18. mkdir command

Eg: mkdir netseek // create the netseek directory

19. Tar decompression command

Eg: tar-zxvf nmap-3.45.tgz // extract this to the nmap-3.45 directory

20. Finger allows users to query data of other users

Eg: Finger // view the user's usage information

Finger root // view the Root Information

21. Touch creates a file

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.