Shell (10) commonly used command. Doc

Source: Internet
Author: User
Tags unzip tar file
Ls

-L, show the hard link count;

-I, show I-node

-H, human readable

-T, sort by modify time

-S, sort by size

-R, -- reverse

-R, show content of sub-Dir

-V, sort by version

 

CP

-P,
Retain source file attributes, such as the modification time

-L, create hard link

-S, create soft link

-R, copy dir

-R,
Recursively copy a file

 

Stat

Show more info of a file

 

Mount

Null parameter, show all mounted file
Systems

Mount-T Type Device directory

-A, mount add file systems according
/Etc/fstab

 

"Mount
-T iso9660-o loop ABC. iso mnt ", Mount ISO file

 

Simple usage
:

FAT32
Partition

Mount-O codePage = 936, iocharset = cp936
/Dev/hda7/mnt/CDROM (Mount-T vfat-O iocharset = cp936/dev/hda7/mnt/CDROM)

NTFS
Partition

Mount-O iocharset = cp936/dev/hda7
/Mnt/CDROM

ISO
File

Mount-o loop/ABC. ISO/mnt/CDROM

Floppy Disk

Mount/dev/fd0/mnt/floppy

USB
Flash Memory

Mount/dev/sda1/mnt/CDROM

Description
:/Mnt/CDROM
The directory must exist.

All
/Etc/fstab
Content
Mount-

 

File format can be specified
"-T

Format
",
The format can be
Vfat, ext2, ext3
And so on
.

 

Start
Mount
Upper
Windows
Partition

Automatically
Windows
Of
D
Disk mounted
/Mnt/d
.
VI
Open
/Etc/fstab
, Add the following line

/Dev/hda5/mnt/d vfat
Defaults, codePage = 936, iocharset = cp936 0 0

Note: you must first create
/Mnt/d
Directory

Mount
Others on LAN
Windows
Directory shared by the machine
(Bjchenxu)

Mount-T smbfs-o
Username = guest, password = guest // machine/path/mnt/CDROM

 

DU/DF

-H, human readable

-C, show count info of all file listed

-S, show statistic info only

Du-SH

 

Sort

Sort by characters by default

-N
To recognize numbers as numbers for sorting.

-M, sort by month

-R, -- reverse

-B, -- ignore-leading-Blanks

You can also specify the fields used for sorting and merge the sorting results;

 

Grep

-V,
Not included
Xxx

-N, show line number

-C, get count of marched lines

-E,
Specify multiple modes
, Eg: grep-e er]-e wa] ABC. Log
Equal to or greater
Grep [EW] [Ra] ABC. Log

 

Gzip

Gzip

Gzcat
To display the content of the compressed text file.

Gunzip

 

Tar

Tar function [Options] object1 object2...

Tar-xzvf ABC. tgz

Function:

-C, create a new tar file

-R, append to the TAR file end

-T, list files in tarball

-U, update files in tarball

-X, unzip tar file

Options

-P,
Retain file permissions

-V, list files when proceeding

-Z, redirect output to Gzip

-F, set the Dest File

 

Tee

Add
Stdin
Data is sent
Stdout
And files

Eg:

Date
| Tee a.txt

 

Eval

Execute all
Shell
Run the command after replacement

Eg:

# Set
A B c d

# Eval
Echo the last argument is/$ #
#

Direct use
Echo

The output is
$4

,
Echo

Only one replacement is executed.

 

Eg2:

When the command line is complex, use
Eval

# A = "ID
| Cut-F1-d ''"

# $
#

Error,
| Cut-F

And so on.
ID

Parameters,

# Eval
$
#

Successful,
Bash

Will explain first
$

Is interpreted as the above string,
Eval

The string will be processed again, that is, it will be executed as a command

 

Sort file (s)

Sort

 

WC file (s)

Number of rows, words, and characters

 

Uniq File

Delete duplicate rows

 

Grep

Grep [Options] Pattern

-I
Case
Insensitive

-V

Search for unmatched rows

-N
Print
Line number

-R

-C

Number of matched rows

-H

-L

Only output matching file names

 

Use a regular expression, as shown in figure
:

Grep
A $ a.txt

Find

Find [path] [expression]

Expression:

-Name Pattern

-INAME, case-insensitive

-Print

Alias

Alias li = 'LS-il'
# Create an alias, avialable in the local
Shell

Set aliases in ~ /. Bashrc

 

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.