How to use shell to delete a specific file in Linux?

In Linux, you can use the shell command rm to delete specific files. Here are some common ways to delete files:

  1. Delete a single file.
rm 文件名
  1. Delete multiple files.
rm 文件1 文件2 文件3 ...
  1. Remove all files in the specified directory.
rm 目录名/*
  1. Delete the specified directory and all of its contents.
rm -r 目录名

Please note that deleting a file is irreversible, so please use caution.

Leave a Reply 0

Your email address will not be published. Required fields are marked *


广告
Closing in 10 seconds
bannerAds