Never used Linux before and trying to understand the difference between
ls
and
ls /
"ls /" gets all my dir (and more, but not .files - hidden files) as we can see it in this extensive list of commands.
What about the ls?
Never used Linux before and trying to understand the difference between
ls
and
ls /
"ls /" gets all my dir (and more, but not .files - hidden files) as we can see it in this extensive list of commands.
What about the ls?
ls is standing for listing directories and files under a directory.
In your situation, ls (without a directory argument) is going to list directories and files under the current directory(pwd). The other command, ls / is going to list files and directories under the root directory which is /.
ls alone will print your current directory's contents; you can use ls with arguments to display other information. An example would be ls -a where -a is the option, and displays listing directories including those starting with a dot (.htaccess for instance). ls has several argument options; short ones begin with a dash (-) like those as mentioned above -a, and there are longer ones too that start with a double dash (--) like --all which is the long version of -a and does the same thing.
ls / is the listing directory (ls) command and / is folder structure that ls will act on. In this case, you are invoking a listing of the directory contents on the / folder which is the root directory. An example of the usage of ls and folder structures would be using ls /home to display the /home directory contents.
To put it all together; you can use ls with an option (-a) and a folder structure like in the example below:
ls -a /home
I hope this helps!
For an advanced way to view your ls results please see this stackoverflow answer.