New answers tagged macos
0
votes
Flash drive won't mount after rsync
Rsync is just reading and writing files into a filesystem. As such, it can't (by itself) mess up hardware or a filesystem. However if there is already a software bug or a hardware failure present, ...
2
votes
Accepted
Zsh: Non-reverse history search
That handling of ^S/^Q characters that gets in the way of readline's (as used by bash) forward-search-history widget (bound to Ctrl+s in emacs mode) or zsh's equivalent history-incremental-search-...
6
votes
Accepted
What do the hexadecimal numbers represent on the ls output of the /dev directory?
If we're to believe the major(), minor(), makedev() macros at https://github.com/apple-oss-distributions/xnu/blob/xnu-10063.141.1/bsd/sys/types.h#L161 in the XNU sources that Apple makes available, ...
0
votes
ssh connection "client_loop: send disconnect: Broken pipe" or "Connection reset by <IP> port 22"
I ran into this issue when trying to connect to a Windows SSH server from a Linux script (for automations).
It turns out that OpenSSH on Windows is really bad at inferring what shell to launch. This ...
6
votes
Assign variable a value and copy this value to the clipboard
You could do:
{pbcopy}<<<${zsh::==zsh}
=cmd is a filename expansion operator, that expands to the path of the first command found in $PATH. Similar to what the which builtin outputs except ...
4
votes
Accepted
Assign variable a value and copy this value to the clipboard
I somehow thought that you could set the variable using parameter expansion, then output it and pipe it:
echo ${zsh::=$(which zsh)} | pbcopy
but that’s incorrect, the variable is set in a subshell.
...
2
votes
Accepted
To make 'rmdir' and 'find -delete' ignore '.DS_Store' files
Note that -delete implies -depth (process leaves between branches they're on).
That's unrelated to FreeBSD's -depth n extension which returns true if the current file being processed is at depth n.
...
2
votes
To make 'rmdir' and 'find -delete' ignore '.DS_Store' files
.DS_Store files can prevent directories from being deleted as they cause the directories to be non-empty.
You can use a combination of shell commands to find and delete these files, and then proceed ...
3
votes
Accepted
Manpage of 'regex(7)', from the shell
The command for displaying the man page for foo in section 7 is man 7 foo. The syntax foo(7) is how references to that man page are usually written.
The section numbers and page names are not the same ...
4
votes
Accepted
Paste the value of a shell expression into Vim
Instead of using the clip-board, this use-case is perfect for :r!
:r! echo $(which bash)
: enters command mode
r means we will read something (if we don't include !, then it will read a file).
! ...
1
vote
Paste the value of a shell expression into Vim
If you're on macos as per the question tags, then the default Vim has clipboard support:
% /usr/bin/vim --version | grep -wo -e '.clipboard' -e '.*version.*'
macOS version - arm64
Normal version ...
23
votes
Accepted
Why does editing '/etc/shells' file using 'sudo open' shows an error saying I don't own the file?
The macOS command open command will not actually start the editor on its own. Instead, it asks the macOS Launch Services to do it.
Your login session's Launch Services component runs as your regular ...
6
votes
Why does editing '/etc/shells' file using 'sudo open' shows an error saying I don't own the file?
The sudoedit command (man sudoedit) solves this problem.
First, setup sudoedit:
In your ~/.bashrc, add:
export EDITOR=$(type -p editor_of_choice)
export VISUAL=$(type -p editor_of_choice)
Then source ...
2
votes
Why does editing '/etc/shells' file using 'sudo open' shows an error saying I don't own the file?
I couldn't find anything in the man page explaining this behavior, but I'm guessing that it's resolving who the graphically logged in user is and trying to open the file as that user even when it's ...
0
votes
How to create a bootable USB for Debian on Mac with Apple Silicon?
I know it's an old question, but I faced the same issue recently and found a way to make it work using dd.
You can create bootable USB (for Ubuntu server for e.g.) using a Mac following these steps:
...
Top 50 recent answers are included
Related Tags
macos × 2854bash × 418
linux × 262
terminal × 246
zsh × 182
shell-script × 170
shell × 156
command-line × 146
ssh × 133
sed × 100
ubuntu × 94
files × 83
macintosh × 81
find × 79
permissions × 74
grep × 68
text-processing × 66
filesystems × 60
networking × 53
ls × 50
awk × 48
bsd × 48
regular-expression × 46
path × 45
debian × 43