0
0
Linux CLIscripting~15 mins

ls (list files and directories) in Linux CLI - Mini Project: Build & Apply

Choose your learning style9 modes available
Listing Files and Directories with ls
📖 Scenario: You are organizing your files on your computer. You want to see what files and folders are inside a specific folder to decide what to do next.
🎯 Goal: Learn how to use the ls command to list files and directories in a folder.
📋 What You'll Learn
Use the ls command to list files
Use ls with options to show hidden files
Use ls to list files with detailed information
Use ls to list files sorted by size
💡 Why This Matters
🌍 Real World
Listing files is a daily task when managing files on any computer or server. Knowing how to see hidden files and details helps you understand your files better.
💼 Career
System administrators, developers, and anyone working with computers use <code>ls</code> to quickly check files and folders. It is a fundamental skill for working in command-line environments.
Progress0 / 4 steps
1
Create a test folder with files
Create a folder called test_folder and inside it create three files named file1.txt, file2.txt, and .hiddenfile.
Linux CLI
Need a hint?

Use mkdir test_folder to make the folder and touch to create files.

2
List files in the folder
Use the ls command to list the files inside test_folder.
Linux CLI
Need a hint?

Just type ls to see visible files.

3
List all files including hidden ones
Use the ls -a command to list all files, including hidden files, inside test_folder.
Linux CLI
Need a hint?

The -a option shows hidden files starting with a dot.

4
List files with details and sort by size
Use the ls -lS command to list files with detailed information sorted by size inside test_folder.
Linux CLI
Need a hint?

The -l option shows details like size and date, and -S sorts by size.