Commands to Delete Files in Linux Terminals
Linux distributions often include graphical desktop environments, but these are built on top of a robust terminal environment. One commonly-used Linux terminal command is the "rm" command, which is short for "remove." The rm command deletes a specified file or group of files. If you want to delete a system file that your user account doesn't have access to, you must first log in as the root user with the "su" command.
Instructions
-
-
1
Type "rm /path/to/file" into the terminal, replacing "/path/to/file" with the path to the file you want to delete, and press "Enter." You can just type "file" if it's in the current directory, as in "rm file".
-
2
Type "rmdir /path/to/folder/" to remove an empty directory.
-
-
3
Type "rm -rf /path/to/folder" to delete a folder and everything inside of it. Be careful when using this command, if you accidentally type the wrong folder Linux will delete everything inside of it without prompting you, which could damage your Linux system. For example, if you type "rm -rf /", Linux will delete every single file on your hard drive.
-
1