Linux Delete Directory File and Folder

How do I delete a file or directory or folder on the command line Linux or Unix? Maybe it is You have in mind when you first get to know or use the system operatsi Linux or Unix based. This is normal because when we are just using the Linux or Unix operating systems, we will be faced with the name of the command line.

Yes, the command line is the base of the use of the operating system Linux or Unix. The command line in linux is also very powerful to see hidden files when Flash or hard disk we are exposed to the virus when it crawled on the Windows OS.

To remove a file or directory or folder on the operating system Linux, FreeBSD, Solaris, or Unix, we'll use the command "rm" (without the quotation marks).

The command "rm"
RM is a command to delete the files on the file system. The rm command also has a complete option due to delete files on a Linux operating system, we will be stuck to the issue of access rights. The following is the sintax of rm:

$  rm {name of file}
$  rm [options] {name of file}
$  unlink {name of file}
$  rm -f -r {name of file}

-f (force) i.e. Delete without confirmation
-r (recursive) or usually with -R IE delete files by means of recursive

Examples of the use of the command "rm"

The following is a sample file:
$  rm abc.txt

When you have a folder that contains many files and want to delete all the files in it, use the command below:
$  rm -f test/*

"test" is the name of the folder.
Remove a directory or Folder

To remove a directory or folder please use the command:
$ rmdir {name of folder}

but the above command is only used to remove files that are empty and could not be used to remove a directory or folder there is a file in it. Then how to remove a directory or folder and its contents? Here's how to remove it:
$  rm -rf {name of folder}

You should be careful using this command because if you do not use a jelly, then the files that you have deleted all.

Click here for Comments