Linux mimics the UNIX habits of Use

Source: Internet
Author: User
Tags diff

Linux mimics the UNIX habits of Use

Shell

The program used to run system directives

Can invoke other system directives in the system

Instructions can be combined into scripts to execute

The original Shell:bourne Shell (Bell Labs)

The most commonly used Shell:bourne-again Shell (bash)

Commonly referred to as terminal

Command prompt

[Email protected]:path$ General User

[Email protected]:path# root User

Basic shell command

Cat is used to display the contents of a file (merge displays multiple file contents)

Input/Output

The standard input output is called Stdin/stdout

Third Standard flow stderr

Ctrl-d End Current input

Ctrl-c no matter what the current situation forces the end

Bash provides alphabetical completion by tab

Ls

List current directory

-L

Details (permissions, Inode, owner, genus, size, modification time)

-A

Show include hidden content

-D

Display only the directory's own information

-I.

Display Inode Information

-S

Sort by file size

-R

Reverse order

-T

Sort by modified time

-H

File size is displayed in a way that can be read

ll

Ls-la

Cp

Copy

CP file1 File2

CP file1 File2 dir/

-r/r

Copy a directory and all of its contents

-L

Hard-link copy (Ls-li)

-S

Soft link Copy

-S

Suffix after target name

-U

New-time copy of source than target

Mv

Move

MV File1 File2

MV File1 File2 dir/

-F

Force move, overwrite target

Touch

Create an empty file

If the file name already exists, do not modify the content, modify the file Mtime

Touch file

Rm

Delete

RM file

RM-RF dir/

-I.

Every reminder before deletion

-D

Delete Empty Directory

Echo

Show command parameters in stdout

echo "Hello word"

-N

Show end No Line break

-E

Interpreting backslash transfer characters

ECHO-E A\\NB

Echo $HOME

Directory Structure related

~

Represents the Home directory

Absolute path

From/Start, directory end, such a full path

cd/home/user1/desktop/

Relative path

Direct CD current directory subdirectory name

CD desktop/

.

Represents the current directory

..

Top level Directory

Mkdir

Create a Directory

-P

You can create multi-level catalogs

Cd

Switch to Directory

RmDir

Delete Empty Directory

-P

You can delete a series of empty directories

Wildcard characters

# #root下关闭防火墙 # # #centos7 www.tiaotiaoylzc.com systemctl stop firewalld.service systemctl disable Firewalld.service # CENTOS6 www.yongxinzaixian.cn service iptables stop chkconfig www.douniu1956.com/iptables off www.tiaotiaoylzc.com # # Under Root, turn off Safe Mode # # #1. Permanently effectively modifies the selinux= "" in the/etc/selinux/config file to Disabled, and then restarts. #2. Immediate effect Setenforce 0

* All Objects

*1* file name consists of 1 files

Pwd

Show current Full Catalog

-P

Physical path (view the true path of the soft link)

-L

Logical path

Grep

The line that crawls the required content

grep root/etc/passwd

grep r*/etc/passwd

grep root/etc/*

-I.

Ignore case

-V

Reverse match

-N

Show line Numbers

-R

Recursive directories and all files in subdirectories

-C

Displays the number of lines in the target file that contain keywords

Grep-f 1.txt 2.txt matches multiple keywords in 1.txt simultaneously

grep a[123] a.txt simultaneous matching A1,A2,A3

Grep-e ' 1|2|3 ' a.txt or 1 or 2 or 3

Less

Show output on one page at a time

Shortcut keys

Z/b

Page forward/back

V

Enter edit mode

G/g

Jump directly to the first row/last row

/word

Search for keywords Forward

? Word

Search for keywords backwards

n/n

Forward/reverse Continue search keywords

Q

Exit

Head

Display the contents of the file header (the first 10 lines are displayed by default)

-N

n is the specified number of rows

Tail

Show end of file (10 rows by default)

-N

n is the number of rows to be set

-F

Real-time display of trailer content ==tailf

Diff

Comparing text files

diff a B

A-add, more than 2:1 files, C-change, different content, d-delete files more than 1:2

-U

Unified format output (---file 1,+++ file 2)

-Y

Parallel Output comparison (|, different, <, file 1,>, file 2)

-W

Ignore spaces

-I.

Ignore case

can also be used to compare folders

File

Detecting file formats

Sequential execution of three test sets

FileSystem: Matching System header file <sys/stat.h>

Magic: Match the file's head to magical values,-l parameter view

Language: The character type that matches the start of the file, ASCII, UTF-8

A Test match is stop detection, all mismatch returns data

-F

File list

-ib

MIME type

Locate

Search based on a file index

Fast, but not accurate.

UpdateDB

Update index

Find

Search for files

Find/-name Abc*.txt

Find. -type b c D F |

Find. -user user1

Find. -mtime +1-mtime-20 (atime,ctime,amin,mmin,cmin)

-cnewer file

Find files that are newer than this file

Stat

View the details of a file

which

Access: Accessing Time

Modify: Modification Time

Change: Modify Permission Time

Sort

Sort

-R

Reverse Sort

-N

Sort by numeric size

-M

Sort by month (' JAN '----' DEC ')

Ls-l--sort=key

command-line shortcut keys

Ctrl-b

Left

ctrl-f

Right

Ctrl-p

up

Ctrl-n

down

ctrl-a

cursor to the beginning of the line

ctrl-e

Cursor to end of line

ctrl-w

Delete contents before cursor to space

ctrl-u

Delete cursor to the beginning of the line

ctrl-k

Delete cursor to the beginning of the line

ctrl-y

Paste the last deleted content (last deleted in copy)

All Linux pairs are files

A running file is called a process

Linux mimics the UNIX habits of Use

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.