2

I was trying to use the mv command but I made a mistake. I had a file called relazione in a directory and I was trying to move it to another directory with the same name, so I typed:

mv  relazione  /relazione

The terminal didn't let me, so I typed:

sudo mv  relazione   /relazione 

It worked. Then I realised that nothing had moved.

I did everything while I was working with gdl. I would like to know what I have done and if this can somehow give some problem with gdl.

  • 1
    It’s not clear for me what you are asking. I have no idea what gdl is. But I’d suggest you think twice before you run a command with sudo. – user2233709 Apr 04 '17 at 17:10

3 Answers3

5

Files and directories on Unix-like systems (including Linux) are organized in to a tree. At the bottom (or the top, if you're a computer scientist—they have funny trees) is the trunk or "root directory". The path for that is /. From that, you can build other paths: /relazione is a directory that is immediately off the root.

Normally, your personal files are somewhere inside your home directory (typically /home/username—so home is off of the root directory, then username is off of home. )

What you did isn't likely to break anything (though it may make it hard for you to find your files—e.g., if you use a GUI, it'll start looking in your home directory, or maybe even a directory inside that). If you're using a file indexer, those files will probably no longer be indexed. Etc. You can just move it back, with something like:

sudo mv -i /relazione ~/relazione

~/ is a quick way to specify your home directory (to save typing).

However, there is something that will break your computer: that habit of running things with sudo. When you get an error trying to run a command, there is a reason for that! Permissions are there to (among other things) protect the system from destruction, and sudo removes all restrictions. You should use it as sparingly as possible, and only when you understand the command you're about to run.

derobert
  • 109,670
0

The command you posted moves the file relazione to the root ('/').

Bruno9779
  • 1,384
0

With the command sudo mv relazione /relazione you have moved the relazione folder in your root directory (/). If you want to move the relazione file try:

mv /path_to_relazione_file/relazione /path_to_relazione_folder/relazione
sinecode
  • 639
  • Can this give me any problem with other programs? Or with the program i was in? (I launched that command while i was working with gdl by using $ and then the command) – Andrea Larosa Apr 04 '17 at 17:19
  • Don't worry it won't cause you problems. You can move again that folder with sudo mv /relazione /wherever_you_want_to_move – sinecode Apr 04 '17 at 17:23