To list or view the files of a directory or folder on your computer, follow the steps below for your operating system.
Show the files in a Windows folder
Microsoft Windows users who want to list files on the computer can open My Computer or Windows Explorer and open the C: drive. Once in the C: drive, all files and folders in the root directory of your primary hard drive are listed.
- Windows.
- MS-DOS and Windows command line users.
- Windows PowerShell.
- Linux and Unix.
- Apple macOS.
In Windows, most of your programs are stored in the Program Files folder, and your documents are frequently saved in the My Documents folder.
- How to change a directory or open a folder.
MS-DOS and Windows command line
To list files while at the MS-DOS prompt or in the Windows command line, use the dir command, as shown below.
See the Windows command line steps if you are in the Windows command line.
The example below is also an example of how the files are listed when using the dir command. See the dir command help page for all the available switches that can be added to this command to perform different functions.
Example of dir command output
C:\Windows> dir Volume in drive C has no label. Volume Serial Number is 6464-D47C Directory of c:\windows 04/13/2016 06:24 AM
If there are too many files listed in one directory, you can display them one page at a time using the dir command with the /p switch.
By default, the dir command lists the files and directories for the current directory. In the example below, we’re in the Windows directory, so only files and directories in the Windows directory are shown.
dir /p
You can list files that only meet certain criteria using wildcards in the dir command. Below are a few additional examples of the dir command with wildcards.
dir *.txt
In the example above, only files with a file extension of .txt are displayed.
dir a*.*
In the example above, only files that begin with the letter “a” are displayed.
dir c:\windows
In the example above, this command lists the files in the C:\Windows directory regardless of the current directory or drive.
See our wildcard definition for further information about this term and more examples.
- How to use the Windows command line (DOS).
- How to change a directory or open a folder.
List the files in a Windows PowerShell directory
Like the Windows command line, Windows PowerShell can use the dir command to list files in the current directory. PowerShell can also use the ls and gci commands to list files in a different format.
List the files in a Linux and Unix directory
To list files in a Linux or Unix command line, use the ls command, as shown below. If you need additional examples and syntax on the ls command, see the ls command help page.
[~/public_html/rss]# ls ./ ../ history.rss issues.rss jargon.rss newjarg.rss newpages.rss newqa.rss
You can list files that only meet certain criteria using wildcards in the ls command. Below are a few additional examples of the dir command with wildcards.
We recommend using ls -laxo to view files, as it gives you full file information and permission information in an easier to read format.
ls *.txt
ls r*
In the example above, only files beginning with the letter “r” are displayed.
ls [aeiou]*
In the example above, only files that begin with a vowel (a, e, i, o, u) are displayed.
ls ~ /public_html
In the example above, the ls command lists all files in the public_html in the home directory (represented by the tilde). If this directory did not exist, you would get an error.
See our wildcard definition for further information about this term and additional examples.
- Linux and Unix shell tutorial.
- How to change a directory or open a folder.
Show the files on Apple macOS
Apple users can list files through the Finder. If you are in the Terminal, see the Linux steps that also work in the Terminal.
The tilde is a shortcut. Without the shortcut you would need to type the full directory name. For example, if your username was “hope” your home directory would be /home/hope. You can see the full working directory you’re currently in with the pwd command.
Related information
- How to print a listing of files in a directory.
- How to count how many files are in a folder or directory.
- See our file and list definitions for further information and related links.
- Computer file help and support.