This is an easy to follow step by step guide on Listing Files and Directories in Linux,
When you first log in to your main Linux command SSH line, your current working directory will be your home directory.
Your home directory will have a cut of your username in it, this is to keep your directory private and unique to yourself.
The command to check your current working directory is
Sometimes you will not see home dir, you might install a plugin and be in a different location, for example in the installation dir. (installed Virtualmin and our dir folder were set inside the installation dir instead of home)
As you can see from the image below;
So what you will need to do is move to the main root of your LINUX directory, to do this you will need to run the “# cd /” command and then run the “# ls” command again to view your home directory of your Linux.
so first run
# cd /
This will then take you to the main home dir of your Linux folder. As you can see below in the image example.
So remember to go to your main home dir you need to run # cd/ followed by # ls
View hidden files in your dir of your Linux
To view hidden files in your home dir of your Linux folder you will need to run #ls -a
# ls -a
When you use this command you will see the same home dir + any extra hidden files that may be in your current set directory.
See the image below for example/reference.
There are many other behavior commands, which simply can be added at the end of # ls, for example, # ls –color or # ls -d or # ls -i there are many more check the list below.
|ls -a||list all files including hidden files starting with ‘.’|
|ls –color||colored list [=always/never/auto]|
|ls -d||list directories – with ‘ */’|
|ls -F||add one char of */=>@| to entries|
|ls -i||list file’s inode index number|
|ls -l||list with the long format – show permissions|
|ls -la||list long format including hidden files|
|ls -lh||list long format with readable file size|
|ls -ls||list with long format with file size|
|ls -r||list in reverse order|
|ls -R||list recursively directory tree|
|ls -s||list file size|
|ls -S||sort by file size|
|ls -t||sort by time & date|
|ls -X||sort by extension name|
More Linux Tutorials on directories with Linux UNIX commands
- Making Directories in Linux Tutorial (the mkdir command)
- Linux Changing to a Different Directory Tutorial Guide
- Checking Current Dir & Parent Directory in Linux Tutorial
- URL Pathnames & Path Directory in Linux