linux--Common Commands

Source: Internet
Author: User

Content of the lesson:

Linux system origin

Various common commands for Linux and familiarity with command parameter options:

Directory Operations Command ("jump; View your current location-absolute path; View directory contents under any path" PWD (Print working directory); ls;cd; "Create; copy? ; Move/rename? Delete, archive, compress, extract "Mkdir;cp;mvdir;rmdir;" directory Permissions "chmod)

File Operations Command ("create; copy; move/rename; Delete" VI;CP;MV;RM; "File display": Cat;more;less;head;tail; "File Permissions" CHOMD; "Statistics" WC)

Standard output/Screen/command-line commands ("clear screen" clear; "Show" echo "link" ln-s)

SOS command: ( online Help command Man;--help)

Junior Play/Lazy command-("Auto-complete command" <Tab> "" "" "")

Senior Play/Lazy command-(shell script)

Vi

Comments

1. PWD (print working directory): Print out the current directory

2, LS (list): Lists, lists

Syntax: ls [parameter] path/file name/folder name

Features: Listing information for a file or subdirectory

Parameter:-A: Displays all files, including hidden files starting with.

-L: Display file or subdirectory information in long format

-I: Displays the index (node) number of each file

-R: Display directory and subordinate subdirectory structure

-S: Sort by file size

3. CD (change directory): Changing the current directory

CD ~ CD, CD $HOME # back home directory

CD./#跳转到当前目录

Cd.. /#跳转到上层目录

4.mkdir (Make Directories): Create directory

Syntax: mkdir [parameter] directory name

Parameter:-P: When the directory is established, if the parent directory does not exist, then it can be established with subdirectories, that is, multiple multi-level catalogs can be established at one time

-M: Specify Permissions

     

Eg:mkdir-p- m Dir2/bak

5.CP (first approximation)

6.mvdir (move directory): Move directory #必须在一个文件系统

7.rmdir (remove directory): Delete directory

Syntax: rmdir [parameter] directory name

Parameter:-P: When you delete a parent directory together, there should be no other directory under the parent directory.

Eg:rmdir-p longkey/test #删除当前目录下的longkey The/test directory, and when the test directory is deleted, if there is nothing else under the parent directory Longkey, the Longkey directory is also deleted.

8.vi

Naming rules: Numbers, letters, underscores

9.CP (copy): Copy

Syntax: CP [parameter] file_1 file #复制file_1到file

CP [parameter] file_1 file_2 ... file_n directory #将文件file_1到file_n都复制到directory目录下

     CP [parameter] directory1 directory #复制目录directory1到目录directory

CP [parameter] directory1 directory2 ... directory_n directory #复制目录directory1 .... directory_n to Directory

Parameters:

10.MV (move files): Move or change an existing file or directory

Syntax: MV [parameter] file directory #移动file文件到directory目录下

mv [parameter] file_1 file_2 ... file_n directory #将文件file_1到file_n都移动到directory目录下

mv [parameter] file_1 file_2 #把文件file_1文件名字改为file_2

Parameter:-F: Disable prompt

-I: When a destination file or directory exists, prompt for overwrite

11.rm

12.cat (concatenate files and print on the standard output posted): Merge files and print output standards release

Syntax: Cat [parameter] File

Eg:cat file #显示文件内容

Cat-n 5 File #显示文件第五行内容

Cat File1 >file2 #复制file1到file2中

Cat file_1 file_2 file_n >file #将file_1到file_n文件依次粘贴到file文件中

Cat File1 >> file2 #将文件file1复制到file2文件后边

cat >file #建立简短文本文件, Ctrl+d end

13.more

Syntax: more [parameters] File

Eg: morefile #分屏显示file的内容

LS |more #查找相关目录, file

Ls-al |more #详细查找相关目录, file information

Ps-ef |more #查找相关进程信息

14.less

15.head

Syntax: Head [parameter] file

Parameter:-N number: Displays the first number line of the file

-C Number: Displays the first number characters of a file

By default, the head displays the first 10 lines of the file

16.tail

Syntax: tail [parameter] file

Parameter:-f: Causes the command to enter an infinite loop

    The number after-N number:number is a byte shift, the default is 10

Line displacement after-C Number:number, default is 10

17.chomd

18.WC: File Content Statistics

Syntax: WC [parameter] File

Parameter:-C: Count bytes

-L: Count rows

-W: Count words

19.clear

20.echo

21.ln (link): Establishing a connection

Syntax: ln [parameter] Destination connection name

Parameter:-S: Establish symbolic link (soft link symbolic link)

Do not add- s parameter: create hard link

target: source file or directory

  Function:

22.man

23.--help

27, timely interruption: Ctrl + C

Teaching Objectives:

Understand why Linux is chosen?

Familiar with the basic operation of some Linux commands

Familiar with the use of some Linux command parameter options

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.