CHAPTER 13 INTRODUCING (Post office web site) THE BASH SHELL Tip
Wednesday, October 24th, 2007CHAPTER 13 INTRODUCING THE BASH SHELL Tip You might have used wildcards within Windows and DOS. They can be used within Ubuntu, too. For example, the asterisk (*) can be used to mean any file. So, you can type rm f * to delete all files within a directory, or type rm f myfile* to delete all files that start with the word myfile. But remember to be careful with the rm command. Keep in mind that you cannot salvage files easily if you accidentally delete them! Changing and Creating Directories Another handy command is cd, for change directory. This lets you move around the file system, from directory to directory. Say you re in a directory that has another directory in it, named mydirectory2. Switching to it is easy: cd mydirectory2 But how do you get out of this directory once you re in it? Try the following command: cd .. The .. refers to the parent directory, which is the one containing the directory you re currently browsing. Using two dots to indicate this may seem odd, but it s just the way that Ubuntu (and Unix before it) does things. It s one of the many conventions that Unix relies on and that you ll pick up as you go along. You can create directories with the mkdir command: mkdir mydirectory Summary This chapter introduced the command-line shell, considered by many to be the heart of Linux. We ve discussed its similarities to MS-DOS, and shown that these are only cursory; knowledge of DOS doesn t equate to skill within BASH. In the long run, you should work to polish your BASH skills. This chapter also introduced some elementary commands used within BASH, such as those used to provide directory listings and to copy files. We looked at how you can use command- line options to control BASH tools. In many cases, these are mandatory, so you learned how the BASH shell itself can be used to investigate a command and find out vital information about how it works. At this point, your newfound knowledge will have no doubt caused you to venture into the Ubuntu file system itself, which can be a confusing, if not terrifying, place for the inexperienced. But don t worry. The next chapter explains everything you need to know about the file system and what you ll find in it.