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

learn more… | top users | synonyms

1
vote
3answers
90 views

How to enter foo-* folder without actually using wildcard or shell expansions?

Short story I'm looking for the command to enter first found foo-something directory like: cd foo-* but without using wildcard (or other special shell characters). Long story As part of the ...
5
votes
2answers
682 views

Why doesn't 'sudo bash && cd desktop' cd in to the desktop folder? [duplicate]

I have a folder with chmod 000 permissions on it with a lot of different stuff in, the way I get in is a start bash in sudo by running sudo bash. Why can't I do &&? I want to cd into the ...
1
vote
1answer
36 views

cd to a child directory of a symlink fails

To build a kernel module, you have to do make -C where -C is cd functionality. As my make failed a lot of times, I found this: [root@ror6ax2 modules]# ls -l /lib/modules/`uname -r` | grep build ...
1
vote
2answers
28 views

Listing folder contents during cd command

I might be mistaken here, but I was watching someone navigate using the cd command, and without actually executing it, they were able to show the folder contents of the current folder. So if I type ...
6
votes
1answer
127 views

cd and ls behave differently when inside a softlink to a dir

When we cd into a dir via its softlink, i observe: ls .. will show the content of the parent dir of the linked dir, while cd .. will go under the parent dir of the softlink. Why are they different? ...
15
votes
4answers
1k views

Do we have more history for cd?

cd - can move to the last visited directory. Can we visit more history other than the last one?
3
votes
5answers
85 views

How can I cd from parent1/suba/subb to parent2/suba/subb without listing subdirectories?

I have multiple parent directories with the same file structure beneath them. Example: parent1/suba/subb/ parent2/suba/subb/ When I am in parent1/suba/subb, I would like to change to ...
3
votes
2answers
51 views

Creating an alias to Change Directory and have that directory be the current working directory in new terminal tabs

I'm trying to create a convenience alias that will change directories and then start a node server in that directory. I have it working for the most part, there's just one little issue that I can't ...
3
votes
2answers
55 views

Go up one level from a nonexistent path

I have some code like this in a script (bash) file: if [ ! -d $dir ]; then cd $dir/.. git clone http://... fi Of course as written this doesn't work since $dir does not exist. Is there a ...
1
vote
3answers
514 views

“Can't cd to /home/user” when sourcing a script

I have this script: echo $HOME cd $HOME cd / cd /usr/local/src/ When I run it like this . script.sh I get this output: /home/user : No such file or directory : No such file or directory : No ...
1
vote
2answers
180 views

Why current directory doesn't change in makefile?

I'm trying to run a simple script- clone a git repository into a certain directory, then cd to this directory in order to execute an installation script. This script is in a Makefile. But the cd ...
0
votes
2answers
87 views

Shell script to work on files in some directory

I am a noob in Linux hence this might come as a silly question. I have a Windows system, so I downloaded cygwin to help me execute Linux/unix commands. I need to execute a shell script on a bunch of ...
33
votes
7answers
3k views

Is `-` used only with cd?

cd - can switch between current dir and previous dir. It seems that I have seen - used as arguments to other commands before, though I don't remember if - means the same as with cd. I found that - ...
8
votes
3answers
240 views

Going into a directory linked by a link

When I cd a link, my current path is prefixed with the link's path, rather than the path of the directory the link links to. E.g. ~/dirlinks/maths$ ls -l logic lrwxrwxrwx 1 tim tim 71 Jul 27 10:24 ...
2
votes
4answers
4k views

How do I dual-boot Kali Linux With ISO (no CD/USB/DVD)

I am trying to install Kali Linux 1.0.7 to my Windows 8.1 32-bit PC. I have the ISO, but I have no CD's, USB Sticks, or DVD in my home so I was wondering how can I install Kali Linux without ...
5
votes
4answers
679 views

chdir(<directory>) doesn't change directory after exiting to shell

I wanted to make a simple C program to change to my project directory. Its content is following: #include <unistd.h> int main(){ chdir("/home/enedil/projects/algo"); return 0; } I ...
2
votes
2answers
37 views

How can I quickly return back to the last working directory? [duplicate]

All too often I find myself cycling between two directories to perform different tasks. The directories don't always have an easy-to-use relative path between them. As a result it is quite cumbersome ...
0
votes
0answers
41 views

How to differentiate USB flash drive and CD-ROM?

I want to differentiate an USB flash drive and a CD-ROM. My requirement is when I connect to a system only the CD-ROM should work, but not the USB key.
2
votes
2answers
117 views

Change directory based on a pipeline's output

I want to go to a directory with using filter For example there is a file named this-is-awsome ls | grep this-is-awsome | xargs cd How can I go to a directory with filter?
3
votes
3answers
201 views

Return to directory location prior to cd-ing to home directory

As is well known, cd without an argument changes one's current directory to their home directory. I am wondering if there is any way, after using the cd command like this, to return to the directory ...
3
votes
2answers
182 views

Command for creating a directory and navigating into it directly? [duplicate]

