Flags

These aren’t the flags you wave from a flag pole.  Ever heard of semaphores?  Those are the flags that sailors used to use to send signals between ships in the days before radio and cell phones and all those other ways we have to communicate now.   So these are flags that can be used to send a signal to a command that you want it to operate differently.

In our previous posts, we’ve used several commands like file, cat, more, echo, and ls. Let’s look at ls some more. If we execute:

Alpha:~ computerlamp$ ls /usr

then we see the directory contents of the usr directory. Now suppose we want to know which of these is a directory and which isn’t. We could cd into that directory and then try each one at a time to find out which one is a directory, but that’s the long way around. As luck would have it, there’s something that will allow us to see what is a directory and what isn’t. We can run:

Alpha:~ computerlamp$ ls -F /usr

Each directory in that listing ends with a ‘/’. Try that command on other directories and see what happens. For example, we made a directory called Sith in a previous post. What happens if you do that on the Sith? The -F is called a command flag or just a flag.  It’s a semaphore that doesn’t involve picking up and waving flags to that command.  It lets us change the output of ls so we can see different things.

Try that command on other directories and see what happens. For example, we made a directory called Sith in a previous post. What happens if you do that on the Sith?

With ls we can change what we see in the output of the command. It’s part of what makes the command line so powerful. With the mouse (remember Fred the mouse?) you can’t add flags to commands and change how it operates.  You can just click on icons.  I mean, I suppose you could add actual flags to the icons, but that won’t change how it operates.

And most commands have flags, so you can customize them to do exactly what you want.

Leave a Reply

Your email address will not be published. Required fields are marked *