The rmdir and rm commands are deleted commands on Linux systems. The difference is that the rmdir command is used to delete directories. The rm command can delete files and directories at the same time. Here is a detailed introduction to the Linux commands rmdir and rm. .
rm command can delete files or directories simultaneously
rmdir Commands
1. Name: rmdir
2. Applicable objects: a current All users of directory operation permissions
3. Command format: rmdir [-p -v] [dirName]
4. Role: delete empty directory
5. Parameters Detailed explanation:
-p If the parent directory becomes an empty directory after the subdirectory is deleted, it will be deleted along with the parent directory.
-v Last time I said, I won't describe it here. See
6. Example:
1.[snms@snms test]$ ls
2.[snms@snms test]$ mkdir -p dir1/dir2 dir1/dir3
3.[snms@snms test]$ ls dir1/
4.dir2 dir3< Br>
5.[snms@snms test]$ rmdir dir1 #Cannot delete non-empty directories
6.rmdir: failed to remove “dir1”: The directory is not empty
7 [snms@snms test]$ rmdir dir1/dir3
8.[snms@snms test]$ ls
9.dir1
10.[snms@snms test ]$ rmdir -p dir1/dir2
11.[snms@snms test]$ ls
12.[snms@snms test]$
rm command introduction
>
1.Name: rm
2. Applicable objects: All users
3. Command format: rm [-firv] [dirName/dir]
4. Role: delete files or directories
5. Detailed parameters:
-f Even if the file attribute is read-only (ie write-protected), it is deleted directly
-i Ask for confirmation before deleting
-r Delete directory and all files under it
6.Example:
1.[snms@snms test] $ ll
2. Total 12
3.-rwxrwxr-x 1 linuxidc linuxidc 5 04-04 08:48 aa
4.-r--r-- R-- 1 linuxidc linuxidc 5 04-04 08:49 cc
5.drwxrwxr-x 2 linuxidc linuxidc 4096 04-04 08:48 dir1
6.[snms@snms test] $ ll dir1
7. Total 4
8.-rwxrwxr-x 1 linuxidc linuxidc 5 04-04 08:47 bb
9.[snms@snms test] $ rm -i aa
10.rm: Do you want to delete the normal file “aa”? y
11.[snms@snms test]$ rm cc
12.rm: Do you want to delete the write-protected normal file “cc”? n
13.[snms@snms test]$ rm -f cc
14.[snms@snms test]$ ls
15.dir1
16.[snms@snms test]$ rm -r dir1
17.[snms@snms test]$ ls
18.[snms@snms test]$
In addition, when using rm --help, you will find the following very useful things in the description
1. By default, rm does not delete the directory. Use the --recursive (-r or -R) option to remove each listed
2. directory and its contents below.
3. To delete the first character (“-foo”), use one of the following methods:
4. rm -- -foo
5. rm . /-foo
6. Please note that if you use rm to delete a file, you can usually restore the file to its original state.
7. The contents of this file cannot be restored. Please consider using shred.
The above is the introduction of the Linux command rmdir and rm difference, rm command and rmdir command can be used in some places, but the effect of using rm and rmdir command to delete is still different.
of creating a shared folder by SUSE SUSE is a Linux operating system. To share a SUSE file on other
In the Linux system, if you browse the webpage when you download something, it will
pipe is a pipe in the Linux system. The main body of the pipe mechanism is the call
In the Linux system, in order to ensure the installation of the system, you need to
How to solve the problem that the VPN client connection to the Linux server is slow to slow down
What should I do if ssh is slow to connect to other Linux machines?
Linux delete garbled file operation skills
Ubuntu 12.04 installs the method using GNOME 3
How to install fcitx input method under Linux
Linux uses node.js to execute commands.
Linux method for creating custom Docker images
Linux uses awk to implement multi-line merge instances
What is the use of the pwd command in Linux?
How Linux implements the transmission of UDP broadcast messages
Linux installation using the monitoring software Collectl method
The latest version of Win10 is not compatible with 64-bit Chrome Google Fix
How to use the win7 system remote assistance function?
How to set up win8 system ip address local connection?
How to create .ISO files from Windows 7.VHD files
How to use the notebook Japanese keyboard This article to teach you
The king glory experience service has no computer version
The Win10 system prohibits the application from running in the background. Solution
win7 how Safe Mode startup sound
Windows 7 Favorites can't unfold faults quickly repair method