Linux study notes 4 - create and delete

1.touch

If the file does not exist, you can create a blank file

If the file already exists, you can modify the last modified date of the file

If 1a.txt originally existed, the modification date changed after touch.


2.mkdir

Create a new directory

The option -p means that directories can be created recursively

The name of the new directory cannot be the same as the existing directory or file in the current directory .

For example, use -p to create a1/b1/c1/d1/ folder recursively

The command is

mkdir -p a1/b1/c1/d1

or mkdir -p ~/desktop a1/b1/c1/d1



3.rm

A file or directory is deleted and cannot be recovered after deletion.

parameter meaning
-f Force delete, ignore non-existing files without prompting
-r Recursively delete the contents of the directory, this parameter must be added when deleting the folder

rm can also use wildcards *, ?, [], etc.

If there are these files on the desktop

Execute the rm -r *a* command, that is, delete all files or directories containing a

Now only these files are left on the desktop


Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326840883&siteId=291194637