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

learn more… | top users | synonyms

4
votes
1answer
389 views

Which 2-letter POSIX command is different from all the others?

I was interviewed for an internship and I got the same question as this one: http://www.glassdoor.com/Interview/Which-2-letter-POSIX-command-is-different-from-all-the-others-QTN_498236.htm The ...
0
votes
1answer
294 views

Can't access the directory /etc/ppp/peers?

I want to read some configuration file. The problem is that I can't move in the folder peers and typing the command ls -l, I see this permission's record: drwxr-s--- root dip ... I never seen that ...
2
votes
2answers
332 views

How do I navigate to a CD drive?

I'm trying to install Virtualbox Guest Additions in Elementary OS. cd doesn't seem to work with cd VBOXADDITIONS_4.2.6_82870. Update: I did what @ivica recommended, and here's what I'm getting: I ...
0
votes
1answer
51 views

Test what cd has done ksh

I'm facing a small issue here. I'm doing : cd $(find . -type d | grep "${4:0:4}.*${4:4:2}.*${4:6:2}") $4 is a data entered from the user. However, if the user doesn't respect the format to enter, ...
4
votes
1answer
136 views

`cd` up the canonical path

Consider: $ pwd /home/user $ ls -l total 3604 lrwxrwxrwx 1 user user 19 Nov 27 12:11 pages -> /var/www/pages/ $ cd pages $ pwd /home/user/pages $ readlink -f . /var/www/pages $ cd .. $ readlink ...
3
votes
1answer
98 views

script to remember dir and always cd to it instead of the root dir

How can write a script to change to a given directory but also remember it so that when you do cd it always changes to that directory ? #!/bin/bash setdir() { cd $1 # remember the directory ...
1
vote
1answer
441 views

Changing the current directory using a script (ksh)

I'm launching my script from echo $PWD ---> /x. I want my script to change my current directory. So my script contains +- this : cd /y exit 0 However, when my script ends, I'm stils in echo $PWD ...
6
votes
2answers
216 views

Output of which command used for input to cd

I would like to take the output of a which command, and cd to the parent directory. For example, say I have the following: which someprogram With output: /home/me/somedirectory/someprogram And I ...
3
votes
1answer
62 views

How to cd open / autocomplete a folder that ends in a specific phrase

I have a folder with subfolders named like this: 1122334 important things 1122335 less important things 1122336 notes 1122337 pictures of kittens etc The numbers at the beginning are date codes. ...
0
votes
2answers
200 views

Full Linux distro under 50 MB for a business card CD

I need a full Linux distribution for a non-profit activist organisation that can fit on a business card CD. If that's not possible, there is a business card DVD option too with up to 400 MB capacity. ...
9
votes
2answers
785 views

Change directory without typing cd?

Is it possible to make bash change directory in command line simply by typing that directory without any commands like cd? For example is it possible instead of writing this: $ cd /tmp I just want ...
4
votes
1answer
1k views

gnome-terminal: keep track of directory in new tab

I'm on Arch linux, and when I open a new terminal tab, it always goes to $HOME. How can I make it so that when I open a new tab, it opens the shell in the directory I was in previously?
3
votes
3answers
461 views

How to create a short path?

We have so many useful folders, which are in different path, for our working in Linux. For example : $ cd ~/Documents/Courses/EDX/physics2013/ $ cd ~/Documents/Company/OpenGL/Proj/... $ cd ...
0
votes
0answers
40 views

Write a zsh method the responds to a `cd` command [duplicate]

I'm trying to write a script that will be called when navigating into certain directories. What I'd want is to have a message appear when I enter certain (not every) directories based on what it finds ...
4
votes
1answer
401 views

Building an offline installer Debian CD

