Linux Basic Command 1

Source: Internet
Author: User

1 Creating a directory/data

Mkdir-p/data

-p recursively create a directory to create a multi-level directory

2 tree Displays the table of contents in the shape of the trees

-L 1 shows how many layers are viewed only one level of directory

-D Show only directories

3 LS list lists contents in directory

-L Letter Long long format display details

-D View directory (treats directory as normal file)

-a show hidden information including hidden files

-F Add different flags to different files

-P only adds tags to directories, and other types of files regardless

-R Reverse Flashback display content

-t sort by file modification time

Ls-li Display the index node of the file

Ls-h is displayed in human form.

4 Entering the directory, changing the directory that is currently in use

Cd/data

CD-Back to last catalog

Cd. Current directory

Cd.   . Return to the top level directory

CD ~ Current user's home directory

5 pwd Linux compass, show current location, print current working directory

6 Touch, create file (timestamp of modified file)

Touch-d "2016-3-13" + File name modification time of file

Touch-s time to modify the system

7 Vi/vim Vim Editor is a text editor

I/O Insert edit mode

ESC key goes to command mode again

: Wq Save Exit

W Write

Q quit

: Q! Force exit

: Set NU Displays line numbers when editing files in VI

: Set Nonu suppress line numbers

G to end of file

GG to the first line of the file

o Insert a blank line in the next line of the current row and enter edit mode

DG deletes the line of the cursor to the last line of the file

DD deletes the cursor in the row

D Delete cursor position to end of line

Dnd

P Paste

YY copy when moving forward

: 1,15COPY15 copy 1 to 15 rows

8 echo output to the screen

Note: single quotes, double quotes, and no quotation marks are the difference between

Parameter:-n does not output carriage return newline symbol

-E Open Escape symbol

Echo's Special use: Echo can also append multiple lines

Cases:

echo "123

321

456

654

Abc

CBA ">>/xinjia

Cat/xinjia

321

456

654

Abc

Cba

9 Cat Viewing file contents

(1) Multi-line Append

Cat >>/data/oldboy.txt<< EOF

I

Am

Oldboy

Linux

Eof

(2) cat-a displays all contents, including spaces

Cat-n Display Line numbers

CP copy copy files or directories can only copy files by default

-A =-PDR

-p copy files while keeping file attributes intact

-R recursive replication, directory and future generations

-T develop CP format first target cp-t target source

CP Copy file Format:

CP Source File Destination file

This article from "Xiao Xin" blog, declined reprint!

Linux Basic Command 1

Related Article

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.