cd-command

how to get file path without the filename itself

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 then run: cd $(xsel -b) but ofcourse I can’t …

Total answers: 2

How to explain a weird cd behavior on macOS?

How to explain a weird cd behavior on macOS? 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, because there is no directory in the right …

Total answers: 1

ZSH — cd into directory without full path name

ZSH — cd into directory without full path name 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 `find . -name test -type d` I get this error: find: ./usr/sbin/authserver: Permission denied I’ve tried cd’ing with fzf and ranger. but it’s all a mess. Also I …

Total answers: 1

Re-cd into current directory

Re-cd into current directory 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 had my shell open, some other process changed the symlink from the_link -> actual_a to the_link -> actual_b and possibly even did rm -rf actual_a. If …

Total answers: 4

Xterm cd command not working in launch option

Xterm cd command not working in launch option 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 current directory, where I can run cd ~ …

Total answers: 2

"cd" in a function works, except when it doesn't

"cd" in a function works, except when it doesn't 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 what I came up with: …

Total answers: 2

"xargs" not sending argument to "cd" via stdio

"xargs" not sending argument to "cd" via stdio 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". I get the message that the folder doesn’t exist. If I don’t use "xargs", however, the "cd" …

Total answers: 1

Cannot cd into directory even though group has permissions

Cannot cd into directory even though group has permissions I’m aware that there are other similar questions, but nothing in there solved my issue. gitlab-runner@my-machine:~$ groups gitlab-runner my-user gitlab-runner@my-machine:~$ sudo ls -l /home total 16 drwxrwsr-x+ 16 my-user my-user 4096 Feb 13 09:22 my-user # … other users’ homes omitted … gitlab-runner@my-machine:~$ sudo ls -l …

Total answers: 1

How to use substitute with cd command in Linux

How to use substitute with cd command in Linux 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/ $ cd prod qa /global/app/opt/qa/ee/01/custo/src/ $ pwd /global/app/opt/qa/ee/01/custo/src/ Basically, it switches from prod to qa, maintaining the relative directory structure. …

Total answers: 3

How to get recent places in terminal/shell?

How to get recent places in terminal/shell? Is there any way to get a list of the most recent ‘places’ (directories) that have been navigated in terminal (osx)? I mean, I’d like to open my terminal, type some command, get the last 2 or 3 places I’ve been, and go there. Something like what the …

Total answers: 1

Changing directory by changing one early word in a pathname

Changing directory by changing one early word in a pathname How do I change to a near-identical path with a different low-level parent? If you’re working in for instance ~/foobar/foo/data/images/2020/01/14/0001/ and need to get to the same path in bar instead of foo, how can you get there without typing out cd ~/foobar/bar/data/images/2020/01/14/0001/? Surely there’s …

Total answers: 5

What is an "alternative directory name" in CDPATH for the cd command?

What is an "alternative directory name" in CDPATH for the cd command? In the cd, bash help page: The variable CDPATH defines the search path for the directory containing DIR. Alternative directory names in CDPATH are separated by a colon (:). A null directory name is the same as the current directory. If DIR begins …

Total answers: 3

How to `cd` with word in the middle of a folder?

How to `cd` with word in the middle of a folder? I have workspace with many folders which all are consisted of long paths. For example: |- workspace |– this.is.very.long.name.context |– this.is.another.long.path.authors |– // 20 more folders |– this.is.folder.with.too.many.characters.folder They all start with same phase (this.is) which in my real case is 20 characters long …

Total answers: 4

libtool error cd: ../..: Not a directory

libtool error cd: ../..: Not a directory Getting this very bizarre error from libtool when trying to install a package I built. It happens when running in a subdirectory (src/api) of the source tree: make[5]: Leaving directory ‘/users/galac/embray/src/slurm/src/api’ /bin/mkdir -p ‘/usr/local/lib’ /bin/bash ../../libtool –mode=install /usr/bin/install -c libslurm.la ‘/usr/local/lib’ ../../libtool: line 929: cd: ../..: Not a …

Total answers: 1

"cd" into /sys/kernel/debug/tracing causes permission change

"cd" into /sys/kernel/debug/tracing causes permission change I’ve faced a really strange issue today, and am totally helpless about it. Some of the servers I manage are monitored with Nagios. Recently I saw a disk usage probe failing with this error: DISK CRITICAL – /sys/kernel/debug/tracing is not accessible: Permission denied I wanted to investigate and my …

Total answers: 1

How do you go back to the previous directory in Ranger?

How do you go back to the previous directory in Ranger? In Ranger you can go to a directory with g. When you type g it gives you a list of places you can very easily go. For example g, and then p takes me to /tmp. How do I get back to the directory …

Total answers: 2

cifs: Cannot cd into a directory

cifs: Cannot cd into a directory For some reason I cannot cd into a particular remote directory for which I have access, it fails with: $ cd Data Services/ -bash: cd: Data Services/: Invalid argument This is how I mounted it: $ sudo mount -t cifs //big.acme.corp/network/ ~/z -o username=myuser,domain=mydomain,uid=$(id -u),gid=$(id -g),vers=1.0 Password for myuser@//big.acme.corp/network/: …

Total answers: 2