I have made a mistake. Don't know what to do?
I wanted to move a file from my current directory to root so i ran the command
shell> mv filename /~ I mistakenly put the slast before, Now what happened is this that a file with the name ~ is created in / and now i have lost access to ~ and i could not open terminal, or browse to ~ using my X either. Can anyone tell me what options i have. Thanks |
This should work:
Quote:
Step 2), of course, is to move "/myfile" to whatever directory you want. Take it slow, be careful - and you should be fine. |
Put double quotes around ~ when you refer to it as a file:
Code:
mv "~" newname |
I am unable to run the terminal as it says /root is not accessible where should i put this command thanks
|
Run this in a shell window, just like you did in your first post. You must have been root then (or you've changed permissions on your root directory - a bad idea).
Start a terminal window as a normal user. Run: Code:
sudo -s |
Yes by terminal i meant the shell. Once I wrote that command and then closed down the shell window, I could not open the shell window again. because the shell was set to the ~ directory by default and now its inaccessible. Any ideas what I should do to open shell first?
|
The command you gave in your first post would not have created this problem, nor would you lose access to ~ (which is just a shell shortcut name for the path to your home directory). So something else must have been done as well. That is, unless "filename" was the shell program (eg. /bin/bash).
I don't understand what this means: "because the shell was set to the ~ directory by default" - its nonsensical. You can always boot from a live cd to return the files to the correct directory/names, but unless you can clarify exactly what you changed, I can't give you the exact commands to resolve the problem. Have you confirmed you cannot login as either a) root or b) a non-root user? |
"because the shell was set to the ~ directory by default"
The above line means whenever i open the shell it comes like this [root@asif ~]# Now this ~ represents I was falling in this ~ directory. After running the command in my first post, whenever I tries to run the shell using the gnome terminal menu it gives me the error message that /root is not accessible. Now I really don't understand why is this so. I will confirm you whether I can login with root or not in a short while. Thanks |
Quote:
http://www.computerhope.com/unix/umv.htm |
Quote:
Code:
tred@vaio:~$ pwd Please post the output of Code:
cat /home/your_username/.bash_history Code:
cat /root/.bash_history Code:
ls -al /root |
Quote:
1) you are able to run a shell 2) that shell is a root shell (the # prompt) 3) the UID is root (the root part in root@asif) 4) the ~ means "home directory of the user", so you are in the current user's home directory. Bash has an option to print out the home directory using either ~ or the (partial) path to the user's home directory. The above PROMPT shows nothing wrong. In fact, it does show you CAN run a shell. So do your fixup work in that shell. A file named /~ will not cause any problems. Just move it to the location/name you want. The not accessible error message you see may be a permissions issue, and has nothing to do with the file named /~. What is the output of: Code:
ls -ld / ~root /root |
Hi, muasfi80 -
Whatever is wrong, it's actually probably going to be pretty easy to fix. The tricky part is figuring out exactly what is wrong. QUESTIONS: 1. Can you get to a command prompt? If so, please execute the command Mr. C. suggested: Quote:
2. Can you log out, and log back in? As which user? Have you tried another, different user? 3. Can you boot from CD? Thank you in advance .. PSM |
From the original poster:
Quote:
|
Quote:
|
All times are GMT -5. The time now is 06:54 AM. |