AI Hints
Home›Linux Tutorial›Files and Folders
Linux · Lesson 15 of 120

ls: What Is Here?

Listing a folder.

⏱ 2 min read▶ Video at 16:42🎓 Free
Watch this lesson in the Linux courseWatch on YouTube ↗Full Linux course

Now that you know where you are, the next question is, what's here? The LS command answers that. It's short for list, and you'll use it more than almost any other command.

ls: What Is Here?
From the video: ls: What Is Here?
  • What's in this folder?
  • ls lists it
  • You'll use it constantly

Listing your home folder

Type LS, and press Enter. Sam's home folder holds four folders, Documents, Downloads, Music, and Pictures, and two text files, notes, and to do. LS lists them in alphabetical order, with capital letters first.

Terminal
ls
Documents  Downloads  Music  Pictures  notes.txt  todo.txt

Listing another folder

You can also give LS a folder to look into, without going there. LS Documents shows the two files inside Documents. And LS Pictures shows two photos. Notice the prompt never changed. We're still at home.

Terminal
ls Documents
cv.txt  report.txt
ls Pictures
beach.jpg  party.jpg

Folder or file?

In this plain list, it's hard to tell folders from files. Dash capital F fixes that. It adds a slash after every folder. Now we can see at a glance, that Documents is a folder, and notes dot TXT is a file.

Terminal
ls -F
Documents/  Downloads/  Music/  Pictures/  notes.txt  todo.txt

Summary

LS lists the current folder, LS followed by a name lists another folder, and dash capital F marks folders with a slash. Next, moving around the tree.

Key takeaways
  • ls
  • ls <folder>
  • ls -F marks folders
Next up: cd: Moving Around — changing folder