Skip to main content

Questions tagged [cd-command]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
59 views

What do I want : On the file manager lf, we can bind some keyboard shortcuts to do either a lf command with :, or a shell command with $, !, or other symbols. According to the documentation, there is ...
ewen-goisot's user avatar
0 votes
2 answers
121 views

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 ...
geezer's user avatar
  • 1
14 votes
1 answer
3k views

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 -- "$...
jrw32982's user avatar
  • 1,099
-2 votes
2 answers
313 views

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 ...
Seamus's user avatar
  • 3,906
6 votes
2 answers
1k views

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 ...
Gharbad The Weak's user avatar
2 votes
2 answers
326 views

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,387
0 votes
1 answer
60 views

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,387
1 vote
1 answer
151 views

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 ‘.....
the_eraser's user avatar
0 votes
0 answers
168 views

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/...
Alexander Zeitler's user avatar
1 vote
1 answer
559 views

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 : # ...
creatldd1 creatldd1's user avatar
1 vote
2 answers
666 views

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

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 ...
Daniel Kaplan's user avatar
0 votes
2 answers
14k views

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 ...
NatsumiStar's user avatar
0 votes
2 answers
1k views

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
316 views

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 ...
vinnymarz's user avatar
1 vote
0 answers
45 views

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
0 votes
1 answer
115 views

My system is macOS 13.2.1, the shell is oh-my-zsh (same behavior on bash). I found a weird behavior on cd command. It changes the current directory to a wrong one. This is not caused by the soft link, ...
shunliang's user avatar
-4 votes
3 answers
243 views

I typed cd -- into my linux terminal and it took me to a directory I don't recognize. Where does cd -- take you? Is it your root directory?
user564338's user avatar
0 votes
1 answer
810 views

Im confused about this bash option: -P If set, do not resolve symbolic links when performing commands such as cd which change the current directory. The physical directory is used instead. By default,...
enoopreuse22's user avatar
2 votes
1 answer
2k views

I am attempting to modify the sudoers files located within the sudoers.d directory to allow a group named "swts" to perform a cp and chown as part of an automation job. To accomplish this, I ...
Rahul Kodumuru's user avatar
32 votes
1 answer
3k views

For example: $ ls -aF ./ ../ bin/ $ cd tin # with a tee, not bee bin $ pwd /home/user/bin In other words, cd guesses that what I really meant was cd bin, and successfully (huh?) changes the current ...
Ana Nimbus's user avatar
0 votes
1 answer
260 views

I don't know why someone would make a directory with a leading hyphen, e.g. named "-1". When I try to change to that directory, it says invalid option. I tried putting "-1" in ...
Classified's user avatar
1 vote
1 answer
4k views

https://stackoverflow.com/questions/25802017/bash-shell-search-for-subfolder-in-current-dir-and-cd-into-it would like to implement this, as I don't want to tabcomplete. when I type the command: cd `...
hal3m's user avatar
  • 23
0 votes
1 answer
220 views

The pushd and popd are very useful and often needed when working on the command line, but I'm not enjoying them to the extent they can. It is subjective but I find the naming of the pair to be ...
Rahav's user avatar
  • 117
0 votes
1 answer
683 views

From a reddit thread I found this short snippet you can add to your .bashrc that automatically shows the list of contents of a dir you've cd'd into: cd() { builtin cd "$@" && ls }...
3rdgrade-dropout's user avatar
0 votes
1 answer
150 views

On Windows, it seems that if the user has read/write permission to the lev5 directory, but no permission at all for all its ancestors, cd c:\lev1\lev2\lev3\lev4\lev5 still works. On Linux, even if I ...
Damn Vegetables's user avatar
0 votes
0 answers
116 views

This is really frustrating. The directory exists. andy@7 /media/andy/5b4b2ae5-9aaa-4559-9f41-afb313998c75/home/andy/bin> How do I fix this? cd: /media/andy/5b4b2ae5-9aaa-4559-9f41-afb313998c75/...
fixit7's user avatar
  • 139
0 votes
4 answers
228 views

I am in a directory which is a symlink me@hostname:/home/me$ ls -al the_link -> actual_a actual_a actual_b actual_c me@hostname:/home/me$ cd the_link me@hostname:/home/me/the_link$ Now while I've ...
user avatar
1 vote
2 answers
1k views

When I launch xterm with the following command: xterm -e 'cd ~' -hold A new xterm window pops up saying: xterm: Can't execvp cd ~: No such file or directory After which the xterm window is still in my ...
Larsinator9000's user avatar
1 vote
1 answer
134 views

