Bash - moved /Users/me to /usr/local/me - how to move it back and not break anything? I was trying to set up Tomcat to use with Java, and somehow moved /Users/me to /usr/local/me.    When I try to open any icons on desktop, they do not open, but everything that was already open still functions / saves fine (at least it seems). 

My question: How can i move (user) tori  from usr/local/tori  back to Users/tori where it belongs, without breaking anything?   (I've had enough "fun" for the week). 

Everything that follows is just context to how I got there and may well be irrelevant for answering, I am including it in case it is relevant. Thank you so much!! 



Current situation: 

When I start a new terminal session, I get: 

No home directory: /Users/tori
mkdir: //.bash_sessions: Permission denied
touch: //.bash_sessions/817C7D82-8749-4B96-9AC6-CAA07F9CE1B0.historynew: No such file or directory  

$USER  / who / w / whoami   output: tori, the right user at least. 

$ finger tori  Outputs: .. Directory: /Users/tori  (note: there is not a Users/tori  when I cd into Users).



Commands I ran leading up to current situation: 

$ sudo ln -s /Applications/tomcat-apache-9.0.30
--- I did enter password. I realize I did not put the desired name of the link after this, doubt this caused the error. 

$ sudo chown -R tori /Applications/tomcat-apache-9.0.30
--- I was NOT prompted to enter password

$ sudo chmod +x /Applications/tomcat-apache-9.0.30/bin/*.sh I was NOT prompted to enter password

$ sudo chmod +x ./bin/*.sh + I did enter password.   Is to make all .sh files executable.  I was trying to execute  bin/catalina.sh start (and variants thereof) to start Tomcat server (I didn't get it to start yet).  

$ bin/catalina.sh start    Output: 
bin/catalina.sh: /bin/sh^M: bad interpreter: No such file or directory

$ sed -i -e 's/\r$//' catalina.sh Attempt to fix ^M errors (I tried to brew install dos2unix and got errors).  

$ sudo chown -R $USER ~/.bash_sessions; chmod 700 ~/.bash_sessions

Output:

chown: //.bash_sessions: No such file or directory
chmod: //.bash_sessions: No such file or directory




EDIT 

output of ls -la /usr/local/tori ,as suggested: 

total 960
drwxr-xr-x+  66 tori  staff    2244 Dec 24 20:39 .  
drwxr-xr-x   16 root  wheel     544 Dec 24 20:57 ..
-r--------    1 tori  staff       7 Nov 17  2017 .CFUserTextEncoding
-rw-r--r--@   1 tori  staff   18436 Dec 29 17:20 .DS_Store
drwx------@   3 tori  staff     102 May  5  2018 Applications  
drwx------+  44 tori  staff    1496 Dec 24 21:01 Desktop
First: nothing in the commands you listed should have moved your home directory (unless there's something even weirder than carriage returns in catalina.sh?), so I'd run some additional checks to makes sure that's what actually happened before trying to fix it based on that assumption. First, run ls -lae /usr/local/tori and verify its output. You should see your regular home directory contents (including Desktop, Documents, etc, and probably a bunch of dotfiles). Make sure they're all owned by your account. Make sure the "." entry (the directory itself) is also owned by you. (The parent directory, "..", might be owned by root or something; that's ok.) Some of the standard subfolders should have an ACL like "0: group:everyone deny delete" on them. (So should the directory itself, but if it had you wouldn't have been able to do this, so it must not be there.)

If things aren't all there, aren't owned by you, or anything else looks weird, stop and investigate further before proceeding.

If that looks ok, and /Users/tori doesn't exist, then you should be able to fix it with:

sudo mv /usr/local/tori /Users/tori


Note: in your question, you used a number of absolute-looking paths without the leading "/" (e.g. usr/local/tori instead of /usr/local/tori). The difference matters; if you use a path that doesn't start with "/" (or "~"), it'll be resolved relative to your current location, which might not be what you expect.

Also, since we don't know what caused this, I'd take a really close look at the catalina.sh script, to make sure this doesn't happen again. And make sure you have a good backup of your system, in case things do go sideways again.