difference in outputs of pwd and /bin/pwd [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
i created a soft link from my home folder to /etc/ by using
"ln -s /etc/ foo"
then i changed directory to foo
"cd foo"
now i executed the following two commands
"pwd" and "/bin/pwd"
Both gave me different outputs.
The output of "pwd" was /home/myhome/foo and of "/bin/pwd" was /etc.
I am not able to understand the difference in the outputs although both commands are the same.

Possibly a bit oversimplified, but the bash builtin pwd tracks cd commands, so when you cd through a symbolic link, it remembers that. On the other hand, /bin/pwd walks the directory tree back to the root, and, as such, has no idea what symbolic links you might have walked through to get where you are.

Related

Efficient way of using auto complete in Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Guys What is a more efficient way of doing the following using auto-complete?
cd
ls
cd bar
ls
cd baz
ls
cd basilio
Try ls -R from the outermost folder, that will recursively list all content.
You haven't specified in which SHELL. In BASH you can do double-tab to see what are your options:
cd [TAB] [TAB] type first few letters [TAB] to complete.
Similar - but better - completion is implemented in ZSH.

How do I find the root of the directory I'm currently in for Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
like if I'm in a directory called makefile_assignment, what command would give me the higher up directories and display it like
/home/linux/ieng6/cs80w/public/makefile_assignment
I believe you're looking for:
pwd
Just the environment variable of $PWD
echo $PWD
The pwd command is what you are looking for.
The command is pwd (present working directory).
Usually, echo $PWD also works and produces the same answer.
pwd #present working directory
cd / #to your root directory

Dots in Linux output [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am receiving an error from an application I am running
The error looks like this:
I am curious what the dots mean in /usr/local/bin/../../etc/
Is this a shortcut I can use for something when writing a bash script?
I know this is probably a Linux noob question...
cd /usr/local/bin/../../etc/yarbu/conf/default
Is simply
cd /usr/etc/yarbu/conf/default
And that directory doesn't exist. It's likely located in /etc/yarbu/conf/default which is why it doesn't find it in /usr/etc...
.. is the shortcut for parent directory and . is the shortcut for current directory.
Well...
. means same directory
.. means parent directory
~ means home
/ means root
So,
/usr/local/bin/../../etc/yarbu/conf/default
is the same as,
/usr/etc/yarbu/conf/default

How to create a link to a directory on linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
This post was edited and submitted for review last month and failed to reopen the post:
Original close reason(s) were not resolved
Improve this question
How to create a link to an existing file or directory using a GNU Linux shell command?
Symbolic or soft link (files or directories, more flexible and self documenting)
# Source Link
ln -s /home/jake/doc/test/2000/something /home/jake/xxx
Hard link (files only, less flexible and not self documenting)
# Source Link
ln /home/jake/doc/test/2000/something /home/jake/xxx
More information: man ln
/home/jake/xxx is like a new directory. To avoid "is not a directory: No such file or directory" error, as #trlkly comment, use relative path in the target, that is, using the example:
cd /home/jake/
ln -s /home/jake/doc/test/2000/something xxx
you should use :
ln -s /home/jake/doc/test/2000/something xxx

How to make Linux shell command stack store only unique commands [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this question
I just reformated my HD and had to overwrite my /home partition. Everything is fine in Linux Mint 11.
Except that the command stack recall with cursor up/down displays repeats of the same command.
Like:
ls
ls
ls
cd ~
should be:
ls
cd ~
Any ideas how to fix this?
Assuming you're using bash:
export HISTIGNORE="&"
I assume you're using bash.
Add this to to your ~/.bashrc
HISTCONTROL=ignoreboth

Resources