Ubuntu server 20.04 TLS Q: why when i enter to the directory /ok/oky the cmd ls -l test1.txt work why it does'nt work directly "ls -l /ok/oky/test1.txtenter image description here
Asked
Active
Viewed 31 times
1 Answers
0
ls -l /ok/oky/test1.txt
references to file starting from root "/
" directory, aka absolute path. This file seems to not exist.
With cd ok/oky
, you are changing directory relative to your current directory, aka relative path. You can tell the current directory with command pwd
.
To correct your first command, you should use: ls -l ok/oky/test1.txt
Learn more about relative and absolute paths: https://linuxhandbook.com/absolute-vs-relative-path/

ethcz
- 249
/ok/
andok/
aren't the same. Tryls -l ok/oky/test1.txt
. – mikewhatever May 29 '22 at 18:12