0

When I make a new directory, I can see it when I type ls in blue letters highlighted in green but when I try to access it it says "no such file or directory". There's another file in there that I can access but not the new ones I create.

root@CityWalk:~# cd ~/testing 
root@CityWalk:~/testing# ls 
1 
root@CityWalk:~/testing# mkdir file 
root@CityWalk:~/testing# ls 
1   file 
root@CityWalk:~/testing# cd ~/file 
-bash: cd: /root/file: No such file or directory 
root@CityWalk:~/testing#

How do I fix this?

4
  • Paste a screenshot please & what do you call "to access" files... (listing them/opening them (mention the application)/change their properties/& so on?
    – francois P
    Jan 8, 2020 at 19:30
  • 4
    If it's command line stuff you're using, please DO NOT post a screenshot. Instead, copy and paste the text. Use {} to format it as code. Jan 8, 2020 at 20:25
  • root@CityWalk:~# cd ~/testing root@CityWalk:~/testing# ls 1 root@CityWalk:~/testing# mkdir file root@CityWalk:~/testing# ls 1 file root@CityWalk:~/testing# cd ~/file -bash: cd: /root/file: No such file or directory root@CityWalk:~/testing# Jan 9, 2020 at 14:47
  • 1
    Notice the tilde ~ in the last issued command. The directory file was created under testing. I suppose it doesn't exist a file directory named file under the root directory. Jan 9, 2020 at 19:03

1 Answer 1

-1

I'm guessing here so I have two options.

  1. You might have created the folder without giving yourself permission. run this with the path to directory:

    sudo chmod a+rwx /path/to/file
    
  2. You might have created with root but you're trying to access with your normal user. Open it with sudo.

    sudo cd <directory>
    
3
  • 2
    Second option is a no-op; you cannot sudo cd ... Jan 8, 2020 at 20:23
  • 1
    And the first option would be EPERM not ENOENT as in the question.
    – JdeBP
    Jan 8, 2020 at 20:55
  • 1
    you are correct about the Sudo cd. Thank you for letting me know. Jan 8, 2020 at 21:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .