SSH: Remove Files and Directories

This command will remove the file without prompting you, to ensure you literally want to delete it.


rm myFile.txt

How to delete a file using WildCard (-f forces the command, so you will not be prompted.)

This will delete all .txt files


rm -f *.txt

This command deletes the directory and everything within it. (r=recursive and f =force)


rm -rf /path/to/directory

This command will delete the file and display information (v=verbose)


rm -v myFile.txt

This last command is how you delete a file interactively. (-i will create a prompt and can be used on any command above. As long as you replace the i with the f)


rm -i myFile.txt