Common commands and scenarios for Linux applications

Source: Internet
Author: User

I believe many of the small partners who are ready for Web development and testing want to know about the common commands of Linux.

First of all, I'll show you the commands, a basic impression, and then go on.

Common Commands and explanations

Linux commands Command description
Cd Directory switching
Pwd Show current directory path
Mv Move files or directories
Tar Decompression and compression
Cp Copy or cut
Touch Create a file
Mkdir Create a folder
RmDir Delete a folder
Rm Delete
chmod Change permissions
Cat Show file contents
More Pagination Display
Head Show file Header
Tail Show end of File
Vim File editing
Grep Pipeline
Wc Statistics

Here is a first introduction:

1, the first to play is the CD command, this is the directory Switch command, you need to jump to any directory

Note: Directories under the Linux root directory are: usr, home, etc, bin, dev

For example, I want to switch to home directory CD home or CD ~

Other commands, CD. (to the top level of the directory), CD/(to root), CD. /(to current directory), CD-(returns the previous level in the history)

2, PWD, this command does not introduce more, is used to display the current directory path command

3. Scene Learning

For example: I want to see the first 10 lines of a log file

Command: Head-n My.Log

For example: I want to see the last 10 lines of a file

Command: Tail-n My.Log

For example: I want to see the first 10 lines of "Hello" in the file

Command: cat-n my.log|grep "Hello" |head-n 10

4. The difference between grep and find

Find files by file properties

grep finds related file lines through content

Find-name OK or find/home/my/-name OK (note the location of the directory after the Find command)

grep is commonly used in conjunction with pipelines, but can also be used independently

grep "OK" my.txt find the line containing the OK keyword in the file my.txt

Common commands and scenarios for Linux applications

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.