Use the Linux terminal to see what files are on your computer

Learn how to use the ls command to list files in the terminal with this Linux tutorial.
23 readers like this.
List files on your computer

CC BY-SA Seth Kenlon

To list files on a computer with a graphical interface, you usually open a file manager (Files on Linux, Finder on MacOS, Windows Explorer on Windows), and look at the files.

To list files in a terminal, you use the ls command to list all files in the current directory. The pwd commands tells you what directory you're currently in.

$ pwd
/home/tux
$ ls
example.txt
Documents
Downloads
Music
Pictures
Templates
Videos

You can view hidden files with the --all option:

$ pwd
/home/tux
$ ls --all
.               Downloads
..              .local
.bashrc         Music
.config         Pictures
example.txt     Templates
Documents       Videos

As you can see, the first items listed are dots. The single dot is actually a meta location meaning the folder you are currently in. The two dots indicate that you can move back from this location. That is, you are in a folder in another folder. Once you start moving around within your computer, you can use that information to create shortcuts for yourself or to increase the specificity of your paths.

Files and folders and how to tell the difference

You may notice that it's hard to tell a file from a folder. Some Linux distributions have some nice colors set up so that all folders are blue and the files are white and binary files are pink or green, and so on. If you don't see those colors, you can try ls --color. If you're color blind or on a display that doesn't provide colors, you can alternately use the --classify option:

$ pwd
/home/tux/Downloads
$ ls --classify
android-info.txt
cheat/
test-script.sh*

As you can see, folders are given a trailing slash (/) to denote that they are steps within your file system. Binary entities, like zip files and executable programs, are indicated swith an asterisk (*).

What to read next
Seth Kenlon
Seth Kenlon is a UNIX geek, free culture advocate, independent multimedia artist, and D&D nerd. He has worked in the film and computing industry, often at the same time.

Comments are closed.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.