New answers tagged bash
0
votes
sudo: command not found, despite path being set correctly
$ sudo foo
sudo: foo: command not found
indicates that sudo couldn‘t access the command you want to run. Typical reasons for this are
the command (binary) does not exist,
the command is not in $PATH,...
0
votes
Possible diskutil info protocol fields?
I solved this a while go and will explain the problem before what I used for the solution.
Probably a lack of experience here with this component of macOS but the need was to collect disk names and ...
0
votes
Make Homebrew installed Vim override system installed one
I had similar issues getting the brew version to work. So I added
export EDITOR="/opt/homebrew/bin/vim"
to my ~./zshrc file and ran
% source ~/.zshrc
Worked like a charm.
% which vim
/opt/...
12
votes
Accepted
Terminal: How to move files to the last used directory conveniently?
"~-" refers to the previous directory. From the bash man page:
If the tilde- prefix is a `~-', the value of the shell variable OLDPWD, if it is set, is substituted.
$ pwd
/home/me
$ cd /...
4
votes
Terminal: How to move files to the last used directory conveniently?
There is a trick you could try, using the cd command and the fact that cd - changes to where you were last:
$ pwd
/home/me
$ cd somesubdir
$ pwd
/home/me/somesubdir
$ cd -
/home/me
$ cd -
/home/me/...
10
votes
Terminal: How to move files to the last used directory conveniently?
From man bash:
OLDPWD The previous working directory as set by the cd command.
So, cp file.txt $OLDPWD should help here (or cp file.txt "$OLDPWD" if you not sure whether the previous path ...
Top 50 recent answers are included
Related Tags
bash × 1772terminal × 981
macos × 678
command-line × 437
applescript × 163
script × 161
zsh × 110
homebrew × 87
automator × 84
path × 81
iterm × 71
mac × 65
unix × 52
finder × 49
python × 42
launchd × 40
catalina × 36
alias × 36
ssh × 34
permission × 33
security × 26
network × 25
environment-variables × 25
automation × 24
keyboard × 23