228 You Are Here
If we want to see the size of a file or directory, when it was created and more, we can just add the
“long” option (-l)toourls -a command.
Try it. Type:
ls -al
There’s quite a bit more detail now. You can see the file creation date, its size, ownership, permissions
and more.
You don’t have to be in the directory whose contents you want to view, either.
Let’sseewhat’sinthe/etc directory by typing:
ls -al /etc
Here, you’ll get plenty of information about the contents of the /etc directory.
If you want to add color to your listing, just include the --color option.
ls -al --color /etc
To some, adding --color does more than add a splash of color; it gives a clue about the types of
files in a directory. For example, directories might all be a royal blue, program files would be green,
and so on.
If you like what you see, here’s how you can display the listing in color all the time. Briefly, we’ll be
adding one line to the .bashrc file in our login directory.
The .bashrc file is used by your shell when you login (an example .bashrc file is shown in Figure
16.7).
Now before we go any further...
Remember that any changes you make to configuration files can cause you a world of grief if you’ve
made a mistake and you don’t have a backup copy of that file.
To make a backup copy, make sure you’re in your login directory and in an xterm window, type:
cd ˜
to get to your login directory. Then copy the .bashrc file, keeping it in the same directory, but with
a name like .bashrc2.
cp .bashrc .bashrc2
Comments to this Manuals