New answers tagged

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,...
nohillside's user avatar
  • 97.1k
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 ...
Bob R's user avatar
  • 129
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/...
Harry's user avatar
  • 101
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 /...
CigyCyriac's user avatar
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/...
j4nd3r53n's user avatar
  • 151
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 ...
nohillside's user avatar
  • 97.1k

Top 50 recent answers are included