That's an excellent question! Beyond ~ (your home directory) and .. (the parent directory), there are a few other special directory notations that are very useful in Linux:
-
.(Single Dot): Current Directory
The single dot.represents your current working directory. While you don't often usecd .(since you're already there!), it's very common in other contexts, especially when executing scripts or specifying paths relative to your current location.- Example:
ls .would list the contents of the current directory (same asls). - Example:
./myscript.shtells the shell to executemyscript.shfrom the current directory.
- Example:
-
/(Forward Slash): Root Directory
As mentioned in the lab step, a single forward slash/represents the root directory. This is the highest level in the Linux file system hierarchy, and all other files and directories branch off from it.- Example:
cd /would take you to the root directory. - Example:
/home/labex/projectis an absolute path that starts from the root.
- Example:
-
-(Hyphen/Dash): Previous Directory
The single hyphen-is a handy shortcut to navigate back to the previous directory you were in. It's like an "undo" button forcdcommands.- Example: If you were in
/home/labexand then typedcd /etc, thencd -would take you back to/home/labex.
- Example: If you were in
These special notations make navigating the Linux file system much more efficient. Keep practicing with them, and they'll become second nature!
Do you want to try an example with any of these?