Cd is a command-line utility to change the working directory.
6
votes
4answers
269 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
90 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
87 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
38 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, ...
2
votes
2answers
81 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?
...
0
votes
0answers
96 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
67 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
81 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
95 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
258 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
96 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
113 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
165 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
56 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
62 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? Thanks.
1
vote
4answers
105 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 ...
2
votes
1answer
438 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
100 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 ...
17
votes
3answers
793 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. ...
4
votes
2answers
198 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
694 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 ...
17
votes
2answers
506 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
59 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.
...
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)
...
4
votes
4answers
180 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 ...
4
votes
1answer
201 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
224 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 ...
3
votes
2answers
333 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 ...
2
votes
5answers
953 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 ...
5
votes
2answers
236 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
3answers
559 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 ...
7
votes
2answers
353 views
How can I cd to the previous/next sibling directory?
I often have a project directory layout like this
project
`-- component-a
| `-- files...
`-- component-b
| `-- files...
`-- component-c
`-- files...
I'll usually be working in one of the ...
2
votes
2answers
84 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
1answer
91 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 ...
5
votes
3answers
534 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 ...
11
votes
4answers
3k 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 ...
57
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?
3
votes
2answers
650 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 ...
29
votes
3answers
896 views
How can I cd to a directory just by typing the directory's name?
I either had this somewhere 20 years ago or I dreamed about it.
Basically:
If if type blobblob I get
blobblob: command not found
Fair enough.
I would like it so that when my shell gets those ...
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 ...
3
votes
3answers
987 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 ...
1
vote
1answer
225 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 ...
7
votes
3answers
2k 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 ...
3
votes
2answers
203 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 ...
6
votes
3answers
2k views
How can I open a new terminal in the same directory of the last used one from a window manager keybind?
I'm using a tiling window manager and I switched from gnome-terminal with multiple tabs to multiple urxvt instances managed by the window manager. One of the features I miss is the ability to open a ...
3
votes
2answers
338 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 ...
49
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 ...
0
votes
2answers
65 views
3
votes
1answer
232 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 ...
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?
