Linux file Operations related commands

Source: Internet
Author: User
Tags parent directory unzip extract

1. Create a folder:
[[email protected] sm]#  mkdir  A      Create a folder named a
2. Create file:
[[email protected] sm]# Touch a.txt    Create a file named A.txt
3. Move the file (clip) (similar to cut)
[[Email protected] log]# mv  b  sm/    move the file (clip) b to the SM directory under the current directory
4. Delete
[[email protected] sm]# RM-RF a   delete the A file   -rf the shorthand for parameter-R  -F

Parameters:

-R Recursive Delete

-F Force Delete

5. Renaming
[[Email protected] log]# mv  b  sm/c    move the file (clip) bar B to the SM directory under the current directory and rename it to C
6. Copy
[email protected] sm]# CP sm.log  .  Copy the Sm.log to the parent directory  [[email protected] log]# CP Sm.log  . /sm01.log    Copy the Sm.log to the parent directory and rename it to Sm01.log
7. View Files
   [[email protected] sm]# cat sm.log   View sm.log file contents   [[email protected] sm]# Head sm.log   View the first 10 lines of Sm.log file contents [[   Email protected] sm]# head-n  sm.log   View the first 20 lines of the contents of the Sm.log file   [[email protected] sm]# tail sm.log< c16/> View the following 10 lines of the contents of the Sm.log file   [[email protected] sm]# tail  -n  sm.log    View the following 20 lines   of the contents of the Sm.log file [[email protected] sm]# tail-f sm.log   Dynamic View Sm.log file contents   [[email protected] sm]# more Sm.log  View the contents of the Sm.log in the form of a page turn (press SPACEBAR to flip, cannot be turned upside down)   [[email protected] sm]# Less Sm.log View the contents of the Sm.log in the   form of page flipping (press the up and down keys to page up and down, press Q to exit)
8. View Files

Basic syntax: Find find location Lookup parameters

      Find.  -name *java*   Find files with Java characters in the current location find      .-perm 777    Find files with permission 777 in the current location find      /  -user Ouyang   Find the files in the system that the user is Ouyang find      .-type d look  for files of type folder in the current location

Find parameters:

-name-perm-user-group-ctime-type-size

9. Archive compression
    [[email protected] java-run]# TAR-ZCVF log.tar.gz  log/    Archive and compress the directory log, the archive compressed name is log.tar.gz    [[Email Protected] java-run]# TAR-ZXVF log.tar.gz   release and unzip log.tar.gz

You can use zip to compress files unzip extract files

Linux file Operations related commands

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.