Welcome to Linux Forums!

With a comprehensive Linux Forum, information on various types of Linux software and many Linux Reviews articles, we have all the knowledge you need a click away, or accessible via our knowledgeable members.

Linux Forum ArticlesLinux ForumsLinux Forum DownloadsLinux Hosts
Home|Register|FAQ|Member List|Calendar|Unanswered Posts|Forum Rules|Today's Posts|Advanced Search|
SEARCH FOR IN
Go Back   Linux Forums > GNU Linux Zone > Linux Newbie
Reload this Page Question regarding command.
Linux Forums
Linux Forums
Welcome To The Linux Forums!
Welcome to Linux Forums. We pride ourselves in being one of the largest Linux communities on the web, we encourage you to REGISTER on our forums and participate in the community. There are over 150,000 members ready to answer your questions. JOINING US today will allow you to make new posts, get support, send messages to other members and submit downloads to our downloads directory and many other great features!

Linux Newbie If you're new to the wonderful world of Linux, start here!

Reply
 
Thread Tools Display Modes
Old 05-12-2008   #1 (permalink)
DraginByU
Just Joined!
 
Join Date: May 2008
Posts: 2
Question regarding command.

Trying to learn Linux and trying to figure out what the "." does at the end of this command line.

cp /u/llos/pub/cars .

any help?
DraginByU is offline   Reply With Quote
Old 05-12-2008   #2 (permalink)
elija
Linux User
 
elija's Avatar
 
Join Date: Jul 2004
Location: Back in Ubuntusville
Posts: 397
in your example it would copy the file cars to the directory you are
sitting in. It would leave the file named as cars
__________________
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

Registered Linux User: #459086
elija is offline   Reply With Quote
Old 05-12-2008   #3 (permalink)
DraginByU
Just Joined!
 
Join Date: May 2008
Posts: 2
Thank you for the explanation.
DraginByU is offline   Reply With Quote
Old 05-12-2008   #4 (permalink)
i92guboj
Linux Engineer
 
Join Date: Nov 2007
Location: Córdoba (Spain)
Posts: 883
The whole story is this: on each directory (call them "folders" if you prefer) there are always, at least, two subdirectories within it. Those to entries are created at the very same time you create that folder.

You can see them if you cd into any dir and use this command:

Code:
ls -a

One is '.', which points to the same directory. As silly as it seems, it has it's uses, as you have already discorered. For example, if you are into /home/foo/docs/autralopitecus/ and you can to copy a file from /mnt/cdrom/myphotos/, you don't have to write the two paths. You just do:

Code:
cp /mnt/cdrom/myphotos/whateverfile.jpg .
Instead of this one, which is equivalent:

Code:
cp /mnt/cdrom/myphotos/whateverfile.jpg /home/foo/docs/autralopitecus/
The second misterious entry is '..' (two dots), which means "the parent dir". So, if you are into a given dir, and you want to move a file from that dir to the previous (as in parent) one, then you just do

Code:
mv filename.jpg ..
Or whatever. Always use with caution and double check before moving stuff around.

This is not exclusive to linux. Unix, bsd, msdos and even windows use this same dot and dot-dot stuff, only that you don't see that when you are clicking into a window.
i92guboj is online now   Reply With Quote
Old 05-13-2008   #5 (permalink)
elija
Linux User
 
elija's Avatar
 
Join Date: Jul 2004
Location: Back in Ubuntusville
Posts: 397
Nice explaination
__________________
Quantum materiae materietur marmota monax si marmota monax materiam possit materiari?

Registered Linux User: #459086
elija is offline   Reply With Quote
Old 05-13-2008   #6 (permalink)
Kieren
Linux User
 
Join Date: Aug 2007
Location: England
Posts: 275
Quote:
Originally Posted by i92guboj View Post
The whole story is this: on each directory (call them "folders" if you prefer) there are always, at least, two subdirectories within it.
Just to be picky, the root directory doesn't have a parent directory so there is no '..' for /
__________________
My Blog
Linux User #453176
AMD Opteron(tm) Processor 146 (2.01GHz)
1GB Memory
GeForce 7600 GS (256 MB)
Kieren is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


All times are GMT. The time now is 04:17 AM.

Powered by vBulletin 3.6.8 ©2000 - 2007, content relevant URLs by vBSEO, Property of Core Root.

Content Relevant URLs by vBSEO 3.0.0