Linux Delete Folder command
Linux Delete directory is very simple, many people are still accustomed to use rmdir, but once the directory is not empty, it fell into deep distress, now use the RM-RF command.
Direct RM is available, but add two parameters-rf that is: RM-RF directory name
Delete directory, file rm (remove)
Feature Description: Delete files or directories.
Syntax: RM [-dfirv][--help][--version][file or directory ...]
Additional Note: The Execute RM instruction can delete the file or directory, if you want to delete the directory must add the parameter "-r", otherwise the default will only delete the file.
Parameters
-D or –directory delete the hard connection data for the directory that you want to delete directly by deleting the directory by 0.
-F or –force forces the deletion of files or directories.
-I or –interactive to ask the user before deleting both files or directories.
-R or-R or –recursive recursively handles all files and subdirectories under the specified directory.
-V or –verbose shows the instruction execution process.
1 Deleting a folder
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
To be reminded: Use this RM-RF with extreme caution, Linux does not have a recycle Bin
2 Deleting files
De>rm-f filenamede>
Use RM-RF with extreme caution, Linux does not have a recycle Bin
Linux Add Files command
Create directory: mkdir (make Directories)
Function Description: Create a directory
Syntax: mkdir [-p][--help][--version][-m < directory properties >][directory name]
Supplemental Note: mkdir can create a directory and set permissions for the directory at the same time.
Parameters
-m< Directory properties > or –mode< Directory properties > set directory permissions at the same time when the directory is established.
-P or –parents if the upper-level directory to which you want to create the directory is not currently established, the upper-level directory will be created.
Example: mkdir test
Create a file Touch
Function Description: Change the file or directory time.
Syntax:touch [-acfm][-d < date time >][-r < reference file or directory >][-t < datetime;] [--help] [- -version][file or directory ...] or touch [-acfm][--help][--version][date time [file or directory ...]
Supplemental Note: Use the touch directive to change the date and time of a file or directory, including access time and change time.
Parameters:
-A or –time=atime or –time=access or –time=use only change the access time.
-C or –no-create does not establish any files.
-d< Time Date > Use the specified datetime, not the current time.
-f This parameter ignores non-processing and is responsible only for compatibility issues with BSD version touch directives.
-M or –time=mtime or –time=modify only changes the change time.
-r< Reference file or directory > set the date and time of the specified file or directory to the same date and time as the reference file or directory.
-t< Date Time > Use the specified datetime, not the current time.
Example: Touch test.txt (Note: Linux does not have file suffix name to differentiate file type, System file type is only executable and non execute file)