216 CHAPTER 13 INTRODUCING (Web domain) THE BASH SHELL

216 CHAPTER 13 INTRODUCING THE BASH SHELL Figure 13-4. You can also use the mv command to rename files. Deleting Files But how do you get rid of files? Again, this is relatively easy, but first a word of caution: the shell doesn t operate any kind of Recycle Bin. Once a file is deleted, it s gone forever. (There are utilities you can use to recover files, but these are specialized tools and aren t to be relied on for day-today use.) Removing a file is achieved by typing something like this: rm myfile It s as simple as that. You ll be asked to confirm the deletion after you issue the command. If you want to delete a file without being asked to confirm it, type the following: rm f myfile The f stands for force (that is, force the deletion). If you try to use the rm command to remove a directory, you ll see an error message. This is because the command needs an additional option: rm rf mydirectory As noted earlier, the r stands for recursive and indicates that any folder specified afterwards should be deleted, in addition to any files it contains.

Leave a Reply