1

I'm trying to figure out why my cat command refuses to acknowledge the file I provide.

I know that cat ignores filenames when they are absent or a - is provided, but I am not doing either of those things. The command used to work, but now it won't.

I am using a WSL Ubuntu subsystem on Windows 10. I have a simple text file called hello.txt. I am testing with the command cat hello.txt. I am in the proper directory as well. However, cat hangs and waits for me to type something into the terminal, which it then outputs.

If I run type -a cat I get this output

cat is /home/awallace110/.cargo/bin/cat
cat is /usr/bin/cat
cat is /bin/cat

What is going on?

Chris Davies
  • 116,213
  • 16
  • 160
  • 287
  • Hello @steeldriver I get cat is /home/awallace110/.cargo/bin/cat cat is /usr/bin/cat cat is /bin/cat – user521173 Apr 05 '22 at 21:23
  • 1
    Looks like you have bad kitty in your path. You should probably move /home/awallace110/.cargo/bin behind /bin – jesse_b Apr 05 '22 at 21:24
  • Is that https://crates.io/crates/cat by chance? – jesse_b Apr 05 '22 at 21:35
  • @jesse_b I'm fairly new to linux commands and am having trouble moving /home/awallace110/.cargo/bin behind /bin. Also, I don't think it's the crates version, I never added that to my rust Cargo.toml file. – user521173 Apr 05 '22 at 21:43
  • 2
    Well if you want to confirm that is the issue try /usr/bin/cat hello.txt and if that works but /home/awallace110/.cargo/bin/cat hello.txt does not work you know that version of cat is no good. You can either remove that version of cat or find what is setting your path (likely in .profile or .bash_profile) and modify it there. How to correctly add to path – jesse_b Apr 05 '22 at 21:46
  • @jesse_b /usr/bin/cat hello.txt gave me the proper response. I deleted and re-added the cat file in my /home/awallace110/.cargo/bin directory. When running cat in the terminal, it works as normal now, but I have to authenticate as root, which isn't a huge problem. I guess my PATH variable was telling cat to look into the wrong directory that had a faulty version of cat. Not sure why deleting and re-adding it fixed the issue, but it did. Thank you very much! – user521173 Apr 05 '22 at 22:08
  • 1
    Why are you adding cat to that directory anyway? Also it sounds like you added it with sudo so your user doesn't have execute permissions – jesse_b Apr 05 '22 at 22:13

0 Answers0