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

learn more… | top users | synonyms

1
vote
0answers
40 views

Working of cd command issues [on hold]

When I do cd ~/Desktop, it takes me to the Desktop. Then doing ls -a shows the hidden files . and ... Then doing cd . takes me to Desktop, but doing ls -a does not show directories . and ... Even if ...
1
vote
2answers
133 views

How to change dir to the last directory?

I have very long directories list, like /dir/dir/dir/../../../../../../../../../.. ../../ ../../last dir Is it possible to change to the last dir immediately?
0
votes
1answer
19 views

executing commands in shell and turnoff the default displays of commands in console

This is my script cd /opt/product/vinoth -- some operations -- cd - While executing this command cd - the old path get displayed in the console. is there is any way to block this from displaying ...
1
vote
2answers
131 views

Can I hook into the cd command?

I'm trying to set something up on a server I run, when ever I cd into a public_html folder 95% of the time there's a few commands I will always run to check certain things. Is there anyway I can hook ...
2
votes
4answers
7k 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 ...
10
votes
4answers
5k 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 ...
5
votes
3answers
57 views

Is there an easy way to change directories from within one duplicate folder structure to another?

On our server, we have several duplicate-ish folder structures for testing, staging, and production. Other than minor changes, the folder structure between all three are generally the same. When I'm ...
0
votes
1answer
44 views

How can I write an alias for cd such that it will fire ls after going into the directory to which I just cd'ed into? [duplicate]

Lets say I want to do cd home and then ls -lrth. I want these two things combined into a single command. I tried writing an alias, but it didnt work. Can you help me ?
2
votes
2answers
46 views

ls doesn't give me the same as cd + ls to the same folder

$> ls ../../../../.. Doesn't give me the same result as $> cd ../../../../.. $> ls Why? Something with links? What's going on? [ johanrj@jamin ] ...
62
votes
25answers
10k 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 ...
16
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?
1
vote
3answers
98 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
785 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 ...
34
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 - ...
1
vote
1answer
51 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
34 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
138 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? ...
2
votes
2answers
130 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 ...
3
votes
5answers
93 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 ...
4
votes
2answers
2k views

changing current working dir with a script

I've read this question and answer, but it doesn't quit fit my problem, even tho it's similar. I'm writing a script (called cpj) that will launch one of my current projects. I have about 5 of them. ...
3
votes
2answers
76 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 ...
44
votes
5answers
2k views

cd by just 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 ...
1
vote
3answers
1k 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 ...
3
votes
2answers
61 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 ...
5
votes
3answers
330 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
597 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
115 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 ...
9
votes
1answer
684 views

How do I redirect output to cd?

Is it possible to redirect a command's output to cd? For example, I searched for a directory using locate and got the path to it. Now, instead of writing a cd path, can I redirect the locate output to ...
8
votes
3answers
249 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 ...
9
votes
5answers
4k 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 ...
5
votes
4answers
990 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 ...
4
votes
0answers
606 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: ...
2
votes
2answers
40 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 ...
2
votes
2answers
129 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?
0
votes
0answers
47 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.
3
votes
3answers
215 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
189 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 ...
12
votes
6answers
1k 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
2answers
329 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 ...
17
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# ...
7
votes
4answers
1k 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 ...
8
votes
3answers
1k 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
1answer
694 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 ...
2
votes
3answers
209 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. ...
3
votes
0answers
77 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 ...
20
votes
6answers
4k 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
40 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 ...
0
votes
1answer
268 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
2k 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 ...