Linux common file Management Command description

Source: Internet
Author: User

#1.1 lsCommand    

Ls-a # view all files including  . .. Catalogue

Ls-r # sort files in reverse order    

Ls-l # View all file details

Ls-lt # View all file details and sort by time from near to far

Ls-a # view all files including  . .. Catalogue            

Ls-f # view files If the directory is appended to the / 

Ls-rst #-s Show file Size    

Ls-s # Sort by file size         

#1.2 CD

Cd/tmp # Switch to / tmp Catalogue

CD.. # Switch to the top level directory

#1.3 pwd # displays the absolute path of the current working directory

#1.4 mkdir

mkdir 1 2 3 # Create a directory 1 , 2 , 3

mkdir-p 8/88/888/8888/88888 # Use - P parameters to create multi-level catalogs               

mkdir-m 777 ABC # Use - M permissions can be granted to create a directory

#1.5 rmdir

rmdir 1 # empty directories can be deleted

rmdir 8 # Error, Directory 8 not an empty directory

#1.6 ln

ln-s Java-1.6.1-05/java # Soft Connect, which is a shortcut

Ln Java-1.6.1-05/java # hard link, same as original file, delete original file does not affect

#1.7 RM         

rm-f Alex.test # Force Delete Files  

rm-r Test2 # recursively delete a directory Test

rm-rf/tmp/test* # Force recursive deletion /tmp/test*

RM-RF * RM-RF/# prohibit use, delete entire system

Note:RM-RF recommends disabling the

#1.8 Touch

Touch 123 ABC ABCD # Create 123 , ABC , ABCD and other documents

touch-c-T 11022035 ABCE # Create or modify ABCE, property is the time of the One Month Geneva Day 20:45

touch-d "6:34pm 8/11/2045" ABCD # Create or modify ABCD, property is the time of the 2045 years 8 Month One Day 18:34

#1.9 CP

CP test.txt/tmp/test/# Copy files to /tmp/test/

cp-r/tmp/test//root/test # Use - R Copy Directory

#1. SCP

SCP Orapworcl.ora 10.53.110.75:/tmp/test # the local Orapworcl.ora Copy to 10.53.110.75:/tmp/test

scp-r/tmp/test 10.53.110.175:/tmp/#-R Copy directory re-local to remote       

SCP 10.53.110.175:/tmp/test/test.tar.gz/tmp/# from remote copy to local

#1. Cat

Cat 1.log # View 1.log of the content     

cat-n 1.log # View 1.log and displays the line number    

cat 1.log 2.log > 3.log # will be 1.log 2.log the content is appended to the 3.log

Cat-n 3.log

# 1.12 MV

mv *.log alexpeng/# leave this directory all in Log the end of the file is moved to alexpeng/

mv Test.txt Alex.test # will be Test.txt Rename to alex.test

#1. Tail

tail-20 Test.log # Show Test.log the last - Line

tail-f Test.log # Dynamic Monitoring Test.log

#1.

more-5 +30 Test.log # Per page display, initially displayed 5 line, from - Line Start

#2.1 Gzip/gunzip

gzip 3.log # Compression 3.log

gunzip 3.log.gz # Unzip 3.log.gz

GIZP alexpeng/* # Compression alexpeng/ all files, except directory

gzip alexpeng/* # Unzip alexpeng/ All . GZ End of File

gzip-l alexpeng/* # View alexpeng/ All . GZ the compression ratio      

#gunzip =gzip-d # The same can be achieved with decompression function  

#2.2 tar

tar-zcfv alexpeng.tar.gz alexpeng/# Package and Compress Alexpeng Catalogue    

TAR-ZXFV alexpeng.tar.gz-c/tmp/test/# # Unzip and unpack the package alexpeng.tar.gz file to the specified file /tmp/test/ in

tar cfv alexpeng.tar alexpeng/# Packing alexpeng/

gzip Alexpeng.tar # Compression Alexpeng.tar

#tar-CZFV =TAR-CFV + gzip

#2.3 Zip/unzip ( compression format in common with Windows )

zip abc.zip ABC #zip Compression Abc.zip

Unzip Abc.zip # Unzip Abc.zip

unzip-d Alex Abc.zip # unzip to the specified directory Alex

#2.4 BZIP2/BUNZIP2

bzip2 diskrar.gz Diskrar

BUNZIP2 diskrar.bz2

Note: Only files can be compressed, directories cannot be compressed,bzip2 may be used in conjunction with the tar command


Linux common file Management Command description

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.