When you start up a terminal session, you are placed within your home directory (denoted by a
~). To list contents of your current working directory, simply use the
ls command (short for list).
file1.txt file2.txt file3.txt file4.txt
Here, we can see that four text files reside in our current working directory.
Additionally, you can list files within other directories by specifying the pathname after the
$ ls ~/Dropbox
Books Library Movies School Work
Hidden files are usually those that have to do with the configuration of certain programs. They are kept hidden from the user, and have a . preceding its name.
For example, the .bash_profile file, located in your home directory, is run every time you start a new terminal to configure your environment. Furthermore the .vimrc file configures your Vim settings. However, you can't see these files with a normal
ls command. To list the hidden files use the option
$ ls -a
. Applications Library .. Desktop Movies .bash_history Documents Music .bash_profile Downloads Public .vimrc Dropbox
Can you see your secret files now?
To see more details of the files, we can pass the
You should see a list of files with the following format (don't worry if your date format isn't exactly the same):
$ ls -l
total 12 drwx------ 6 JohnDoe staff 204 Jan 7 10:30 Applications drwx------+ 37 JohnDoe staff 1258 Mar 20 17:58 Desktop drwx------+ 6 JohnDoe staff 204 Mar 13 08:57 Documents drwx------+ 29 JohnDoe staff 986 Mar 22 00:06 Downloads drwx---rwx@ 25 JohnDoe staff 850 Mar 20 15:38 Dropbox drwx------@ 51 JohnDoe staff 1734 Mar 17 17:42 Library drwx------+ 3 JohnDoe staff 102 Dec 29 00:00 Movies drwx------+ 3 JohnDoe staff 102 Dec 29 00:00 Music drwxr-xr-x 4 JohnDoe staff 136 Mar 13 11:15 NetBeansProjects drwx------+ 4 JohnDoe staff 136 Dec 29 20:39 Pictures drwxr-xr-x+ 5 JohnDoe staff 170 Dec 29 00:00 Public drwx------ 4 JohnDoe staff 136 Mar 20 11:31 VirtualBox VMs
Let's break this down per attribute.
There are other options you can use, but
-a are the most common.
To combine options, simply places the two together:
$ ls -la
This foam seat cushion relieves lowerback pain, numbness and pressure sores by promoting healthy weight distribution, posture and spine alignment. Furthermore, it reduces pressure on the tailbone and hip bones while sitting. Perfect for sitting on the computer desk for long periods of time.$ Check price
Linux for Beginners doesn't make any assumptions about your background or knowledge of Linux. You need no prior knowledge to benefit from this book. You will be guided step by step using a logical and systematic approach. As new concepts, commands, or jargon are encountered they are explained in plain language, making it easy for anyone to understand.$ Check price