214 CHAPTER 13 INTRODUCING THE BASH SHELL (Web domain)

214 CHAPTER 13 INTRODUCING THE BASH SHELL Having the files scroll off the screen can be annoying, so you can cram as many as possible onto each line by typing the following: ls -m The dash after the command indicates that you re using a command option. These are also referred to as command-line flags or switches. Nearly all shell commands have options like this. In fact, some commands won t do anything unless you specify various options. In the case of the ls command, only one dash is necessary, but some commands need two dashes to indicate an option. You can see a list of all the command options for ls by typing the following (ironically, itself a command option): ls –help Once again, the output will scroll off the screen, and you can use the window s scroll bars to examine it. (In Chapter 17, you ll learn a trick you can use to be able to read this output without needing to fiddle around with the scroll bars, even if there s screen after screen of it.) With most commands, you can use many command options at once, as long as they don t contradict each other. For example, you could type the following: ls lh This tells the ls command to produce long output and also to produce human-readable output. The long option (-l) lists file sizes and ownership permissions, among other details (permissions are covered in the next chapter). The human-readable option (-h) means that rather than listing files in terms of bytes (such as 1029725 bytes), it will list them in kilobytes and megabytes. Notice that you can simply list the options after the dash; you don t need to give each option its own dash. Caution I ve said it before, and I ll say it again: don t forget that case-sensitivity is vitally important in Ubuntu! Typing ls L is not the same as typing ls l. It will produce different results. Copying Files Another useful command for dealing with files is cp, which copies files. You can use the cp command in the following way: cp myfile /home/keir/ This will copy the file to the location specified.

Leave a Reply