[SOLVED] Trying to move a file from folder to folder in Ubuntu get a message: Permissio Denied
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
Top level directories (like your /LEGENDRE) usually belongs root, because only root can create directories at "/".
So you can't move files there as regular user.
Either change permissions to /LEGENDRE directory to be able to write there or move your file as root, using "sudo" (or "su").
Keep in mind in latter case your file will be owned by root, so you can't access it as regular user later.
You guys scared me quite a bit. I do have a directory called LEGENDRE but I don't know where it is. I mean I use its files every day but how would I know if it is home or at the root? I work a lot of GFortran but my knowledge of the Ubuntu OS is rudimentary. This is why I post at newbies section here. I should probably read on the subject a little bit. Also I will try to check the permission the way Mr. Devil :-) and smallpond are suggesting. Now I am away from my Ubuntu machine, sorry. I will post explaining what happened.
you have two directories named LEGENDRE.
The first one located at your home directory (tilde symbol "~" stands for your home directory, assume it is "/home/alex")
Since it located at your home directory, and hence inherits parent's directory permissions, you can access this folder and manipulate files located there.
The second LEGENDRE located at your filesystem root "/" (most top level directory).
Since root ("/") isn't your directory, you have no permissions to create, delete and modify files at /LEGENDRE because this folder inherits permissions from "/" i.e. belongs root user.
this command should list your top level directories with the permissions and ownership
Teufel, I am sorry but this is incorrect. What I actually wanted was to move the file in question four1.f08one step down, if it makes sense. I wanted to drop it behind QUADRATUTE, look:
VirtualBox:~/LEGENDRE/four1.f08 <== this is how I wanted it to place. So, I hoped it would move from the folder
/LEGENDRE/QUADRATURE/four1.f08 to the folder:
Does it make sense? Thanks, - A.
It explains where is your fault: you added unnecessary slash at your command so we went wrong way (to the filesystem root):
if you want to move a file from ~/LEGENDRE/QUADRATURE to ~/LEGENDRE (one level up) try this:
mv four1.f08 ~/LEGENDRE
Note that the ~/LEGENDRE isn't the same as /LEGENDRE
They are two different directories.
Extra tilde (~) is substitution for your home directory, so fully qualified path for ~/LEGENDRE is
Teufel, thank you. Your command worked, HOWEVER, I did something stupid. This is what happened. First of all I had no file to move, because yesterday out of desperation, after I tried different commands I simply created a new four1.f08 file in that directory where I wanted it to be, copied all code to a clipboard and pasted it then to a new file. Then I destroyed the old one.
So, now I had to crease a new file in ~/LEGENDRE/QUADRATURE. I then moved it to ~/LEGENDRE/ and then I decided to try to move it back for practice. So, I used this command mv four1_1.f08 ~/QUADRATURE(an empty file actually). I cannot find the file I wanted to move back in QUADRATURE folder. Instead the command created a file QUADRATURE in what appears to be the root directory. And the empty file I created for the purpose of training has disappeared. Oh' Lordie. = A.
What does "crease" means? Is it "create" or is it "erase"? Or is it "create+erase"?
You have to calm down.
If you lost a file, may be it not erased, just moved somewhere. Try to find it:
find -name four1.f08
if it exists somewhere under your home directory, "find" command will find it.
And some tips:
1.Use bash autocompletion. When you typing a file name or directory name, do not type it completely, type few first letters and then press "Tab" key. If you have only one file/directory name that matches to typed letters, autocompletion will extend it to the full name. If there is no matching names, nothing will be added to the typed part. If there is a few matches, all of them will be listed, continue with the next letters. Autocompletion helps to prevent such an errors where you typed erroneous file/directory name.
2.Do not forget that "~" is the substitution for you home directory. I.e. "cd ~" is equal to "cd /home/alex"
3.Do not rush. Do not experiment with unfamiliar commands on important files. Create some temporary directory with files to train there.
Teufel, thank you. I am at work now and will do what you suggested later tonight. That word meant "create" not "crease," sorry for misspelling. Since the file was really temporary and I was focusing on other things I realized after 30 minutes that I forgot its name. So, I cannot now find where it is. It sound comical but it is true. I work with Ubuntu for 2-3 hours every nigh and on weekends, hopefully I will find that file eventually, but now I want to follow what you said, perhaps try another transfer and report back but it will take some time. Thank you very much.
OK, it seems, everything is working. I carefully read all posts and practiced a few moves. Now it is simple. I moved a test file from one directory to another, back and forth. Now I will pay attention to tilde and such. The issue is resolved. I marked all posts as useful and they really are. Thank you very much.