Is there ever a benefit to preceding a path with ./ (dot slash)?   In most cases, cd ./home is equivalent to cd home (and also cd ./././././home).   Is there ever a case where these two paths would NOT evaluate to the same path? Is there some benefit or drawback to either having or NOT having ./ at the beginning of a folder or file path?  What if from inside a program or script, I wanted open a config file, i'm hard coding a file to open, should it be:  resource/config.txt  OR  ./resource/config.txt  Does POSIX (or common Unix implementations) give any semantic difference between opening these two paths?
119362
What's the difference between du -sh * and du -sh ./* ?  Note: What interests me is the * and ./* parts.
60044
I'm .taring some files with the path example/super_user/Output.*.  The resulting .tar looks like this:  + example     + super_user           - Output.zip           - Output.xml           - Output.txt   But I want the file to be like the following:  - Output.zip - Output.xml - Output.txt   Do you know how I can achieve this while still being in another directory?
89650
This is merely just a vocabulary question, but which keeps turning around in my head.  It comes from a practice exam from a  preparation book. The correct answer according to the book is that ~/Documents is a relative directory because it is relative to the home directory.  However, this book contains an honourable ratio of typos and mistakes so I cannot take for granted everything which is written there. Here I do not agree because for me ~ acts as a variable expanded by the shell into either the content of the $HOME variable or the current user home directory path (cf. ), so the actual path is /home/myuser/Documents which is indeed an absolute directory.  Even , for once, seems of no help to me on this topic (even if it seems to confirm that the book is wrong on this one):     An absolute or full path points to the same location in a file system   regardless of the current working directory. To do that, it must   contain the root directory.      By contrast, a relative path starts from some given working directory,   avoiding the need to provide the full absolute path.   Here again, I do not agree: according to this definition, the path /opt/kde3/bin/../lib which does not depends of the current working directory should be an absolute one, however my current understanding of this matches the book's author making this path a relative one.  A quick web-search is just adding to my frustration, according to :     absolute path - A path relative to the root directory. Its first character must be the pathname separator.   So $HOME/Documents, or even just $HOME would not be considered absolute directories? Or does this definition implies variable expansion? What about the shell's ~ character? Is there any reliable definition of relative vs. absolute directory I can find somewhere and am I wrong all of the way?
76119
I am trying to install something and among the steps there was this one:  "Place it on your $PATH"  What does this mean? What is that?  I have searched both this site and on Google but everyone just takes it for granted!
82137
On Windows/DOS terminals a cd.. correctly change the directory.  On Linux terminals the dots from the cd command have to be separated. I'd like to know how/why is this necessary for the parser to work. If no space is added then the command is not understood.   This works well   cd ..   This does not work  cd..   Probably the regExp or whatever is parsing the commands is not including the dot as a possible character immediately after the command.
99927
I added a symlink to the current directory with ln -s . aa. If I execute cd aa, and after that I executed pwd, the response is /home/sim/aa.  But if I execute /bin/pwd it prints /home/sim (the current directory hasn't changed).  Where does this difference come from?
9727
When I cd a link, my current path is prefixed with the link's path, rather than the path of the directory the link links to.  E.g.  ~/dirlinks/maths$ ls -l logic lrwxrwxrwx 1 tim tim 71 Jul 27 10:24 logic -&gt; /windows-d/academic discipline/study objects/areas/formal systems/logic  ~/dirlinks/maths$ cd logic ~/dirlinks/maths/logic$ pwd /home/tim/dirlinks/maths/logic  ~/dirlinks/maths/logic$ cd .. ~/dirlinks/maths$   I would like to have my current path changed to the path of the linked dir, so that I can work with the parent dirs of the linked dir as well. Besides ls the link to find out the linked dir, and then cd into it, what are some simpler ways to accomplish that? For example, after cd into a link, how do you change your current path to the path of the linked dir?
123368
I know people use : instead of / when they are dealing with paths, but  what does :g do in the following sed action?  Why is path1 between quotation mark? Can anyone explain the action of this code?  sed -i -e s:INPUT_REPLACE:"${path1}":g ${path2}
895
I would like to frequently switch between directories that are in totally unrelated paths, for example /Project/Warnest/docs/ and ~/Dropbox/Projects/ds/test/.  But I don't want to type cd /[full-path]/ all the time. Are there any shortcut commands to switch to previously worked directories?  One solution I could think of is to add environment variables to my bash .profile for the frequently used directories and cd to them using those variables.  But is there any other solution to this?
65040
I accidentally unset all the directories of $PATH while trying to add a new one in ~/.bashrc. I opened a new terminal window as I was editing and now $PATH is empty. I'm worried if I boot from another drive to find the $PATH I won't be able to boot into this drive again.  Basically, what is the default result of echo $PATH?
68546
I have six directories with command files. These are /bin, /sbin, /usr/bin, /usr/sbin, /usr/local/bin and /usr/local/sbin.  What are the differences between these? If I'm writing my own scripts, where should I add them?    Related:
46724
Why when I enter this command the prompt changes to my directory?  PS1='$(pwd)'   I am using single quotes, which means no interpolation , a.k.a echo '$(pwd)' ——→ $(pwd)  Furthermore, say that we clarified why this works... why is it functioning differently from PS1=$(pwd) ? (no quotes at all)  By different I mean that if I use the quotes then the prompt will keep changing to my current directory as I navigate through the terminal. But if I don't use quotes, then the prompt will always remain the directory that I was in when I first entered the command PS1=$(pwd)  why?
54667
I just wanted to ask whether there is any command which would work on common shells (bash, dash, kornshell)? It is supposed to check if the line variable contains any part of the path.  if [[ $line =~ "$PWD"$ ]] ;then
72260
I can't figure out how to write the path of a folder that includes spaces in its name (in Terminal).  I tried:  cd /path/path/path/"A Folder"/file  cd /path/path/path/'A Folder/file  cd /path/path/path/A_Folder/file   but they all return the error through the terminal:  [command]: cannot access '/path/path/path/A Folder/file' No such a file or directory    I can still access it through steps like so:  cd /home cd user cd Desktop cd "Bash Programming" bash Example
44870
I'm new to Linux and Ubuntu. People keep using ~/filename in their answers to my questions. What does ~/ mean?
13829
This is a situation I often find myself in:  mkdir /Some/really/long/path/to/a/directory/ cd /Some/really/long/path/to/a/directory/   I know that ideally you would cd /Some/...etc.../a/ and then mkdir directory, but I've often performed mkdir first and then had to cd to the end of the same lengthy file path I just created.  Short of doing...  var="/Some/...etc.../a/" mkdir $var/directory; cd $var   ...which is even worse, is there some way to reuse the parameter passed to the previous command? I'm aware of course of tab completion, but in a series of nested directories with similar names this doesn't always help that much. Ideally, I'm hoping for a shortcut like $# or $@.  Failing this, the next best time-saving solution would be equally appreciated!
93336
Let's say you have directories /dir1 and /dir2/linked, where the latter is a symlink to the former.   When you cd to linked and pwd, you get the output /dir2/linked. If you then cd .., you'll be put on /dir2. This behaviour is consistent with the concept of you being in /dir2/linked before. However, as I understand it, the parent directory (..) of any directory is stored in the directory inode (i.e.:physically in the disk). Obviously,  since /dir2/linked is really /dir1, the parent directory on the inode must be /  To further complicate matters, while inside /dir2/linked, the outputs of ls .. and cd .. ; ls . are different! It seems like cd honors the symlinked path, while ls honors the "physical" path. As mentioned in , there's cd -P for this use case, though.  man pwd mentions "physical" and "logical" working directories, but I still have a few questions at this point:   Is this behaviour always provided by the PWD environment variable, as mentioned in man pwd? Why do default cd and ls have different behaviours, if they're both shell commands (i.e.: not programs)? Does the typical program (not shell command) use PWD instead of the physical path? I realize it's up to the implementation, but is there any rule of thumb?