Skip to content
Advertisement

how do i access files in directory from another directory (linux)

im trying to change permissions on a txt file founded in directory X While im in the directory Y

  kosay_sabbah@DESKTOP-87R0T4M:~/Kosay/grp2$ chmod 777 3.txt

  chmod: cannot access '3.txt': No such file or directory

Advertisement

Answer

You should use absolute or relative file path. For example you have file1.txt in directory /directory1/ – absolute file path is /directory1/file1.txt. If your current path is /directory2/, you can run chmod for file1.txt in two ways:

  1. Using relative path – chmod ../directory1/file1.txt

  2. Using absolute path – chmod /directory1/file1.txt

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement