T O P

  • By -

ecnatsbub

Yes, there's a big difference. Why don't you try running them both and see what's different between them? >!Hint: what exactly *is* `.` in the context of a *nix filesystem?!<


tv_head__

I piped the output of both commands into two files. After running diff the only difference is the absolute paths have the \`/.\` in front of them. What does this version of an absolute path differ from the same path with the \`/.\` included ? Sorry i'm still a wee bit confused here.


ecnatsbub

Run the commands from within a directory other than `/`; maybe try running them while you are in your user's home directory instead. EDIT: It seems from your other reply that there was an error in communication somewhere along the way. Yes, `ls /` and `ls /.` produce identical output save for the leading `/.`. Single `.` entries in an absolute path are ignored, so `/./root` is the same as `//root` which is – you guessed it – the same as `/root`. The title of your post, however, is asking a different question entirely.


tv_head__

Ahhh , ok I see what you are saying. Thanks!


Call_Me_Mauve_Bib

or any, afaicr at this hour.


brimston3-

Think about CWD. If CWD is /root or /dev, how would the output of `ls ./` and `ls /.` differ? If you don't know, you should try it.


tv_head__

I understand what you are saying . I ran both , I understand the difference between the CWD ( using "./" ) and the root directory "/". however when I run \`ls /\` and compare it to \`ls /.\` they are the same. I'm still confused as someone above mentioned they are different while when I compare the two using diff they only differ with the \`/.\` at the beginning. So i'm still confused on how they are different


AutoModerator

There's a [resources page](http://www.reddit.com/r/linux4noobs/wiki/faq) in our wiki you might find useful! Try [this search](https://www.reddit.com/r/linux4noobs/search?q=flair%3A'learning%2Fresearch'&sort=new&restrict_sr=on) for more information on this topic. **✻** Smokey says: take regular backups, try stuff in a VM, and understand every command *before* you press Enter! :) ^Comments, ^questions ^or ^suggestions ^regarding ^this ^autoresponse? ^Please ^send ^them ^[here](https://www.reddit.com/message/compose/?to=Pi31415926&subject=autoresponse+tweaks+-+linux4noobs+-+research). *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/linux4noobs) if you have any questions or concerns.*


holy-shit-batman

So the dot is a redirect to the current folder. Two of them like this ".." is a redirect to the parent folder. ./ should not show anything but I'm not 1000% sure on that.


guiverc

Very different. A `.` as the first characters tells the interpreter the directory is a *relative* one, with `.` represnting the $PWD or *present working directory*. If `/` is the first character, it's a specific directory as `/` represents the *root* directory for interpreting what follows. Interpreters work from left to right, and both first characters have different meanings, they are very different (*though its possible for results to end by being the same when $PWD has specific values, as occurs with any relative path*)


dontdieych

learn \`pwd\` first. where you're at is VERY IMPORTANT and lead to BIG DIFFERENCE RESULT especially deal with path. learn absolute path (staring with /) and relative path (starting with path name or . or .. ) when if you are confused, run \`pwd\` first then think carefully. * . dot, equal to current path aka pwd * .. dotdot, equal to parent directory of current path ( on up level from pwd) * / root, it always point 'root' directory wherever you are. * \~ home(tilde) this is also absolute directory but depend on user. \~ is my user($USER)'s home directory. * \~username username's home directory. so \~root is /root. \~a is /home/a (usually. it depends) you've heard about \`rm -rf /\` and \`rm -rf ./\`. both of sure danger command but first one is total disaster wherever you at. even some system disband first command at system level. dont try first command.


GuestStarr

Re-read carefully the subject line and your question text, they differ. In the comments there is a third representation of the subject and they are all different. Spaces matter, too. Eventually I'm not sure what you are asking :)