"Linux Command"--(1) File folder Operation Command 15

Source: Internet
Author: User

file Folder Operations Command
++++++++++++++++++++++++++++++++++++++++

List enter display folder ls CD pwd

Create a move delete file mkdir rm rmdir MV CP Touch

view File Cat nl More Less head tail

++++++++++++++++++++++++++++++++++++++++


=============ls==============
ls [options] [folder] View folder information: http://www.cnblogs.com/peida/archive/2012/10/23/2734829.html
-------------------------------
Ls-c arranged by time from near
Ls-c-lt by Time, and show time
LS-C-L display time, arranged by file name
Ls-c by file name
Ls-i the inode number of the printed file
LS-SI/S lists the size of the file, in 1000-byte units
LS-L listing all file information
LS-M output formats separated by colons
LS-R reverse Order
Ls-r List all subfolders
Ls-s by file size from large to small
Ls-u-T Sort by interview time
Ls-u output by File system original order
Ls-v Sort by version number
Ls-1 Show only one file per line
LS--version display version number information and leave
------------------------------
Show specific information for all files
LS-RL [File path]

List specific information for folders that begin with D
Ls-l d*

List sub-folders
ls-f [Folder path] |grep/$

Listing specific information for subfolders
ls-l [Folder path] |grep "^d"

List the files that begin with D, and the sooner they are in the back.
Ls-ltr d*

Calculates the current file sibling folder count
Ls-l * |grep "^d" |wc-l

Calculates the current folder sibling file count
Ls-l * |grep "^-" |wc-l

List absolute paths to files
LS |sed "s:^: ' pwd '/:"

Lists the absolute paths of all files under the current folder, without recursion
Find $PWD maxdepth 1|xargs ls-l
-----------------------------
. It starts with a hidden file.
. Represents the current folder

.. Represents the parent folder


================cd===============

CD [folder name] Switch folder references: http://www.cnblogs.com/peida/archive/2012/10/24/2736501.html

--------------------------
Enter the system root folder
CD/
Cd.. (.. ) Keep back

Go to the current user home folder
Cd
CD ~

Switch to the previous folder
CD-


=============pwd===================
PWD [references] show current path reference: http://www.cnblogs.com/peida/archive/2012/10/24/2737730.html
-----------------------
PWD Displays the current path

Pwd-p shows the actual path



==============mkdir===================
mkdir [Options] Folder creation folder references: http://www.cnblogs.com/peida/archive/2012/10/25/2738271.html
---------------------------------
Mkdir-m 777 XXX Set permissions
Mkdir-p XXX Create a folder that does not yet exist

mkdir-v XXX display information after creation


=============rm==============

RM [Options] File Delete files and folders references: http://www.cnblogs.com/peida/archive/2012/10/26/2740521.html
-------------------------------
RM 1.log Delete Files
Rm-f 1.log forcibly delete files without prompting information
Rm-i *.log Prompt every time you delete
Rm-r deleting folders and files recursively
RM-RF Force recursion to delete folders and files
-----------------------------
F--force
R--recursive


=============rmdir==============
rmdir [Options] Folder Delete folder references: http://www.cnblogs.com/peida/archive/2012/10/27/2742076.html
-------------------------------
RmDir folder name Delete empty folder
Rmdir-p folder name Recursive delete
------------------------------
Rm-r dir command can replace RmDir


=============mv==============
MV [options] source target moving files or renaming: http://www.cnblogs.com/peida/archive/2012/10/27/2743022.html
-------------------------------
Mv-b Pre-overwrite backup
Mv-f forcibly covered
Mv-i Ask before overwriting
Mv-u new File Words update
Mv-t Target source multiple source files to a destination folder
------------------------------
Move all files under the current folder to the top level
MV *.. /
-----------------------------


=============cp==============