I have to build an install CD to help others people to setup a Debian server with Apache/Mysql/PHP and our application. But the CD must install the full system offline (because servers will be ...
7
votes
2answers
1k views

What does “cd &” mean?

I know how to change directory from terminal by typing cd <directory> but here's the scenario. I was using terminal to go on my git repository's folder. glennRepositories ...
3
votes
2answers
105 views

Can I run a command after the user uses Ctrl-C to kill a command?

So at my position we use a shared set of aliases to do builds. Something like... alias 'build'='cd $BUILD_ROOT; m; cp ...; cp...; deploy; deploy; deploy; cd -' This is super irritating because the ...
44
votes
6answers
3k views

Is there a way to cd back multiple times in bash?

I often use cd - to go back to where I was. How can I do this multiple times in bash? Or would zsh or some other tool support this?
1
vote
1answer
427 views

Difference between 'cd' and 'cd ~'

I am wondering, if cd alone sends me to my home folder and cd ~ does the same, why was the ~ added in the first place then? Is it something specific to BASH or would they behave differently in ...
3
votes
3answers
112 views

cp SOMEFILE .. copies to a different directory after cd'ing via a symbolic link

Consider the following setup: ~/Desktop/Public/subdir ~/Desktop/subdir --> ~/Desktop/Public/subdir (symbolic link) Now I do: cd ~/Desktop/subdir Which leads me into the linked directory. If ...
0
votes
1answer
72 views

How do I change working directories with KDialog?

Use-case: I am working in the terminal in /path/with/a/very/long/name and I want to change to some other directory that is deeply nested. But I don't know the path by memory. So I want to browse via a ...
1
vote
3answers
62 views

Rename directory from within directory?

How would I rename a directory from within that directory? For example: ~/tmp $ rn tmp2 ~/tmp2 $ I can do that with: cd .. && mv tmp tmp2 && cd tmp2, but not sure how to make it ...
27
votes
2answers
17k views

How do I use pushd and popd commands?

What are the practical uses of both pushd and popd when there is an advantage of using these two commands over cd and cd -? EDIT: I'm looking for some practical examples of uses for both of these ...
3
votes
3answers
228 views

Quick access to work directory of background job

Minimal effort to reproduce what I am looking for, is as follows /$ sleep 1h & [1] 6564 /$ cd ~$ jobs [1]+ Running sleep 1h & (wd: /) When I use jobs to manage my ...
1
vote
1answer
60 views

How to autocd in tcsh?

I want to change directory without using cd, I want to access the directory by its name $home/user/tools $cd tools //works fine $tools //permission denied I tried set autocd but still the same?
7
votes
4answers
3k 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 ...
26
votes
4answers
2k views

How to go to the previous working directory in terminal?

In terminal, how can I define a key to go to the previous directory which I was in when changing directory with the cd command? For example, I'm in /opt/soft/bin and I cd into /etc/squid3 and I want ...
5
votes
2answers
185 views

How does bash continue to work correctly when you move its working directory?

On Linux, I moved a directory to another directory using mv, and in another shell, my working directory happened to be the directory that was moved. I ran hg pull in that shell, and to my surprise, ...
16
votes
4answers
4k views

Why does `cd` command not work via SSH?

I was trying to backup some files via SSH but instead of tar'ing the ones I wanted I got my home folder. I did some further testing and it boils down to this: ssh root@server /bin/sh -c "cd /boot ...
5
votes
2answers
2k views

How can I cd into a directory as root?

Let's say there's a directory that I don't have the privileges to access. Obviously sudo cd foo won't work, because cd is a shell builtin in every shell ever. So far, I've just been using sudo bash ...
3
votes
2answers
120 views

How can I create a “base” for other aliases to refer to and enable cd base/x command directories?

I have .bash_aliases with: alias c1='cd /home/me/code/php' alias c2='cd /home/me/code/jquery' alias c3='cd /home/me/code/ruby' alias c4='cd /home/me/code/c' How can I DRY this up and loosen the ...
1
vote
2answers
149 views

Launcher for a Python program that requires extra libraries

I'm trying to get a launcher working for the WikidPad (python) program. I already have a python program, so I looked into the file /usr/share/applications/taskcoach.desktop. The exec line was simply ...
6
votes
4answers
645 views

How to make `cd dir/filename` take me to dir/?

I would find it very convenient to be able to use cd with a file argument. cd myDirectory/anyname.anyExtension would be equivalent to cd myDirectory/ What would be the best alias or function to ...
2
votes
1answer
117 views

Why does cd default to ~?

When you type cd, it basically does the same thing as cd ~. Why? I'm wondering if it's just a hard-coded behavior or if bash is expanding the command or something.
2
votes
1answer
108 views

cd and ls in the same call [duplicate]

I often have to cd to a directory and ls to see the directory listing. Can it be done with one shot, so that I can add to .bashrc as alias. I searched on Google, there were some answers, but ...
1
vote
1answer
77 views

Directory stack order in zsh

I am working on Zsh 5.0.2 (latest stable version), and I noticed that: dirs -v and cd -<TAB> show a different list of directories (or at least directories in different order). Moreover, ...
14
votes
6answers
10k views

Execute a specific command in a given directory without cd'ing to it?

Is there a way to execute a command in a different directory without having to cd to it? I know that I could simply cd in and cd out, but I'm just interested in the possibilities of forgoing the extra ...
5
votes
2answers
2k views

How do I escape a sub-directory name with an ampersand in it?

Running a kornshell and trying to traverse a directory tree. Want to cd to a sub-directory named as follows: -3ab_&_-3dc.img My question is HOW do I need to escape the ampersand in this name? ...
1
vote
0answers
212 views

not able to mount burned ISO9660 file-system before ejecting and re-inserting the media

After burning an ISO9660 file-system(wodim -v dev='/dev/scd0' -sao ubcd521.iso) to a CD, I always need to first eject the CD and then re-inserted it in order to be able to mount the created CD: ...
2
votes
1answer
118 views

An -e option to cd builtin

According to Bash reference on Bash builtins: cd [-L|[-P [-e]]] [directory] The -P option means to not follow symbolic links; symbolic links are followed by default or with the -L option. ...
1
vote
3answers
5k views

How to change the working directory for a shell script

I have a Python script that looks files up in a relative directory. For example: the Python script is in /home/username/projectname/. I have a file that is being called within the Python script that ...
4
votes
1answer
207 views

How do I cd up and down again with symlinks in bash?

Structure: /base/ +- somedir/ +- symlink/ -> /some_other_dir This command (in addition to my Makefiles) fails: cd /base/symlink ls ../somedir Bash complains that ../somedir does not ...
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
252 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 ...
77
votes
6answers
6k 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
1k 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
161 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
291 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
294 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 ...