Skip to main content
Unix & Linux

Questions tagged [cd-command]

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

Filter by
Sorted by
Tagged with
0 votes
2 answers
108 views

Error trying to set directory in shell script [duplicate]

I am trying to set the current directory in a shell script like this: cd /home/sshuser/xyz and get this response when I run it: $'/home/sshuser/xyz\r': No such file or directory* The cd command ...
14 votes
1 answer
3k views

Why does cd '' succeed in bash?

Maybe I'm missing it, but I don't find it documented that cd '' should succeed. Since there is no directory with the name '', it seems obvious that it should fail. For example, mydir= cd -- "$...
-2 votes
2 answers
294 views

Dangerous behavior of the `cd` built-in

I was plodding along, working on a shell script, and I've just learned something that I found surprising. I'm presenting it here as a Question because I'd like to learn if there's some way to avoid ...
6 votes
2 answers
1k views

Terminal autocomplete (tab) not completing when changing directory up one level (cd ../)

I'm a relative Linux noob: I've worked with the bash shell for quite a while via an Ubuntu install in WSL2 on a Windows 11 machine and recently took the plunge to switch over to Linux 100%. My ...
2 votes
2 answers
321 views

cd 'old' 'new' with multiple "whole directory-name" substitutions

To move from ~/aaa/foo/bbb to ~/aaa/bar/bbb, one can use cd foo bar and from ~/foobar/foo/www to ~/foobar/bar/www: cd "/foo/" "/bar/" But how is it possbile, using the same ...
jsx97's user avatar
  • 1,357
0 votes
1 answer
57 views

To 'cd' by altering only the middle part of the path

In Zsh, to cd from ~/foo/bar/aaa/bbb/ccc to ~/foo/bar/zzz/bbb/ccc, I can type cd aaa zzz, and that's it. I have carefully read the Fish cd man page, but I still cannot figure out: is the same thing ...
jsx97's user avatar
  • 1,357
1 vote
1 answer
133 views

Bash `cd -L` vs. `cd -P` vs. Bash Reference manual description

Premise I've read what's listed in Bibliography regarding cd, pwd, set -P. By default, or when the -L option is supplied, symbolic links in directory are resolved after cd processes an instance of ‘.....
0 votes
0 answers
155 views

How to show path after cd command with CDPATH set?

I came across this question and showing the current path after cd is exactly what I'm looking for. However, I can't manage to get this behavior. What I've tried is this: export CDPATH='.:/home/...
1 vote
1 answer
536 views

bash cd issue with path containing spaces: "too many arguments" [closed]

I created a path with spaces, and when I try to change directory I get "too many arguments" error message despite escaping the spaces or quoting the path : Here are the tests I made : # ...
1 vote
2 answers
642 views

How to change directory in shell script running in zsh shell

I am working on a shell script (shell used, its version and OS are below). The script runs commands in a local git repository/directory with has several tags. The script outputs some string from ...
YAZ84's user avatar
  • 13
5 votes
4 answers
2k views

How do I make WSL2's cd command accept windows paths?

I'm a WSL convert, coming from cygwin. One of the neat things cygwin does is accept unix and Windows file paths in the cd command. Of course, most Windows paths contain ,円 which is a special character ...
0 votes
2 answers
13k views

What is the difference between `cd ..`, `cd .`, and `cd ...`? What can they do respectively?

I'm a beginner to learn system program. I googled for the uses of cd .., cd ., and cd ..., but it turns out that what I only know is that cd .. means to move back one dir. I tried them in my terminal ...
0 votes
2 answers
1k views

how to get file path without the filename itself

im trying to find my .csv files then cd into their directory: find Documents/notes -type f -name "*.csv" | head -1 | xsel -b this copies the first file dir into my clipboard and i'd like to ...
Mathew's user avatar
  • 243
-3 votes
1 answer
308 views

cd command only working when I put the slash after the directory name

I am new to Linux and working through Dion's course for Linux+. I'm currently on Permissions and Sticky Bits, and have run into an issue I can't figure out. The assignment asks to create a directory ...
1 vote
0 answers
44 views

`cd` in script refuses to actually cd, shows no error [duplicate]

I'm running a script which, when accepting a specific argument, should change the running directory. However, despite showing no error at all (and the directory being accessible with regular cd), the ...
dkd6's user avatar
  • 87

15 30 50 per page
1
2 3 4 5
...
29

AltStyle によって変換されたページ (->オリジナル) /