CP [option] source target copy file or folder or
CP [Options]-T folder source
References: http://www.cnblogs.com/peida/archive/2012/10/29/2744185.html
-------------------------------
Cp-a the source target copies the properties of the file at the same time
-----------------------------
Copy a single file to the destination folder, this file does not already exist in the destination folder
CP Log.log dir


Copy entire folder
Cp-a Dir1 Dir2


Create a link file (shortcut)
Cp-s 1.log Link.log
-----------------------------


=============touch==============
touch [Options] File Create nonexistent file, change file timestamp reference: http://www.cnblogs.com/peida/archive/2012/10/30/2745714.html
-------------------------------
Touch File List Creation file
Touch-c file file exists on rebuild, no new not present
Touch-r file1 File2 will file1 time stamp and File2 Unified
Touch-t time ([[cc]yy]mmddhhmm[]. SS]) file specifies a timestamp
------------------------------

=============cat==============

Cat [Options] [file] display, merge, create file references: http://www.cnblogs.com/peida/archive/2012/10/30/2746968.html
-------------------------------
Cat-n file displays line number, starting from 1
The Cat-b file displays the line number of a non-blank line, starting with 1
------------------------------
Add a line number to the file and append another file
Cat-n file1 file2 File3


Here Doc generates text
Cat >log.txt <<eof
>hello
>$ (PWD)
>eof

Reverse order Display
TAC file
-----------------------------
-N Number
-B No Blank

=============nl==============

NL [Options] [file] Calculate text line number: http://www.cnblogs.com/peida/archive/2012/11/01/2749048.html
-------------------------------
NL File Listing line numbers
Nl-b a file empty line also list travel number
Nl-b t file blank line does not list line numbers
Nl-n ln File: The line number is displayed at the left of the screen;
Nl-n rn File: line number in its own field on the right of the display, and does not add 0;
Nl-n RZ File: line number in its own field to the right of the display, and add 0;
nl-w [number] File: number of digits occupied by line number bar
------------------------------

=============more==============

more [options] [file] View the contents of the file, can flip, can skip: http://www.cnblogs.com/peida/archive/2012/11/02/2750588.html
-------------------------------
More +n files start from joys n lines
More-n file defines a screen size of n rows
More +/pattern files Find string pattern and start from the first two lines
------------------------------
Pagination Display file
Ls-l | More-5
-----------------------------
Space bar scroll down one screen
Ctrl+b Back to previous screen
= Output the line number of the current line

=============less==============

Less [options] file Linux Orthodox tools for viewing file content: http://www.cnblogs.com/peida/archive/2012/11/05/2754477.html
-------------------------------
Less-n file Displays the line number of each line
LESS-S Display continuous empty behavior row
Less/string: Search down the function of "string"
Less? string: The ability to search up "string"
------------------------------
View multiple files (before and after switching with p,n)
Less file1 file2
-----------------------------
1. Full Screen navigation
CTRL + F-Move forward one screen
CTRL + B-Move backward one screen
CTRL + D-Move forward half screen
CTRL + U-Move backward half screen

2. Single-line navigation
J-Move one line forward
K-Move backward one line

3. Other navigation
G-Move to the last line
G-Move to the first line
Q/zz-Exit less command


View Historical Usage Commands
History |less

=============head==============
head [options] [file] shows the beginning of the file, default the first 10 lines: http://www.cnblogs.com/peida/archive/2012/11/06/2756278.html
-------------------------------
Head-n number of rows displayed in a digital file
Head-n-digital file displays except for the last n rows
Head-c number of bytes displayed in the digital file

HEAD-C-digital file displays except for the last n bytes


=============tail==============

tail [options] [file] show end of file: http://www.cnblogs.com/peida/archive/2012/11/07/2758084.html
-------------------------------
Tail-n is similar to head
Tail-c is similar to head
Tail-f Loop read, can be monitored
------------------------------
Monitoring the health of
Ping 192.168.120.204 > Test.log
Tail-f Test.log
-----------------------------
CTRL + C End Monitoring




"Linux Command"--(1) File folder Operation Command 15

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.