Tagged Questions

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

learn more… | top users | synonyms

1
vote
1answer
224 views

Make a bootable CD without ISO file but from a CD

I have a Windows XP CD which I want to install on a USB Drive. However my own CD drive is broken. I have a friend's laptop on which Windows 7 is installed (and no idea if it has a CDROM of not). ...
4
votes
0answers
590 views

Gnome-terminal and Zsh: keep current directory on new tab/window

I'm running gnome 3.10.1 on Arch with Zsh. I'm facing that problem that when I create a new tab or window from a terminal window, it resets the current dir to my home dir. I've already tried this: ...
0
votes
2answers
213 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. ...
6
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
513 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 ...
2
votes
3answers
204 views

Simplified navigation in terminal

I know IDEs are the wave of the future, but I always find myself coding in vim in a Linux terminal. Old dog. New tricks. Anyway, navigation becomes challenging when dealing with long package names. ...
7
votes
2answers
2k 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
111 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 ...
1
vote
1answer
471 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 ...
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?
3
votes
3answers
115 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
76 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
65 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 ...
3
votes
3answers
248 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?
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 ...
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 ...
5
votes
3answers
310 views

cd to directory of a symbolically linked file

Before I write a script, anyone know an easy way to do the following: $ pwd /foo/bar $ ls -l lrwxr-xr-x 1 username admin 48 Apr 17 2012 foo.sh -> /bar/foo.sh $ cd /bar $ ls foo.sh i.e., in ...
1
vote
2answers
160 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 ...
29
votes
2answers
20k 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 ...
6
votes
4answers
666 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
118 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
111 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
78 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, ...
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
223 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
120 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. ...
4
votes
1answer
218 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 ...
1
vote
1answer
261 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 ...
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
163 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
302 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
304 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 ...
2
votes
2answers
84 views

`cd` all screens to the PWD of the current screen

Suppose that I am running screen on a remote server with four open screens. Is there a quick way to cd all the screens to the working directory of the currently-open screen?
1
vote
4answers
188 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
127 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
885 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
9k 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 ...
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 ...
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. ...
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) ...
4
votes
4answers
250 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
503 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 ...
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 ...