Tag Info

New answers tagged

0

please open your iso with the help of winmount into new drive then you click kali linux setup after it will open the menu takes your permission for starting the kali linux installation. You can give permission to them


0

You may also try using locate utility, e.g.: updatedb -o ~/tmp.db -l0 -U $PWD; cd $(locate -d ~/tmp.db -l 1 -b -r foo-) For more complex regex pattern check info locate.


0

Based on the final requirement you don't need cd; you can do the following: find . -type d -name 'foo-*' -exec make -C {} ';' and find . -type d -name 'foo-*' -exec phing -f {}/build.xml ';' The asterisks are handled by find internally, and I believe this is POSIX compatible.


0

Does drush mung backticks and vertical bars?  If not, you could use cd `ls | grep foo- | head -n 1` If backticks don't work, but |, $, ( and ) do, then you could change the above to cd $(ls | grep foo- | head -n 1) If | doen't work, but $, ( and ) do, then you could do cd $(myprog) where myprog is a script that you write to determine the directory ...


2

It does work, just not how you expect. && waits until the command before it completes. If the result at that point is true, it will execute the next instruction. So if you type bash && cd desktop, you will first be presented with a bash shell. If you type exit, you'll be back in whatever shell you were in before, and then the directory will ...


19

The part after && is executed in the current shell, it is not some argument handed over to the bash you run with sudo. You might be tempted to try sudo bash -c 'cd desktop' but that doesn't work because that bash exits after cd desktop. You can try: sudo sh -c 'cd desktop && exec bash' which "works" (i.e. places you in the directory ...


0

Your ls call shows that /lib/modules/2.6.32-431.1.2.0.1.el6.x86_64/build exists and is a symbolic link. Changing to it complains that the file doesn't exist. This implies that the symbolic link is dangling: its target doesn't exist. You don't seem to have the kernel sources installed, at least not the right version of the kernel sources, at least no in the ...


2

They were probably pressing tab twice to get filename completion. What exactly you are shown depends a bit on the shell: zsh, for example, can be configured to show you file date and size as well, and it is clever enough to only show you directories since you can't cd into a file anyway. Example of bash output: $ cd (tabtab) dira/ dirb/ file.txt ...


3

It's the programmable completion feature of the shell. You can simply press the TAB key twice to gain this behavior. Imagine you type cd Downkoads/St and then press the TAB key. St will be completed to Stuff if it is the only folder starting with St. If there are other folders starting with St in there, you will get a list of them by pressing TAB twice. For ...


7

Because bash (and possibly other shells) track the path you descended, including symlinks, in order to make your trail back up look like the one down. Bash knows how you got to the working directory because cd must be a shell built-in. When you run ls .. the shell can't substitute the "symbolic path" because grep .. is also valid and translating .. would be ...


1

On Ubuntu 12.04, for me this works: eject /dev/sr0


5

You can install and use my dirhistory utility for bash. Basically, it's a daemon that collects directory changes from all your shells, and a Cdk program that displays the history and lets you pick any directory to switch to (so you're not limited to a stack).


-1

The easiest and most common way to do such stuff is to use an alias: alias dir1='cd parent1/suba/subb/'


15

You didn't specify which shell you are using, so let this be excuse to advertise zsh. Yes, we do have more history for cd, namely cd -2, cd -4 etc. Very convenient is cd -TAB, especially with completion system and colors enabled: This is what I have in .zshrc: setopt AUTO_PUSHD setopt PUSHD_MINUS setopt CDABLE_VARS zstyle ':completion:*:directory-stack' ...


8

To answer your question regarding "more history". No the cd - feature in Bash only supports a single directory that you can "flip" back to. As @Ramesh states in his answer. If you want a longer history of directories you can use pushd and popd to save a directory or return to a previous one. You can also see the list of what's currently in the stack with ...


19

The command you are looking for is pushd and popd. You could view a practical working example of pushd and popd from here. mkdir /tmp/dir1 mkdir /tmp/dir2 mkdir /tmp/dir3 mkdir /tmp/dir4 cd /tmp/dir1 pushd . cd /tmp/dir2 pushd . cd /tmp/dir3 pushd . cd /tmp/dir4 pushd . dirs /tmp/dir4 /tmp/dir4 /tmp/dir3 /tmp/dir2 /tmp/dir1


0

You can set the target directories to the positional array. For example: cd ~ mkdir dirtest cd dirtest i=0 until [ "$((i=$i+1))" -gt 9 ] do mkdir -p parent"$i"/suba/subb done That creates a tree modeled after the example in the question, with parents 1-9. I can now: set -- "$PWD/parent"[0-9]"/suba/subb" cd "$1"; pwd OUTPUT ...


3

You can use the PWD variable and parameter expansion constructs to quickly apply a text transformation to the current directory. cd ${PWD/parent1/parent2} This doesn't have to be exactly a path component, it can be any substring. For example, if the paths are literally parent1 and parent2, and there is no character 1 further left in the path, you can use ...


1

first time if parent1 ou parent 2 are elsewhere in directory path. cd $(pwd | sed -e s:/parent1/:/parent2/: ) then if you switch only from those two directory cd - will bring you back to the dir you jump from.


0

One way to do this is to use pwd and sed to replace the differences in the path like this: cd `pwd | sed 's/parent1/parent2/'` or like this: cd $( pwd | sed 's/parent1/parent2/' ) In some cases (like the example) you do not need to specify the entire directory, and you can just replace the differing parts: cd `pwd | sed 's/1/2/'`



Top 50 recent answers are included