View Full Version : problem with files and directory

26th October 2006, 08:05 PM
Hi, I am brand new to to linux and I was hoping to get some help with the following on what I am doing wrong. Here is what I am doing:

At root, I created a directory sports.
I cd to sports
created a directory called hockey and another directory called baseball. I also created a file called kings and another file called angels.

While in sports directory, I moved the file kings into hockey. I then typed ls and found the following entries hockey and baseball directories and kings and angels files. I then typed
mv kings hockey and typed ls. I found the following listed 2 directories: hockey and baseball and the file angels. I then typed cd hockey and then typed ls finding kings.

Here is where my problum arises i know want to move kings back to sports directory. I am in the hockey directory and I type mv kings sports but when I look in the sports directory kings is not there. What the heck is going on. Can someone please help me out. I would appreciate it.


26th October 2006, 08:14 PM
There is a good explanation here that should help you with the mv command.


26th October 2006, 08:18 PM
mv kings ..
or the full path
mv kings /whatever/sports
whatever being the full path of the dir sports is in

26th October 2006, 08:25 PM
is there a command to find where kings resides now so I can delete it. By the way thanks for helping a newbie.

26th October 2006, 08:27 PM
locate kings
you might need to run updatedb first thought if the file is new

26th October 2006, 08:34 PM
so if I am at hockey I should type mv kings /~/sports ???

26th October 2006, 08:35 PM
these files are new so just type run updatedb ??

26th October 2006, 08:44 PM
to use locate yes then updatedb
if your sports dir is in your home directory the use ~/sports w/o the first /
if you need to only go up one directory ..=move u up one, ../..=move up 2 etc.

26th October 2006, 08:55 PM
got it thanks a bunch for your help nick.