Cd is a command-line utility to change the working directory.
56
votes
6answers
4k views
Why is cd not a program?
I've always wondered why cd isn't a program, but never managed to find the answer.
Anyone know why this is the case?
14
votes
1answer
927 views
Execute bash scripts on entering a directory
What is the best way to execute a script when entering into a directory? When I move into a new directory I would like bash to execute the projectSettings.bash script much like RVM does.
17
votes
2answers
477 views
What is the point of the `cd` external command?
As referenced in this fine answer, POSIX systems have an external binary cd in addition to the shell builtin. On OS X 10.8 it's /usr/bin/cd. You can't use it like the builtin cd since it exits ...
3
votes
1answer
493 views
changing current working dir with a script
I've read this question and answer, but it doesn't quit fit my problem, even tho it's similar.
I'm writing a script (called cpj) that will launch one of my current projects. I have about 5 of them. ...
19
votes
6answers
1k views
Why can't I redirect a path name output from one command to “cd”?
I am trying to get cd to accept a directory name redirected to it from another command. Neither of these methods work:
$ echo $HOME | cd
$ echo $HOME | xargs cd
This does work:
$ cd $(echo $HOME)
...
5
votes
3answers
492 views
How to verify a CD against an ISO image?
I've got a physical burnt CD and the original ISO image of it. No reference checksum files were provided for the CD contents. How do I check the actual CD is correct (corresponds to the original ...
4
votes
4answers
741 views
Make cd automatically ls
I find that I often do the following
%> cd bla/bla
%> ls
I would like it that whenever I cd into a directory it automatically does an ls.
I fiddled with my .bashrc for a while, but couldn't ...
47
votes
21answers
4k views
Quick directory navigation in the terminal
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 ...
9
votes
4answers
2k views
symbolic link to a directory and relative path
I've created symlink with absolute path to the directory (Blink) and have for example following tree:
$ ls -l /tmp/A
total 0
lrwxrwxrwx 1 root root 6 Apr 3 12:27 Blink -> /tmp/B
-rw-r--r-- 1 root ...
9
votes
4answers
2k views
Script to change current directory (cd, pwd)
I want to run a script to simply change the current working directory:
#!/bin/bash
cd web/www/project
But, after I run it, the current pwd remains unchanged! How can I do that?
12
votes
3answers
1k views
Changing parent directory (../) with symlinks
I have a symlink
~/link -> ~/a/really/long/path
When I do
cd ~/link
cd ..
it takes me to
~
but I want to go to
~/a/really/long
Is there a way to do this?
I am using bash.
4
votes
1answer
193 views
Symbolic links with ls, mv: forcing the functions to utilize “logical” addresses (remembering the original path)
It seems that for many basic functions operating on symbolic links, the physical path is used by default. However, cd works fine. When moving into a symbolic link, cd remembers where I came from so it ...
2
votes
1answer
318 views
Make cd follow symbolic links
I have my code mounted as an sshfs in my home directory, but the hierarchy is difficult to remember, so I created a symlink in my home directory leading to that directory. Is there a way so that when ...
2
votes
5answers
924 views
Perl script, do cd on terminal
In Script to change current directory (cd, pwd)
it is shown how to run a bash script that changes terminal directory.
But how do i run a perl script that runs a bash script that changes terminal ...
2
votes
1answer
1k views
Why can't list file/directory relative to .. from a symbolic link directory (No such file or directory)?
I have a /usr/tomcat6/logs directory linked to /var/log/tomcat6.
When I changed directory to /usr/tomcat6/logs and try to ls files using a relative pathname ../conf/Catalina/localhost, a No such file ...