Mastering navigating the Linux file system will fasten access specific file or folder. If the Linux OS come with GUI then you got no issue navigating using interface but if the Linux OS is minimal version then navigate using CLI is a must.
First you need to know directory parent and children. Example as below:
|Type of Directory||Example|
Listing the Contents of a Directory with ls
The ls command lists the contents of the current directory.
Below show the lists content of home directory.
To show hidden files, use below command.
To include details such as the file/folder permissions, owner and group, size and the date and time, enter the following command:
Here the explanation of the listing newfile.txt
|Filetype||“-“rw-r–r– (refer to files)|
“d”rwxr-xr-x (refer to directory/folder)
|Last access date/time||Mac 26 09:54|
Another useful command as below:
- ls -R
As you can see the command scans and lists all the contents. The information can be lengthy but you can simplify by redirect the output to a text file. Example as below:
And here the output from the homedir.txt, I using command less for me go through page by page or line by line.
Changing Directories with cd
Use the cd command to move within the file system from one directory to another.
I do a ls command to show available directory. I want to change directory to Pictures, so I use command cd Pictures. You can see the change on my CLI view.
To move up to parent directory use the below command.
To return to home directory use the below command.
Another command below also help you to return to home directory.
Finding Your Current Directory with pwd
Use pwd to check the current directory you have access.