0

My home directory was not where it was supposed to be. I was able to fix the directory location. Then needed to fix the permission of home directory with

$ cd /Users/
$ sudo chown -R hook1:staff /Users/hook1
chown: /Users/hook1: no file or directory
$ ls -F
Shared/    chris/      hook1???/

Home directory incorrectly appears as hook1???/ not hook1/ Is there a reason for this?

5
  • 1
    You need to be more specific about what your issue is... what incorrectly appears? Can you tell us more specifically what was wrong that you were trying to fix, how you were trying to fix and specifics of what you are seeing now that is wrong? – Tyson Jul 17 '15 at 14:53
  • @Tyson I changed it. When I want to show a command sequence in the question, what do use around it – Chris Jul 17 '15 at 14:56
  • It looks like you have non-printable characters in your user name. Will you edit your post with the command and ouput of id ; id -un. – fd0 Jul 17 '15 at 15:06
  • I tried to fix your copy from Terminal (including the parts you've left out), please check and correct if necessary. – nohillside Jul 18 '15 at 14:09
  • @Chris: please upgrade your OQ with ls -aBl (in /Users) which is another way to find which characters are at the end of your account name. – dan Jul 27 '15 at 6:27
1

If what you posted was literally what the directory name is, then this should work:

cd /Users
mv hook1\?\?\? hook1

The problem, as fd0 points out, is that you have invisible/unprintable characters in your directory name. Use basic, non-destructive shell commands to isolate the directory name using wildcards, then rename it. For example, try this:

cd /Users
ls -ld h*

That should result in exactly one directory being listed. If it does not, continue to add letters before the * in order to create a wildcard mask that produces exactly one result:

ls -ld ho*     # produces 3 results
ls -ld hoo*    # produces 1 result

If you get to a point where you go from more than one result to zero results, then you've stumbled upon another invisible character. Back up one letter, add a question mark then re-add the letter.

ls -ld ho*     # produces 3 results
ls -ld hoo*    # produces 0 results
ls -ld ho?o*   # produces 1 result

If you still have problems, play around with more * and ? until you have something that produces exactly one result:

ls -ld ho*     # produces 3 results
ls -ld hoo*    # produces 0 results
ls -ld ho?o*   # produces 0 results
ls -ld ho*o*   # produces 1 result

Once you have that, then use that in your mv command:

mv ho*o* hook1

If none of this works, please post the results of you ls -ld experiments.

6
  • mv hook\?\?\? hook1 didn't work. Should your second set of commands be cd /Users mv hook1* hook1 I believe you are missing the 1. – Chris Jul 18 '15 at 5:37
  • Is my comment format in correct form? Please advise, still new – Chris Jul 18 '15 at 5:40
  • Your comment was fine. I originally had mv h* hook1, but I didn't know if you have more directories than you showed in your example. Basically, as fd0 points out, you have invisible/unprintable characters in your directory name. I'll update my answer with more details. – Joe Casadonte Jul 18 '15 at 13:48
  • I think this has something to do with. The-Glass-Hook:/ chris1$ ls -ld hoo* drwxr-xr-x+ 15 hook1 staff 510 Jul 15 22:25 hook1??? The-Glass-Hook:/ chris1$ cd /Users The-Glass-Hook:Users chris1$ ls -ld hoo* drwxr-xr-x 15 hook1 admin 510 Jul 18 08:20 hook1??? – Chris Jul 18 '15 at 17:25
  • The-Glass-Hook:/ chris1$ ls -F Applications/ etc@ Incompatible Software/ home/ Library/ hook1???/ Network/ installer.failurerequests System/ net/ User Information@ private/ Users/ sbin/ Volumes/ tmp@ bin/ usr/ cores/ var@ dev/ – Chris Jul 18 '15 at 17:33

You must log in to answer this question.

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