Linux Learning Notes-directory, file management commands

Source: Internet
Author: User

Directory Management Commands:

LS, CD, pwd, mkdir, rmdir, tree

File Management commands:

Touch, stat, file, RM, CP, MV, Nan

Directory Management

#ls List

Format ls [OPTION] ... [FILE] ...

-H (Hurman) unit conversion

-A (all) displays files starting with. (Show hidden files)

. Current directory

.. Represents the parent directory

-A does not display the current directory. and parent directory: , all other displays

-D (diectory) display Directory properties

-I (ID) display I node number

-R Reverse Display

-R Recursive display

-L (Long) display long options

[Email protected] home]# ls-ld/bindr-xr-xr-x. 2 root root 4096 August 02:16/bin

1 File Type:

-Documents

b File (block)

C-character device or linear device

D catalog File

L Soft Link File

P Command Pipeline File

s socket file

2 File permissions: 9 bits per 3-bit group, rwx (read, write, execute)

3 File Hard link count:

4 File Owner: (user)

5 files belong to group: (group)

6 File Size: (default is bytes)

7 timestamp: Last Modified time

Access: Access

Modified: modity: File content changed

Change: Changed metadata, meta data

8 File Name:

#cd: Switch to the current directory

Format CD [-l|-p] [dir]

Home directories, home directories home directory

Example: CD ~username into the specified user home directory

CD-: In the current directory and last directory switchover (changed)  

#mkdir: Create an empty directory

Format mkdir [OPTION] ... DIRECTORY ...

-P recursive creation of parent directories and directories

-V Detailed information

Example: #mkdir-pv/mnt/test/{x/y,m}

{} on behalf of the command line expansion

Example: #mkdir-pv/mnt/test2/{a,b}_{c,d}

#rmdir: Delete Empty directory, non-empty directory cannot be deleted

Format rmdir [OPTION] ... DIRECTORY ...

#tree: Show Tree Directory

#pwd: Show current directory


File Management

#touch Create an empty file

Example: #touch-M-T 201612121212/mnt/a   

#rm Delete Files

Format RM [OPTION] ... FILE ...

-F Forced Delete (force)

-R Recursive Delete

-RF forced recursive deletion  


#file: View file properties

Format file [-bchiklnnprsvz0] [--apple][--mime-encoding] [--mime-type]

[-etestname] [-F Separator] [-F NameFile] [-M magicfiles] file ...

file-c [-mmagicfiles]

FILE[--HELP]

[Email protected] home]# file/etc/init.d/iptables/etc/init.d/iptables:posix shellscript text executable

#stat: View file properties, including information such as access time, modify time, change time, and more

[Email protected] home]# stat/etc/init.d/iptables File: "/etc/init.d/iptables" size:11048 blocks:24 IO block:4096 Normal file device:803h/2051d inode:392027 links:1access: (0755/-rwxr-xr-x) Uid: (0/root) G ID: (0/root) access:2017-08-28 02:14:24.240985047+0800modify:2015-07-24 10:10:14.000000000+0800change:2017-08-28 02:14:23.501985051+0800

#cp: Copying and moving files, using scenes: one file to one file; multiple files to a directory

Format CP [OPTION] ... [-T] Sourcedest

CP [OPTION] ... SOURCE ... DIRECTORY

CP [OPTION] ...-t DIRECTORY SOURCE ...  

-R recursive replication, copying files in directories and directories

-F Forced replication

-RF Recursive forced replication

-I Reminders

-P reserved Group, timestamp, attribute

-A archive copy and retain all attributes for backup  

#mv move a directory, file, or rename

Format mv [OPTION] ... [-T] SOURCE DEST

Mv[option] ... SOURCE ... DIRECTORY

Mv[option] ...-t DIRECTORY SOURCE ...


This article is from the "Wish_" blog, be sure to keep this source http://itwish.blog.51cto.com/11439802/1960793

Linux Learning Notes-directory, file management 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.