Linux Basic article -06,linux file Management du touch stat file rm cp mv VIM

Source: Internet
Author: User

File Management du touch stat file rm cp mv VIM


################################################


Du: Estimating File space usage

Touch: Create a file

Stat

File

RM: Deleting files

CP: Copy files, copy directories

MV: Cut files, rename files

Vim: Editing files


################################################


Touch: Default to create empty files


Modify Access Time


[Email protected] ~]# touch-a/root/anaconda-ks.cfg


View File meta data

[Email protected] ~]# stat/root/anaconda-ks.cfg

File: "/root/anaconda-ks.cfg"

size:1367 blocks:8 IO block:4096 Normal file

device:802h/2050d inode:786959 links:1

Access: (0600/-rw-------) Uid: (0/root) Gid: (0/root)

access:2016-07-20 14:22:46.514990471 +0800

modify:2016-07-20 14:14:00.259989462 +0800

change:2016-07-20 14:22:46.514990471 +0800


Modify Access Time

[Email protected] ~]# touch-a-t 201608201423.15/root/anaconda-ks.cfg

[[email protected] ~]# stat/root/anaconda-ks.cfg File: "/root/anaconda-ks.cfg"

size:1367 blocks:8 IO block:4096 Normal file

device:802h/2050d inode:786959 links:1

Access: (0600/-rw-------) Uid: (0/root) Gid: (0/root)

access:2016-08-20 14:25:20.000000000 +0800

modify:2016-07-20 14:14:00.259989462 +0800

change:2016-07-20 14:25:54.976982302 +0800


################################################


Stat: Show file status


[Email protected] ~]# stat/root/anaconda-ks.cfg

File: "/root/anaconda-ks.cfg"

size:1367 blocks:8 IO block:4096 Normal file

device:802h/2050d inode:786959 links:1

Access: (0600/-rw-------) Uid: (0/root) Gid: (0/root)

access:2016-07-20 04:01:03.650316383 +0800

modify:2016-07-20 00:30:17.281292190 +0800

change:2016-07-20 00:30:23.219217546 +0800



################################################


File: Show Files Type


[Email protected] ~]# file/root/anaconda-ks.cfg

/root/anaconda-ks.cfg:ascii 中文版 Text


################################################


RM Default Delete requires confirmation


[Email protected] ~]# rm/tmp/*

RM: Do you want to delete the plain empty file "/tmp/1btest2"?


Deleting files does not require confirmation

[Email protected] ~]# \rm/tmp/*

RM: Cannot delete "/tmp/lost+found": is a directory

RM: Cannot delete "/tmp/ssh-xavuu50237": is a directory

RM: Cannot delete "/tmp/t": is a directory

RM: Cannot delete "/tmp/test12": is a directory

RM: Cannot delete "/tmp/test13": is a directory

RM: Cannot delete "/tmp/testcp": is a directory


To display deleted files

[Email protected] ~]# \rm/tmp/*-V

RM: Cannot delete "/tmp/lost+found": is a directory

deleted "/tmp/t1.txt"

deleted "/tmp/t2.txt"



Delete directories and files

[Email protected] ~]# \rm/tmp/*-RFV

Deleted directory: "/tmp/lost+found"

deleted "/tmp/ssh-xavuu50237/agent.50237"

deleted "/tmp/t/2.txt"

deleted "/tmp/t/1.txt"

Deleted directory: "/tmp/t"

Deleted directory: "/tmp/test12"

Deleted directory: "/tmp/test13"

deleted "/tmp/testcp/testcp.txt"

Deleted directory: "/tmp/testcp"




################################################


CP: Copy


-P: Hold timestamp and belong to group owner

-A: Archive, often used for backup

-r: Recursive copy Directory

-F: Mandatory

-V: Echo the process being processed

-I: Remind user to confirm before overwriting

Copying files and folders to a directory


[Email protected] testcp]# \cp-prv/home/testcp//tmp/

"/home/testcp/", "/tmp/testcp"

"/home/testcp/testcp.txt", "/tmp/testcp/testcp.txt"

"/home/testcp/1.txt", "/tmp/testcp/1.txt"

"/home/testcp/cptest", "/tmp/testcp/cptest"

"/home/testcp/cptest1", "/tmp/testcp/cptest1"

"/home/testcp/2,txt", "/tmp/testcp/2,txt"


################################################


MV: Cut or rename

[Email protected] ~]# mv-fv/home/testcp//tmp/

"/home/testcp/", "/tmp/testcp"

"/home/testcp/testcp.txt", "/tmp/testcp/testcp.txt"

deleted "/home/testcp/testcp.txt"

Deleted directory: "/home/testcp"


################################################


Vim: Editing files

Vim file

No files to create files, this command is powerful, text editor


################################################


Linux Basic article -06,linux file Management du touch stat file rm cp mv VIM

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.