linux delete or remove file

How do I delete a file under Linux / UNIX / BSD / AIX / HP-UX operating system using command line options?

To remove a file or directory in Linux, FreeBSD, Solaris or Unix-like operating systems use the rm command or unlink command.

rm command syntax

rm (short for remove) is a Unix / Linux command which is used to delete files from a filesystem. Usually, on most filesystems, deleting a file requires write permission on the parent directory (and execute permission, in order to enter the directory in the first place). The syntax is as follows to delete the specified files and directories:

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

Remove or Delete a File Example

To remove a file called abc.txt type the following command:
$ rm abc.txt

To remove three files named foo.mp4 bar.doc demo.txt

rm foo.mp4 bar.doc demo.txt
ls
To remove all files & subdirectories from a directory (MS-DOS deltree like command), enter:
$ rm -rf mydir

To request confirmation before attempting to remove each file pass the -i option to the rm command:
$ rm -i filename

WARNING! These examples will delete all files on your computer if executed.

$ rm -rf /
$ rm -rf *