Perhaps a pedantic question, but is there a convention on where to cd if I want to move the current directory to somewhere else. (It can't be moved while being inside it) I guess / (root) would do as ...
Cigarette Smoking Man's user avatar
0 votes
2 answers
490 views

The first thing I do after cd'ing to a directory is to use "ls", as I imagine is the case for a lot of people. So I decided to define a function in my .bashrc to do both together. This is ...
Calibre's user avatar
0 votes
1 answer
709 views

I am seeing "xargs" behaviour that seems to be quite unexpected, in my experience. I use "ls" to find a matching folder name and sending it to "cd" using "xargs&...
user2153235's user avatar
4 votes
1 answer
1k views

So let's set up the context. Two paths: /some/very/convoluted/path/name/the-wanted-directory /myhome I create a symbolic link in /myhome and then cd into it: /myhome $ ln -s /some/very/convoluted/path/...
Kit's user avatar
  • 1,103
-3 votes
1 answer
258 views

I am aware that cd is used to navigate between files in linux commandline. However, I am not sure what the following, that I came across while trying to replicate something, means: cd ../.. It was ...
Sachin's user avatar
  • 107
1 vote
2 answers
2k views

I am attempting to use a for loop to move files (e.g. .txt) into a new directory, where the original directory name as part of the name, but add an extra "with-new-files" onto the name so I ...
Michelle's user avatar
1 vote
0 answers
609 views

This question is actually derived from a problem I have with a python library which deletes a file tree and then recreates the content, but on attempt of execution of a file inside the directory, the ...
PrivateOmega's user avatar
2 votes
2 answers
60 views

The output of jobs looks something like this [1] Stopped TERM=xterm-256color vim --servername vim ~/.gitconfig [2]- Stopped TERM=xterm-256color vim --servername vim ~...
Enlico's user avatar
  • 2,362
-1 votes
2 answers
521 views

What I want to do is to make a command that prints some related info if the command is successful. As an example, if I define an alias as alias cd='cd /path/to/destination/ && echo "...
nougako's user avatar
  • 131
-4 votes
1 answer
7k views

For some reason, every time I need to go to passwd or even shadow, It does not allow me. For example: cd /etc/passwd Output: cd: not a directory: /etc/passwd Same thing with shadow. Because of this, ...
The Man Who Sold The World's user avatar
0 votes
1 answer
704 views

I am using Ubuntu and sometimes when I use cd - I don't go into the previous directory. And every time I get the directory which it cded to. example:- $cd - /home/[usrname]/Downloads $cd - /home/[...
user135142's user avatar
0 votes
0 answers
18 views

I have a directory named "test 1" and I create a variable dest="test\ 1" I want to navigate to the directory using the cd command, so I type cd $dest which gives the output as -...
klaus_03's user avatar
2 votes
2 answers
410 views

I want to push a directory onto the directory stack in order to refer to it using "tilde shorthand" (eg. ~1 refers to the second entry in the directory list), but I don't want to actually ...
chb's user avatar
  • 708
-2 votes
1 answer
4k views

I cannot get into /root and even when i use "sudo ls /root" it asks me for the password then nothing happens. Im new to linux and when I was testing out Kali linux i tried using permission ...
mossmich's user avatar
0 votes
1 answer
1k views

Below is a small extract of my code for you to have a better visibilty on my problem. As each file in the directory enters the loop, the value of em is extracted from the filename and compared with ...
Ngouaba Rosalie's user avatar
1 vote
1 answer
60 views

I have a little script I wrote that lets me change to the directory of a script that's on the path, which helps me quickly get to other scripts I tend to want to edit, in the same folder as the ...
Brad Parks's user avatar
  • 1,789
-2 votes
1 answer
1k views

I switch user to root used su. but i still couldnt cd /etc/group but the group folder is in my /etc folder. root@Desktop:/etc# cd group bash: cd: group: Not a directory
radiorz's user avatar
  • 95
0 votes
3 answers
623 views

We recently migrated from HP-UX B.11.31 to Linux 3.10.0-1160.15.2.el7.x86_64. I am trying to achieve the below (which worked in the earlier HP-UX system): $ pwd /global/app/opt/prod/ee/01/custo/src/ $ ...
Aman S. Aneja's user avatar
0 votes
1 answer
382 views

I'm preparing headers for a C++ project and I decided to use find to get include option to other header files. To list the right path, I need to use cd with it, like: cd 'PATH/TO/HEADER/FILE' find ../....
ArchBug's user avatar
  • 15
1 vote
0 answers
173 views

There is a script that should change the path of the shell where it was run from. I used this code: #!/bin/bash TTY=$(tty) echo -e "cd /tmp/ \r" > $TTY exit But that does not work. Is ...
flyingpenguin's user avatar
0 votes
0 answers
178 views

On MacOS terminal with bash, I get an ls after a cd. When the directory contains many files, I can't see the effect of the cd since it scrolls away due to the ls. This is what I see $ which cd cd is a ...
chmike's user avatar
  • 231

1
2 3 4 5
9