The second important command to know when using a Linux or Unix server is the rm command. This is the primary way to delete files from a server. Please use it with caution, as it is meant to be permanent. To delete a file, simply navigate to the directory with the file and type: rm filename
.
To remove a file when you are not in its directory, you must type the full path: rm /home/user/public_html/filename
.
If you want to delete a directory, you must make the deletion recursive by typing: rm -r directory-name
.
You may delete multiple files, simply by entering each one on the line: rm filename1 filename2 filename3
.
To delete directories and files without any prompting, enter rm -r -f filename1 filename2 directory3
.
To learn more about the rm command, type: man rm
at the command prompt.
Photo Source: Flickr