Questions tagged [cd-command]

cd is a shell built-in to change the working directory.

Change the working directory.

External reference

cd specification (The Open Group Base Specifications Issue 7, 2018 edition)

419 questions
102
votes
10 answers

Does cd . have use?

One of the tutorials I've been following briefly stated that cd . has no use. When trying to replicate issue shown by OP in Symbolic link recursion - what makes it “reset”?, I also tried cd ., which showed the same effect OP described (growing $PWD…
6
votes
2 answers

How does cd .. know which directory is ..?

Drectories contain . and .. which are hard links to the current and parent directory. So how does the shell know for example in the prompt, that the current directory is called "a" in cd a/path/..? Does it have special casing for this? Otherwise…
James
  • 61
2
votes
1 answer

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. Any idea why this might be happening? OS: SunOS…
amphibient
  • 12,472
  • 18
  • 64
  • 88
2
votes
2 answers

why cd function in script doesn't work

I wrote a script for the purpose of changing directory and then scan a file. #!/bin/bash model_dir=/mypath function chdir () { cd $1 } chdir ${model_dir}/config if [[ ! -s *.cfg ]] then echo `date` "configure file does not exist" exit 1 fi I…
huayong.zhou
  • 31
  • 1
  • 3
1
vote
2 answers

What happens when I try to change to a parent directory after it has been renamed?

I'm several child directories deep and I enter cd .. and receive this error: cd: ..: No such file or directory I am confused- of course there is a parent directory, I'm in it! A little digging shows that my coworker renamed a grandparent directory…
MackM
  • 115
0
votes
5 answers

Change directory using ls | tail -1

I want to go in the directory on the basis of highest directory number. Path: /home/cg/root/2018/01. Inside this path I have multiple directories as below 15 16 17 So on.. In this case highest directory is 17 so I want to move in 17…
Satya
  • 13
0
votes
1 answer

Unable to move to an existing directory

Put simply, I have a file on my desktop that I'm attempting to access using cd /file name and I'm returned with: No such file or directory. I resorted to copying and pasting the directory (being mindful of current directory) I get as far as /home…
0
votes
1 answer

How to change directory to desktop on german ubuntu?

I fail to change to the desktop via command line. I tried it like this. cd ~/Desktop But then I get "File or Path not found"
Black
  • 2,079
0
votes
2 answers

Where does cd command is configured to cd $HOME when no path is specified?

The following commands does the same thing $ cd $ cd $HOME $ cd ~ $ cd /home/user In three of them, the path is relatively specified. But how or why in the earth the simple cd opens the user's home dir?
tachomi
  • 7,592
-1
votes
1 answer

Cannot Access Folder

I downloaded this folder using wget https://github.com/duxingkei33/orangepi_PC_gpio_pyH3 when I ls I can see the folder orangepi_PC_gpio_pyH3 however when I cd orangepi_PC_gpio_pyH3 I get error: -bash: cd: orangepi_PC_gpio_pyH3: Not a directory