Skip to content

Instantly share code, notes, and snippets.

@seanbuscay
Created May 16, 2013 15:54
Show Gist options
  • Save seanbuscay/5592786 to your computer and use it in GitHub Desktop.
Save seanbuscay/5592786 to your computer and use it in GitHub Desktop.
Shell commands to remove Files #shell
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:
rm -f -r {file-name}
Where,
-f: Forcefully remove file
-r: Remove the contents of directories recursively
Remove or Delete a File
To remove a file called abc.txt type the following command:
$ rm abc.txt
To remove all files & subdirectories from a directory (MS-DOS deltree like command), enter:
$ rm -rf mydir
To remove empty directory use rmdir and not rm command:
$ rmdir mydirectory
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment