-
How to delete file and directory in linux (rm)linux 2023. 2. 20. 16:36
In Linux, rm is a command-line utility used to remove files and directories. Here is a table of common options for the rm command in Linux:
OptionDescription
-f Force the removal of files without prompting for confirmation -r Remove directories and their contents recursively -i Prompt for confirmation before removing each file And here are some simple examples of how to use the rm command:
- To remove a file, use the following command:
rm /path/to/file- To remove multiple files, specify the file names as arguments to the rm command:
rm file1.txt file2.txt file3.txt- To remove a directory and its contents recursively, use the following command:
rm -r /path/to/directory- To force the removal of a file without prompting for confirmation, use the following command:
rm -f /path/to/file- To prompt for confirmation before removing each file, use the following command:
rm -i /path/to/fileThis will prompt you to confirm the removal of each file individually.
'linux' 카테고리의 다른 글
How to move file or directory in linux (mv) (0) 2023.02.20 How to copy file or directory in linux (cp) (0) 2023.02.20 How to change current directory in Linux (cd) (0) 2023.02.20 How to make directory, folder in Linux (mkdir) (0) 2023.02.20 How to read ls result (0) 2023.02.20