Lesson 1 of 23
Lesson Progress: 0%
The lscommand is one of the most commonly used commands in the Linux shell. It stands for "list" and shows you what files and folders are inside a directory. When you open a terminal, you are usually placed inside your home folder, and typing ls will display everything in that folder. You can also give ls a path to a specific folder, like ls Documents, to see what is inside that folder instead. The ls command has many options, called flags, that change how the information is shown. For example, the -a flag reveals hidden files (files that start with a dot), and the -l flag shows extra details like file size and permissions. Learning to use ls well will help you navigate and understand your filesystem quickly and confidently.
ls by itself, the shell lists the files and folders in your current directory.~/home/user.Desktop, Documents, and Downloads.ls shows the names separated by spaces, so you can quickly see what is available.ls and pressing Enter to see the list of items in your current directory.ls a path to a specific folder, like ls Documents, to see what is inside that folder.Documents or Downloads.lsshows its contents instead of the current directory's contents.ls Music and there is no Music folder, the shell will tell you it does not exist.ls lets you peek inside any folder without changing your current location..) are hidden and will not show up with a plain ls.-a flag stands for "all" and tells ls to include hidden items in the listing..bashrc that stores shell settings.ls -a to see .bashrc appear alongside the regular folders.-lflag stands for "long format" and shows extra information about each file and folder.drwxr-xr-x that shows permissions: who can read, write, or run the item.d means directory (folder), - means a regular file.ls -l to see detailed information about every item in your current directory.-la.ls -lameans "list all files in long format" — it shows hidden files with full details.-la and -al do the same thing.ls -la, you will see .bashrc listed with its permissions, size, and date.*is called a wildcard and stands for "any characters."ls Desk*, the shell matches any item whose name starts with "Desk" followed by anything else.ls Desk* matches the Desktopfolder because "Desk" + "top" fits the pattern.Test Incomplete
~$ ls~$ ls Documents~$ ls -a~$ ls -l~$ ls -la~$ ls Desk*