Get the App
SLTechnology News&Howtos  ›  Servers  › 

CVM: Linux folder file creation and deletion

Shulou Source: shulou.com Published: 2022-06-02 06:42:16 10月03日 Update

1 Delete folder CVM

De > rm-rf fileNamede >

-Delete a folder instance:

Rm-rf / var/log/httpd/access

The / var/log/httpd/access directory and all files and folders under it will be deleted

Need to be reminded: you must be very careful when using this rm-rf. Linux does not have a Recycle Bin.

2 delete files

De > rm-f fileNamede >

Be careful when using rm-rf. Linux does not have a Recycle Bin.

Linux add File command

Create a directory: mkdir (make directories)

Function description: create a directory

Grammar: mkdir [- p] [--help] [--version] [- m] [directory name]

Additional note: mkdir can establish a directory and set the permissions of the directory at the same time.

Parameters:

-m or-mode sets the permissions of the directory at the same time it establishes the directory.

-p or-parents if the upper directory of the directory to be created has not been created yet, the upper directory will be created as well.

Example: mkdir test

Create a file touch

Function description: change the file or directory time. ?

Grammar: touch [- acfm] [- d] [- r] [- t] [--help] [--version] [file or directory.] Or touch [- acfm] [--help] [--version] [date and time] [file or directory.]

Note: use the touch directive to change the date and time of a file or directory, including access time and change time.

Parameters:

-an or-time=atime or-time=access or-time=use only changes the access time.

-c or-no-create does not create any files.

-d uses the specified date time instead of the current time.

-f this parameter is ignored and not processed, and is only responsible for resolving the compatibility issue of the BSD version of the touch directive.

-m or-time=mtime or-time=modify only changes the time of change.

-r set the date and time of the specified file or directory to the same date and time as the reference file or directory.

-t uses the specified date time instead of the current time.

Example: touch test.txt (Note: there is no file suffix under Linux to distinguish file types, system file types are only executable files and non-executable files)

Tags: File directory time date folder upper layer function recycle bin instruction time permission type access server service same compatibility parameter only at the same time Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MariaDB MySQL OPPO Reno Linux