Basic commands under Linux and common shortcuts under the terminal __linux

Source: Internet
Author: User
Tags mkdir

Common commands:

Table 1-1

Command

Description

Directory and file Processing:

Before we explain, we'll get to know a couple of funny symbols.

. : Small point live in the present, namely the current directory. For example:./jie_work executes the jie_work file in the current directory

.. : Run up to two points, both to the current top level directory. For example, a command CD. Modify the current working directory to the previous level directory

~: The water wave takes me home, namely/home/my login name. For example, my login name is ZHANGJIE,CD ~ command is Cd/home/zhangjie. Of course you can just type in a CD and have the same effect.

-: The minus sign returns the last working directory. For example, the current working directory is dira, you switch to the DIRB directory through the CD command, and now you type the CD--that is, switch to the last working directory, which is dira, and then switch to DIRB again, Because this is DIRB is already the last working directory relative to Dira.

Mkdir

Create a Directory

Usage: mkdir [OPTION] DIRECTORY ...

Example: mkdir Fangru

Ls

Listing the contents of a directory

Usage: ls [OPTION] ... [FILE] ...

Example: Ls-al Fangru

Cd

Replace working directory

Usage: CD [DIRECTORY]

Example: CD Fangru

Pwd

Show Current working directory

Usage: pwd

Vim

Enhanced version Text Editor

Usage: vim [OPTION] [file]

Example: Vim HELLOWORLD.C

Cp

Copy files and their directories

Usage: CP [OPTION] ... SOURCE DEST

Example: CP jie.txt Jie.bak

Mv

Move (rename) file

Usage: MV [OPTION] ... SOURCE DEST

Example: MV Jieold jienew

Rm

Delete a file or directory

Usage: RM [OPTION] ... FILE ...

Example: Rm-rf jie_dir

Find

Locating files in directories and their subdirectories

Usage: Find [OPTION] [path] [pattern]

Example: Find-name jie*.txt

History

Show recently used commands

Usage: History

Text Processing:

Before you explain, it is necessary to explain the definition of the pattern.

A pattern is an expression that does not list all elements, but rather a precise description of a series of strings

For example: AB*CD matches a series of strings starting with AB and ending with a CD

Cat

Link file Print to standard output

Usage: cat [OPTION] [FILE] ...

Example: Cat pic.png love.txt > Pic1.png

Remember the story of the command line.

Echo

Show one line of text

Usage: echo [OPTION] [string]

Example: Echo $HOME

Grep

Search for specific content and export the lines that contain the content to the standard output

Usage: grep [OPTION] pattern [FILE]

Example: Grep-i jagen magicLinux.txt

Wc

Counts the number of bytes, words, and rows in the specified file and displays the results to the output

Usage: WC [OPTION] ... [FILE]

Example: Wc-l magicLinux.txt

Sort

To sort the rows in a file

Usage: sort [OPTION] ... [FILE]

Example: Sort-r magicLinux.txt

System Management:

Before explaining this kind of command, let's talk about the definition of file permissions. There are three types of permissions on Linux systems-read, write, and execute. After typing the ls-l command, we will find that there are 10 letters representing the file type and permission information: The first letter is the file type, D is the directory,-represents the normal file, each of the three letters is a group, representing the owner (owner) group members (groups) other people (others) read , write, and execute permissions.

Example: drwxrw-r--means that this is a directory where the owner has read, write, and execute three permissions, the group members have read and write access, and others have only read access.

The permission bit can also be represented by the corresponding number, read-4, write-2, execute-1, these numbers or their and their and represent the permissions of a role.

Example: rwxrw-r--= 764

673 = Rw-rwx-wx

chmod

Controlling user permissions on files

Usage: chmod [OPTION] [MODE] [FILE]

Example: chmod 764 count.sh

Chown

Change the owner of a file

Usage: chown [OPTION] ... Owner[:[group]] FILE

Example: Chown Jie magicLinux.txt

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.