Relative is always, well, relative to some existing directory, you are currently "located" in (by means of the cd
command, usually). In your question you don't show what the current directory is. So there is no single "correct" answer.
If your current directory is, say, ~
(which is just a shortcut for your home directory, for example, /home/myuser
), then you're relative ls
command would look like (I'm adding the implied previous cd
command for clarity):
cd ~
ls UnixCourse/fileAsst/*.txt
likewise if your current directory is ~/UnixCourse
, then your relative ls
command would look like:
cd ~/UnixCourse
ls fileAsst/*.txt
or the most simply case, when you are already in the directory you want to list the contents of:
cd ~/UnixCourse/fileAsst
ls *.txt
Get the idea?
Finally, as you have (accidentally, I'd assume) discovered, you can use ..
and .
in your paths, to imply "one (sub)directory up" or "the current directory".
For example, the following paths are equivalent and all resolve to "UnixCourse/fileAsst":
UnixCourse/../UnixCourse/fileAsst/
UnixCourse/SomeOtherDir/../fileAsst/
UnixCourse/./fileAsst
UnixCourse/fileAsst/YetAnotherDir/../
Note that this is a orthogonal concept and can be used with both, relative and absolute, paths.