When it comes to checking the current directory within Linux. Or just simply moving up to the main parent folder.
We will start inside our testfolder
First, we will type # ls -a to check for all directories
# ls -a
This is what we will see on our screen
If we type
# cd .
Note that there is a “white space between cd and the dot”
In UNIX, the dot [.] means your current directory, this is something we may not be sure about using at the moment but definitely something we will use later on, it will make
if we type
# cd ..
This will simply move us out from the current folder into the main parent folder
let’s do a quick breakdown of what has happened above;
- We are in the main “testfolder“, which contains 2 subfolders “test1” and “test2”
- We used UNIX command # cd .. which will move up 1 directory (it’s like clicking back)
- We use # ls -a to view the current directory (-a shows hidden files) this is to make sure we moved back.
- We can see the main current directory (we moved back from “testfolder” up to the main home root since “testfolder” is located at the home root folder)
it’s simple as that moving back to the main parent folder
We hope you guys enjoy this easy to follow step by step tutorial in Linux
More Linux Tutorials on directories with Linux UNIX commands
- Listing Files and Directories in Linux Tutorial Guide
- Making Directories in Linux Tutorial (the mkdir command)
- Linux Changing to a Different Directory Tutorial Guide
- URL Pathnames & Path Directory in Linux