[SOLVED] Does anyone know how to open a hidden directory after finding it with "ls -a"?

Nov 20, 2021
2
0
10
0
I'm trying to open a hidden file in Linux terminal. The problem isn't that I don't know how to open the file (ls -a is something I've already done to see the hidden directory). My problem is that I can't seem to find a command that will open the directory. I've tried the entire family of "cat" commands, tried to make a new file and transfer the data from the hidden file to the new one, and have gone down the rabbit hole of obscure commands that must have their application downloaded before use. None of which have been successful. The thing is, I'm running within a SSH for a cybersecurity challenge, and certain commands are restricted. Unless I get the exact perfect command it wont run, and more importantly wont do anything. Sorry I'm writing out an essay, but I'm truly out of options and I have been attempting this for over two weeks.
 

LinuxDevice

Reputable
May 20, 2017
528
44
5,240
95
You can escape the leading ".". Example if the directory is "~/.hello/":
cd ~
ls -ld \.h*
ls -ld \.hello
cd .hello


You can also get help with tab completion. For example, if you know the directory starts with ".h":
ls .h # Now hit the tab key a few times

Often you can use "echo" (a shell built-in) when "ls" is missing. Example:
echo ./.hello/*

Almost forgot: The "find" command is useful because you can find by type. You can limit the "depth" as well so it only shows something like directories of the current directory (probably won't be available though in a restricted environment). Example:
find . -maxdepth 1 -type d
 

LinuxDevice

Reputable
May 20, 2017
528
44
5,240
95
You can escape the leading ".". Example if the directory is "~/.hello/":
cd ~
ls -ld \.h*
ls -ld \.hello
cd .hello


You can also get help with tab completion. For example, if you know the directory starts with ".h":
ls .h # Now hit the tab key a few times

Often you can use "echo" (a shell built-in) when "ls" is missing. Example:
echo ./.hello/*

Almost forgot: The "find" command is useful because you can find by type. You can limit the "depth" as well so it only shows something like directories of the current directory (probably won't be available though in a restricted environment). Example:
find . -maxdepth 1 -type d
 
Nov 20, 2021
2
0
10
0
THANK YOU! I followed your advice and changed the directory to the hidden one. After I did that I was able to use the "ls" command where it then showed me a text file. After that it was just opening the text file with "cat", where it showed me a flag, which is just the code needed for the challenge.

I cannot thank you enough, as that question has taken me so long to get done.
 
Thread starter Similar threads Forum Replies Date
DREDKNOT_2077 Open Source 2

ASK THE COMMUNITY