Common commands for Linux file management

Source: Internet
Author: User

1 File Operations

(1) create file touch +filenanme (2) Delete file rm +filenanme

(3) (4) Move or rename rm filename1 filename2(rename file1 to File2) rm file+ Path (move file to specified directory)

(5) View file cat +filenanme (6) Print line Count view cat-n +filenanme

(7) Displays the number of lines head-n+ the beginning of a file +filenanme (8) shows the number of lines at the end of a file tail-n+ lines +filenanme

2 directory Operations

      (1) Create file  mkdir+filenanme   (2) recursive deletion of non-empty deleted files  rm-r+filename

(3) (4) file directory copy CP filename + path (copy file to specified directory) cp filename1 filename2(filename2 copy filename1)

3 file directory permissions

(1) View file directory permissions ls-al(list 7 columns, where the first column indicates file type access control permissions)

(2) Change of file permissions (recommended using digital notation)chmod-r combination number filename

Linux file Rights Management, R (readable), W (writable), X (executable) with the number "4", "2", "1" to indicate that the command "Ls-al" listed in the first column total 10 columns, where the first column indicates the file type, Each of the 3 combinations then represents the file's access rights to the file owner (user) group member (Group) member (others). For example, 755, equivalent to Rwx-r-x-r-x. Therefore, the file permissions can be set accordingly.

4 File Compression Packaging

    (1) Gzip/gunzip compression extract single file    gzip filename  gunzip filename

(2) Tar consolidation package TAR-ZCVF filename.tgz+ file path (package compressed to specified directory) tar-zxvf filename.tar.gz-c+ file path (unzip to the specified path)

Common commands for Linux file management

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.