Command line confusion - what do I not know?

I’ve very recently migrated from Manjaro. I like Fedora a lot. However, there is some weirdness that I’m not making sense of - the following would have worked in Majaro, or Ubuntu, or Linux Mint, but doesn’t here:

[tomc@localhost bkup]$ pwd
[tomc@localhost bkup]$ cd /home/tomc/programs/restic-backup/restic-backup-scripts/
bash: cd: /home/tomc/programs/restic-backup/restic-backup-scripts/: No such file or directory
[tomc@localhost bkup]$ cd /
[tomc@localhost /]$ cd /home/tomc/programs/restic-backup/restic-backup-scripts/
bash: cd: /home/tomc/programs/restic-backup/restic-backup-scripts/: No such file or directory
[tomc@localhost /]$ pwd
[tomc@localhost /]$ 

Can someone explain why a plain cd doesn’t just work here? Why is bash getting invoked? how do I get this command to work?

bash is the shell (Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file), and, albeit the command is correct, it says: “hey! you can’t change your position to the directory /home/tomc/programs/restic-backup/restic-backup-scripts, because it doesn’t exist”.


What are the permissions on each of the directories in the path?

Every directory in the path must have at a minimum 550 permissions and be owned by you, or 555 if not owned by you in order to even see the content. In order to write anything there the user or other must have the write bit set as well.
For me any directory I create under my users home looks like this with “ls -l”
drwxr-xr-x. 4 myid myid 4096 Aug 5 11:25 mydir
and files look like this
-rw-rw-r–. 1 myid myid 178 Oct 2 14:34 video.txt
Executable files look like this
-rwxrwxr–. 1 myid myid 178 Oct 2 14:34 video.txt

Did you by chance create the directories and files as root? Migrating from Manjaro leads me to suspect that possibility.


Initially, this made NO sense, as the file DOES exist - but not quite in the dir named:

cd /home/tomc/programs/restic-backup/restic-backup-scripts/

Here’s the problem: “/restic-backup/” was actually /restic_backup/ in my directory tree - I keyed in the name wrong when I was building the tree in my new OS. Changing the underscore to a hyphen set everything right.


You can use bash completion to prevent such typos.

So, after cd /home/tomc/programs/restic, hit TAB and it should complete it for you.

Please search the internet using your preferred search tool for “bash tab completion” and you should find lots of resources, for example:

Use Tab Completion to Type Commands Faster on Any Operating System

shell - How does bash tab completion work? - Stack Overflow


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.