Cd is a command-line utility to change the working directory.

learn more… | top users | synonyms

2
votes
5answers
3k 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 ...
1
vote
1answer
269 views

Rip audio CDs while keeping extraction and encoding separate

I'd like to rip my audio CDs to mp3. I know this has been discussed to a good extent but I'm not sure if my setup makes sense, though. I want to use an older PC for that and I have read on the net ...
79
votes
6answers
7k 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?
3
votes
2answers
2k views

How to make cd arguments case INsensitive?

Sometimes while accessing the various directories it happens most of the times that I remember the names or at least part of the names of a directory under our Linux system. But some of the ...
2
votes
2answers
164 views

Does a parent bash script remember the cd history from a child bash script?

Example: mainscript.sh cd /mnt/something ./buildscripts/000-script.sh 000-script.sh cd /mnt/otherthing mkdir something exit
1
vote
1answer
312 views

Move files to mapped network folder

I was wanting to know the best or preferred way to move files from one computer to a networked hot folder. I have looked at mv and cd but all the references discuss using it locally. I would need to ...
1
vote
3answers
313 views

I want to run commands like make, make install, python setup install without changing directories

I have written a script which will download software from the internet to the current user's home directory and then untar it. And then I have to make and make install it and in some software I have ...
1
vote
2answers
85 views

Create a link but don't change the canonical path

In each users' directory there exists a symbolic link to /var/www/website/public_html/. However, whenever a user cds into the link, he sees the path as /home/username/public_html/. Is there any way to ...
1
vote
4answers
192 views

Zsh: dirs in reverse order

I am a bit confused about how dirs works. The documentation says: dirs With no arguments, print the contents of the directory stack. Directories are added to this stack with the pushd ...
15
votes
1answer
5k 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 ...
1
vote
1answer
131 views

How can I have cd show the directory it switches into?

I have made my command prompt ($PS1) to be just username.../current_directory (using the 3 dots because my directory structure has lots of levels and they were taking up too much of the command line ...
20
votes
3answers
2k views

How do you enter a directory that's name is only a minus?

I downloaded lessn to my webserver and unzipped it. It contains a folder named -. I assumed I know how to deal with that, but I don't. I tried cd -- -, but that doesn't have the desired effect. ...
5
votes
2answers
936 views

How to go back n levels of directories from the command line?

For example, I do the following cds in succession- cd /tmp cd /home/admin cd /root/ cd /some_other/directory Now I am in /some_other/directory. Now, is there anyway to go back to /tmp, the ...
0
votes
2answers
10k views

How to change the working directory of invoking shell using a script? [duplicate]

Possible Duplicate: changing current working dir with a script I am trying to create few scripts that would change the working directory of the main shell/terminal. Not able to do so. I ...
24
votes
6answers
2k 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) ...
2
votes
1answer
83 views

cd ~ works in one terminal session but not another (no error reported)

I have two PuTTy sessions open to the same host. One one cd ~ gets me back to my home dir fine and on another one it doesn't -- stays in the same dir. I have never seen something like this happen. ...
33
votes
2answers
1k 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 ...
4
votes
4answers
252 views

Follow a moved file to its destination directory

Is there a way to move a file from a directory to another and then cd into the latter in one command? Something like mv /a/file /another/dir && cd _ but without typing second time the ...
5
votes
1answer
522 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
190 views

How do i run a process in a specific directory?

In an init.d file i wrote the below. Now i need to make the bin run in a specific directory. How do i tell it which directory to use? mono --debug /path/bin &
1
vote
2answers
2k views

Create and move to a directory in one command - unix [duplicate]

Possible Duplicate: Is there a one-liner that allows me to create a directory and move into it at the same time? I know this is a very basic question but I can't seem to figure out what to ...
5
votes
2answers
1k views

Behavior of stdin/stdout in conjunction with subshells and cd command

I have the following series of commands: cd / && ls | ( cd /tmp && cat >dumpfile) This series of commands does the following: it creates a file named /tmp/dumpfile. This file ...
11
votes
4answers
11k 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?
6
votes
2answers
590 views

Run a script automatically as I switch to a directory [duplicate]