Quite often I need to perform this two commands: mkdir abc cd abc I am curious whether there is a simple command (or an alias that I can create and use) to do it in one go, like user@GROUP:~$ mdcd ...
2
votes
2answers
212 views

Tmux config not retaining PWD on new-window or window split

So I'm trying to update my .tmux.conf file to reflect the change for -c in new-window. I've added this to my conf and it's not working unfortunately. My new windows and panes always start in ~/: # ...
40
votes
7answers
3k views

cd .. on root folder

Why cd .., typed at root folder, does not warn or fails with an error? I would expect: /$ cd .. -bash: cd: ..: No such file or directory Instead, I'm left at /. Of course, this is since .. does ...
7
votes
4answers
869 views

Combined `mkdir` and `cd`? [duplicate]

is there any way (what is the easiest way in bash) to combine the following: mkdir foo cd foo The manpage for mkdir does not describe anything like that, maybe there is a fancy version of mkdir? I ...
2
votes
1answer
502 views

Are All The Packages Included On The Debian DVD/CD Images Or Just The Most Popular?

My understanding is that Debian and all the software available in the matching online repo (eg: https://packages.debian.org/stable/allpackages) are released together on a series of disc images ...
16
votes
6answers
2k views

Why do I have to cd out of a deleted directory?

On my server I have a directory structure looking something like this: /myproject/code I normally have an ssh connection to the server and 'stand' in that directory: root@machine:/myproject/code# ...
3
votes
0answers
66 views

Call vared and complete files from a different directory

I have the following zsh function which lets me edit symbolic links using the vared ZLE builtin. function lned { emulate zsh setopt err_return extended_glob local_options local_traps local -a ...
0
votes
1answer
28 views

Beginner's question: Accessing network location on domain

I'm new to Linux so this might seem a little naive! So, my computer is connected to a university network, in the computer science department. This domain is called "cs". However, "cs" is a subdomain ...
20
votes
6answers
3k views

where is `cd` located? [duplicate]

In a bash sub shell I get the following error when running cd sudo: cd: command not found This is expected because I don't have a path. Usually to work around this I just provide the full path like ...
0
votes
1answer
205 views

Why does Debian include “cdrom” in sources.list?

Here's my sources.list # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 CD Binary-1 20130$ # deb cdrom:[Debian GNU/Linux 7.0.0 _Wheezy_ - Official amd64 CD Binary-1 20130$ deb ...
6
votes
3answers
1k views

is it possibe to change parent shell's working directory programmatically?

I want to write some code to allow me switching to some directories that I usually go to. Say this program is mycd, and /a/very/long/path/name is the directory that I want to go to. So I can simply ...
1
vote
2answers
544 views

cd ${DIR_PATH} returns 'No such file or directory'

OS = MacOS 10.8.5/Darwin Kernel Version 12.5.0. In my .bash_profile I have: export DIR_PATH=~/concrete/path At the terminal >echo ${DIR_PATH} ~/concrete/path Also explicit cd works: ...
2
votes
4answers
129 views

cd two levels down from root

I'm a web developer (Drupal mainly). When I develop websites I do so within a /workspace folder. So I have folders like this. /workspace/project/ /workspace/project/sites/default/files/ ...
2
votes
2answers
99 views

Commands to read and eject CD?

My laptop is a Thinkpad T400 and the OS is Ubuntu 12.04. I find I have a problem where the CD-RW on my laptop sometimes doesn't read the CD, following some flashing light and sound, after I inserted ...
0
votes
2answers
344 views

Is CDPATH behavior broken in bourne shell (/bin/sh)

I have the following script: #!/bin/sh mkdir -p /tmp/test/foo cd /tmp/test unset CDPATH echo "TEST1: Current working directory: ${PWD}" echo "TEST1: attempting to 'cd foo'" cd foo echo "TEST1: ...
20
votes
4answers
2k views

Automatically detect when I typed “vi” but meant “cd”?

Title says it all. About 5 times a day, I type "vi" when I meant "cd", and end up opening a directory in vi. It's making me NUTS. It seems like there should be a way to detect when I type in "vi + ...
12
votes
6answers
897 views

Why does “ls” require a separate process for executing?

Why does ls require a separate process for its execution? I know the reason why commands like cd can't be executed by forking mechanism but is there any harm if ls is executed without forking?
2
votes
1answer
89 views

Is it bad when dvdisaster says that some sectors of a dvd disc are unreadable?

I wanted to check if an image was successfully written to a DVD, so I checked the checksums: $ sha256sum debian-7.3.0-amd64-DVD-1.iso ...
3
votes
1answer
136 views

How to cd into a directory with the name “-”? [duplicate]

I tried to cd into a directory named - that I created for experimenting. I could not from Bash. How do I cd into it? With Nautilus on Ubuntu 13.10 I could easily do this, and even create files inside ...
4
votes
1answer
395 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
295 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
336 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
99 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
451 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 ...
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. ...
1
vote
1answer
219 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
564 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
202 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. ...