0

I am a noob, gains are slow. working on moving things around, playing.

Command: mv man-pages(man-pages folder) /bob. instead of moving the man-pages folder(directory?) to directory bob, it took all 10 files inside the man-pages folder and dumped them into bob. command: ls in bob instead of a man pages folder i have the 10 folders which was inside it. in search i dont see a different command to move folders, mv is for file and folder?

what should i have done to move this folder?

how to i take all ten of these files(which are all actually sub-folders) and put them back under a single folder/directory? one thing i looked at has me entering on the command line each of these files one at a time?

EDIT: after some more playing, ive discovered ive created a "bob" directory under root? now i'm confused.

bob@adminbaby:/home$ cd bob
bob@adminbaby:~$ pwd
/home/bob
bob@adminbaby:~$ ls
Desktop    Downloads  Pictures  skip.txtsss  Templates
Documents  Music      Public    snap         Videos
bob@adminbaby:~$ cd bob
bash: cd: bob: No such file or directory
bob@adminbaby:~$ cd /bob
bob@adminbaby:/bob$ pwd
/bob
bob@adminbaby:/bob$ ls
Changes       etc          lsm       man3       man4  man8     share
Changes.old   GNUmakefile  man1      man3const  man5  README
CONTRIBUTING  INSTALL      man2      man3head   man6  RELEASE
CPPLINT.cfg   LICENSES     man2type  man3type   man7  scripts
bob@adminbaby:/bob$ cd .
bob@adminbaby:/bob$ ls
Changes       etc          lsm       man3       man4  man8     share
Changes.old   GNUmakefile  man1      man3const  man5  README
CONTRIBUTING  INSTALL      man2      man3head   man6  RELEASE
CPPLINT.cfg   LICENSES     man2type  man3type   man7  scripts
bob@adminbaby:/bob$ cd ..
bob@adminbaby:/$ pwd
/
bob@adminbaby:/$ ls
bin   dev   lib    libx32      mnt   root  snap      sys  var
bob   etc   lib32  lost+found  opt   run   srv       tmp
boot  home  lib64  media       proc  sbin  swap.img  usr
bob@adminbaby:/$ pwd
/

ok....so / is "root" and i created a directory there "bob". But what i was trying to do was put it @ bob that has Downloads, Pictures, etc. i thought ~ and / meant the same thing?

1
  • What was the actual command you used for the mv man-pages(man-pages folder) /bob? Commented Oct 15, 2023 at 20:16

3 Answers 3

0

/ is the root directory. So, if you mv a directory to /, it is moved to the root directory. Nothing strange there. If you want to mv it to /home/bob. you should mv it there.

If /home/bob is your home directory, you can also mv man-pages ~. ~ is a sort of abbreviation for your home directory.

To get the directory under your home directory, simply mv /bob ~/man-pages (assuming that there is no directory man-pages under your homedir yet`.

Now there is something strange, at least non-standard, in your situation. You were able to create a directory directly under / as a normal user. You should not have been able to do that.

1
  • I posted the wrong code it appears. I did use mv as you stated, i just made a rookie error where i was sending it. but what i didnt understand is why instead of the folder "man-pages" being moved, it took all the folders inside of it out of the containing folder. Commented Oct 16, 2023 at 17:54
0

One method would be cp -r; the -r flag is required to move the directory contents as well.

Pulling up the man page for mv will likely have the same flag.

0

Clarification on root and user directories

In a computer, there is one root user and possibly multiple other users.

/ refers to the root user directory.

Now, the root user has access to data for all users.

/home/{user} is the place where the data for all users other than the root user are present. As an example, /home/bob is where your data is present, where your Downloads, Documents and other folders sit.

So, / is root dir.

/home/bob is a dir inside your root dir.

~ is "your"(bob's) home dir, which means it is the same as /home/bob

And if you want to know which user you are logged in with currently, simply do -

$ whoami
bob

mv command syntax

$ mv <what to move> <where to move>

case 1: You want to move a file or a directory

$ mv <file/dir name> <where to move>

case 2: You want to move everything that is present inside dir1 to dir2

$ mv dir1/* dir2

As can be understood, in case 2, if you move everything from inside dir1 to dir2, dir1 will become empty.

2
  • thank you for your answer, it was helpful and clarified things for me. sorry I cant' upvote your answer. Commented Oct 17, 2023 at 3:02
  • glad it helped :) Commented Oct 17, 2023 at 8:34

You must log in to answer this question.

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