Linux commands are used to create, delete files and directories

Create, delete files and directories command


learning target

  • You can create folders using the Linux command

1. Create, delete files and directories using the command

command Explanation
touch filename Create a file designated
mkdir directory name Create a directory (folder)
rm filename or directory name Delete a file or directory
rmdir directory name Delete empty directories

FIG Effect touch command:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-n15t7LCC-1583850202837) (imgs / touch.png)]

FIG mkdir command Effect:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-GYMyJFgI-1583850202838) (imgs / mkdir.png)]

rm command renderings:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-HM9gDmfd-1583850202838) (imgs / rm.png)]

rm delete the directory renderings

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-wJFXOj5P-1583850202838) (imgs / rmml.png)]

Description:

rm command you want to delete the directory need to add -r option , -r recursively remove the directory and its contents represent

FIG rmdir command Effect:

[Image dump the chain fails, the source station may have security chain mechanism, it is recommended to save the picture down uploaded directly (img-GTDZHY2K-1583850202839) (imgs / rmdir.png)]

2. Summary

  • touch means creating a file
  • Create a directory mkdir representation
  • rm means to delete a file or directory, delete the directory if need to use the -r option, -r recursively remove the directory and its contents represent
  • means to delete empty directories rmdir
Published 698 original articles · won praise 929 · views 120 000 +

Guess you like

Origin blog.csdn.net/qq_35456045/article/details/104785143