Possible Duplicate: Execute bash scripts on entering a directory I am running an environment which requires some very specific tool versions. The commands to set up the environment are in a ...
1
vote
1answer
252 views

How can I add an alias for my pwd to an existing file?

I want to add another alias to my "aliases" file for the directory I'm currently in (Present Working Directory) I've tried printf "alias aaa=cd " + pwd >> myfile It's close, but I end up ...
33
votes
4answers
27k views

What is the 'working directory' when cron executes a job

I have a script that works when I run it from the command line, but when I schedule it with cron I get errors that it cannot find files or commands. My questions is twofold: When I schedule a cron ...
3
votes
3answers
3k views

Cannot execute command at GNU screen startup

I want to do something similar to what's written here without using zsh (I use bash), but if I try to start screen with screen 'cd /home/cataldo/Programs' I get the following error: Cannot exec ...
4
votes
2answers
2k views

How do I create a ZIP archive that preserves only the structure of the target directory and below?

I need to create a zip archive where the unzipped result preserves the directory structure from the specified directory down. I also need to do this without actually switching to the directory. My ...
1
vote
1answer
818 views

How to link a folder to create a shortcut

I have this folder: /var/www/vhosts/foo that I need to access often. If I do (I'm root): ln -s /var/www/vhosts/foo/ cd foo pwd tells me /root/foo What can I do to really go into the folder ...
8
votes
3answers
9k views

~ is $HOME, but sometimes?

This is kind of a trivial and dumb question. cd ~ does the same thing as cd $HOME which is also the same as cd /home/tandu However, cd ~not-tandu changes to /home/not-tandu Is this ...
4
votes
2answers
437 views

Force change of a user's cwd as root

I'm looking to change a user's process such that I can set it's cwd. Related, and secondary to the question, I have a filesystem I want to unmount but a user is sitting on it with a bash process. I ...
19
votes
2answers
3k views

What is the bash shortcut to change to the previous directory?

Sadly, I only learned about this last year by stumbling upon it randomly on the internet. I use it so infrequently that I always forget what it is by the time I need it again. How do you change to ...
4
votes
2answers
713 views

Conflict between `pushd .` and `cd -`

I am a happy user of the cd - command to go to the previous directory. At the same time I like pushd . and popd. However, when I want to remember the current working directory by means of pushd ., I ...
5
votes
1answer
794 views

Can't get directory listing of folder I have permissions to

I was having some permission problems and used the following command on directory Media: chmod -R ugo+r Media It didn't help so then I did: chmod -R 775 Media Now I get this error when I try to ...
3
votes
5answers
1k views

Directory is not opening with cd command

I have a directory in Desktop named Project. I tried opening it using the cd command but it is not opening. What's the reason? Check the screenshot. The directory has all the required permissions. I ...
7
votes
1answer
592 views

Show message when cd into specific directory

How can I display a message when I cd into a specific directory? This directory is a local one, and I just need a reminder when I go into it from the terminal.
0
votes
2answers
77 views

Creating an Ubuntu Live CD through SUSE Linux

How can I create a live Ubuntu 11.10 CD on SUSE?
4
votes
1answer
216 views

Any cd shortcut to switch an intermediate directory in current path?

if I have current path as a long one..and I want to switch to a directory with just one word from path replaced by something else..like say when using maven , I want to switch from main path to test ...
6
votes
2answers
464 views

Why `.` is displayed by `ls`?

After reading the question When you type “ls -a”, what is the significance of “.” and “..”?, I have a similar one. Why to display .? I mean, is there any directory where cd . would not work? How is ...
20
votes
1answer
3k 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.
3
votes
1answer
456 views

bash: cd to the most recently modified child directory

Wondering if there's an easy and/or portable way to say "change to the most recently modified child directory." I can use ls and awk but there's probably a better way. cd $( ls -ltrd */ | tail -1 | ...
2
votes
1answer
2k 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 ...
3
votes
1answer
2k views

What is the best touch screen kiosk solution?

I'm a web developer and I'm looking for the best stripped-down linux experience that provides a full-screen experience for touch screens. I'll be looking for: a robust experience that stops people ...
14
votes
3answers
2k 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.