What does 'ls ..' do?

QuestionsQuestions8 SkillsProDec, 12 2025
0113

That's an excellent follow-up question, and it shows you're thinking deeply about these commands!

You asked: "What does ls .. do?"

Let's break it down:

  • ls is the command to list files and directories.
  • .. (two dots) specifically refers to the parent directory (the directory directly above your current one).

So, when you combine them as ls .., you are asking the system to list the contents of the parent directory, without actually changing your current directory.

Example:

  1. Let's say your current directory is /home/labex/project.
  2. If you type ls .., the command will list the contents of /home/labex (because /home/labex is the parent of /home/labex/project).
  3. However, after running ls .., your current working directory will still be /home/labex/project. You haven't moved; you just "looked into" the parent directory.

This is different from cd .., which actually changes your current directory to the parent directory.

It's a useful command for quickly checking what's in the directory above you without having to move there! Do you see how that distinguishes it from cd ..?

0 Comments

no data
Be the first to share your comment!