I Wanna List My Files!
If you have some experience with MS-DOS, then you'll be very familiar with the "dir" command, which is used to list files in your current directory.
The Linux equivalent is "ls", which stands for 'list'. Typing "ls" will display all non-hidden, non-system files and sub-directories within the current directory.
Of course, it also supports some 'switches' to display more information about the directory's files. Common switches include :
-l which shows file permissions and ownership
-a which shows all files in directory, including hidden files
-F which shows what kind of file it is, eg, a directory, executable, symlink, etc...
You can add any of the switches to the 'ls' command, or combine multiple switches. For example, typing "ls -alF" in a directory would list all the files in the directory, including hidden files, as well as show their permissions, ownership and file type. You will get a list that looks something like the following :
ariadne:~ jinny$ ls -alF
total 152
drwxr-xr-x 27 jinny jinny 918 Aug 24 17:15 ./
drwxrwxr-t 5 root admin 170 Aug 13 15:36 ../
-rw------- 1 jinny jinny 4003 Aug 24 12:03 .bash_history
drwxr-xr-x 3 jinny jinny 102 Aug 13 17:35 .netbeans/
-rw-r--r-- 1 jinny jinny 519 Aug 24 12:03 .profile
-rw------- 1 jinny jinny 5625 Aug 24 12:03 .viminfo
drwxr-xr-x 19 jinny jinny 646 Aug 23 18:49 Apps/
drwx------ 22 jinny jinny 748 Aug 24 17:19 Documents/
drwx------ 20 jinny jinny 748 Aug 24 17:19 public_html/
Viewing The Contents Of Your File
If you want to quickly view the contents of a text file, there are several methods you can use.
The first is that furry feline - "cat". Typing "cat <filename>" will display the entire contents of a text file. This is similar to how the "type" command works in DOS.
There are two other utilities available for displaying text files. The first is "more" (which is slightly 'more' enhanced than 'cat'). The second is "less" (which is actually even better, and was so named because 'less is more' - it's true, really!). Both of these programs are used in the same way as cat.
For example, to view the contents of the file 'meows' , you just type 'cat meows' and the contents of the file will be displayed on your terminal.
<<< So What Can I Do In Unix?, Copying And Moving Files : Previous Page | Next Page : Out, Out, Damned Spot!, Archiving & Tarballing Files >>>