Why after write command ls I can't see real folders?
After user comments, I am going to edit this question trying to be accurate, even when pLumo gave the correct answer (thanks a lot!)
I open the terminal, to connect my remote server as root user:
shh root@myipinside my server as a root user:
[root@servidor ~]If type ls I get some files BUT I cannot see any folder as /home.
When I type /home, actually I access to /home directory so I can do ls and see everything inside this directory.
The question was, why from [root@servidor ~] I couldn't see everything in server?
If I do that, but in my laptop, when I run terminal I can see many folders, but like server case, If I do cd / to come to root directory, I see everything again.
When I start my terminal:
~ if I type ls:
Code Desktop Downloads Music pdf Public Videos
Descargas Documents Escritorio Pictures TemplatesIf I type pwd:
/home/mynameuserIf I type from ~ :
~ cd /I can see every directory and files:
bin Documents lib Music run Templates vmlinuz
boot Downloads lib64 opt sbin timeshift vmlinuz.old
cdrom etc lost+found Pictures snap tmp
core home media proc srv usr
Desktop initrd.img mnt Public swapfile var
dev initrd.img.old mssql-cli root sys VideosIf I type from /:
/ cd home/mynameuserI go to same ~ at beginning:
pwd =>
home/mynameuserI think, I solve my own question after pLumo explanation.
When I start my terminal in my laptop, it opens inside /home/mynameuser.
When I start my ssh connection, It starts in /root directory, that it is not /home directory.
1 Answer
TL;DR:
With ls you see the contents of the current working dir. You are probably inside ~, not in /, that is why you cannot see /home.
The directory home is usually placed below /, the directory root. Running ls /home will show the content from anywhere, because path names starting with / are absolute paths.
When using ls you're searching for directories in your current working directory. Use pwd to reveal it. For a new ssh connection it is usually ~ (a.k.a. /home/$USER/ == the users home directory) .
Use ls / to see home inside the directory root or cd / to change your current working directory to the directory root.
More in general
"Zoraya ter Beek, age 29, just died by assisted suicide in the Netherlands. She was physically healthy, but psychologically depressed. It's an abomination that an entire society would actively facilitate, even encourage, someone ending their own life because they had no hope. Th…"