Technology Tips

Dan Comden

More Unix Command Primer

Listing Files
How do you look at files that are in your account area? Use the ls command to list files in your current directory. There are some files in your directory that are hidden, or not viewed, unless you want to see them. Hidden files have a filename that begins with a period and they are used to tell programs, such as Pine, about your preferences. Usually, you want to leave these files alone without changing, moving or deleting them. Most Unix commands have the ability to have what are called switches after them. This is just the dash (-) sign followed by some letter.

Unfortunately, many of them make little or no sense and are difficult to remember. As explained in the July DO-IT News, you can always use the man command. To display hidden files, use the -a switch: ls -a

This will display all the files in the current directory, including any hidden files. The -l switch will also display the size of the files as well: ls -l

Another useful switch is -F. When used in conjunction with the ls command, you will see more details, such as whether a file is actually a directory or a program. Files that are directories will appear with a slash (/) sign after them, and program files, or "executables" appear with an asterisk (*) next to them in the display.

Finally, all of these switches can be used in combination to get the most detail possible from the ls command: ls -aFl

This command would display all normal and hidden files in the current directory, as well as listing their size and whether or not they are directories or programs. This is probably the most useful incarnation of the ls command.

In future chapters of "Technology Tips," learn about the commands for making a directory (mkdir), moving around from one directory to another (cd), removing a file from a directory (rm) and checking who's logged in (finger).