Questions tagged [bash]

The default Unix shell used by Terminal in macOS

Filter by
Sorted by
Tagged with
1
vote
3answers
997 views

How do I prevented the hackers (secret intel) manipulating my terminal again [closed]

How do I prevented the hackers manipulating my terminal again so that my terminal works correct again? Here in the Netherlands we perform cybertest at the company where we work and the attacks are ...
2
votes
1answer
141 views

Open homebrew version of emacs instead of Apple version

I installed emacs 26.1 via brew install emacs, but when I try to start emacs via command line, only the outdated Apple-supplied version (22.1.1) opens. However, emacs is apparently correctly linked: ...
0
votes
1answer
37 views

Turn on Proxy Without Password Prompt

I am looking for a way to do the equivalent without prompting for password. I need it to be a native way that does not require the user to change any configuration files (including sudoers). And GUI ...
1
vote
1answer
866 views

Endpoint has been activated through legacy launch on Mac Mini

Asking this here as I don't think it's a Linux problem. My Mac Mini sits on a desktop and is the 'central authority' for all of my backups. I have nine Linux virtual machines on a server on which ...
3
votes
2answers
625 views

Zsh vs Bash shell in Terminal [duplicate]

Are there any advantages to using zsh vs bash shell in Terminal app? Also, can you use zsh from the terminal? My understanding of zsh is skewed.
1
vote
1answer
83 views

macOS terminal: quick way to edit command options after bash/zsh autocomplete

The issue I use autocomplete from history a lot whether that's with up-arrow or typing the first few letters and completing the whole command including all arguments (options and others) with right-...
2
votes
1answer
1k views

Why is rename command missing from macOS?

I usually rename files and directories with the mv command. I'm reading a book on bash shell that mentions the rename command. When I executed man rename a man page was shown. However, when I entered ...
3
votes
2answers
87 views

Trigger the Creation of a Specific Preference List?

I have the following function: hardware_model () { local hardware_mod hardware_mod=$(defaults read ~/Library/Preferences/com.apple.SystemProfiler.plist 'CPU Names' \ | cut -sd '"' -f 4 \ | ...
1
vote
0answers
72 views

Terminal Startup command not found

Whenever I open my terminal there is a line that reads, -bash: 6ee67d3f2005ceaf5266c966198b7f3c165bf5d7: command not found This is shown after the line that states my last login information. I am ...
6
votes
2answers
841 views

“bash -D” command doesn't seem to do anything useful

I'm finally getting around to getting more familiar with the shell after all these years. I was exploring the man page for bash and looking at the -D option, which, according to the manual: -D ...
4
votes
2answers
375 views

Unable to resolve hostnames inside macOS chroot jail

I just created a chroot jail with inetutils, coreutils and bash. Most of the things seem to work. I can ping ip addresses and hosts that are inside /etc/hosts, however, I can't ping hosts that are not ...
0
votes
1answer
41 views

Searching forward through bash history

You can hit ctrl-r from the command line to initiate a search for a previously issued command. You can then hit ctrl-r to cycle back through the older commands that match the search string. However, ...
0
votes
1answer
993 views

Bash history not initially remembered with iterm2

I've got an annoying problem with iterm2 not remembering my history when I close out a terminal window. I'm not sure if it might be my .bash_profile config or what. Here is what is happening: 1) ...
2
votes
2answers
638 views

Can't open a PDF from Terminal on Mac because it ‘couldn't get a file descriptor referring to the console’

I tried to use the command: open <filename.pdf> but the message I got was Couldn't get a file descriptor referring to the console What can I do?
4
votes
3answers
507 views

How can I find the “friendly name” of the operating system from the shell / Terminal / bash?

I know that I can use sw_ver to find this information: ProductName: Mac OS X ProductVersion: 10.14 BuildVersion: 18A353d …and I know I can find other things like uname can give me some types of ...
3
votes
2answers
299 views

How to use a pipe in a script optionally

How can I achieve the conditional usage of a pipe for a command execution in a script. It looks like this #!/bin/bash XCPRETTY=" | xcpretty" if [ $(which xcpretty | wc -l) == 0 ]; then XCPRETTY="...
0
votes
1answer
449 views

netsh equivalent command in OSX

How would I construct the bash equivalent of this command? netsh -c interface ipv4 add neighbors "Wi-Fi" "10.0.1.1" "b8:8d:12:57:2d:50" store=persistent Thanks!
0
votes
0answers
114 views

Terminal and iTerm appear to be partially opening in zsh

I recently installed Julia on my iMac running High Sierra. Julia seems to want to run in the Z-shell whereas I normally use bash. I haven't run Julia today but my Term2 windows are screwed up since ...
2
votes
1answer
1k views

Scrolling doesn't work in Terminal for commands like less

I used to be able to scroll using the trackpad through git diff or man pages which both use less when the output doesn't fit on screen. Today I restarted my computer and that behaviour is gone and I ...
1
vote
1answer
260 views

Mac terminal says “-bash: echo: write error: Broken pipe” on opening

I opened my terminal, like I do most days Mon-Fri, and was surprised to see this error: Last login: Fri Jul 27 17:19:25 on console -bash: echo: write error: Broken pipe SomeMac:~ user568458$ ...
0
votes
2answers
167 views

Display emoji faces for correct & wrong commands in terminals

I want to customize my terminal to display emoji faces, showing sad face for wrong command and happy face for right command that I enter. Is there any way that I can do this using my terminal bash. ...
4
votes
2answers
803 views

I have `/usr/bin/env` in my “Macintosh HD” but not in the recovery partition. Is this normal?

I'm working on a MacBook Air, that's currently booting to macOS High Sierra 10.13.6. It also has an Ubuntu 16.04 partition, that I am currently trying to reach. I was trying reinstall rEFInd, which ...
3
votes
1answer
345 views

Embedding AppleScript inside a Bash — getting Error

I'm fiddling with bash for the first time and trying to get something simple to work. #!/bin/bash while true ; do osascript <<EOF tell application "System Events" ...
1
vote
1answer
381 views

NTLM hash function in Terminal?

I'm aware there are a number of hash functions available in terminal such as echo "text" | openssl <hashname> or perl -MDigest::SHA -nle 'print Digest::SHA::sha224_hex($_), ":", $_'. However, I ...
3
votes
0answers
288 views

Bash script detect received iMessage along with its contents?

I've been doing some searching around online for an answer to this question and can't seem to find one. My aim is to run a bash script which waits for the arrival of an iMessage from a specific ...
1
vote
0answers
46 views

Moved /usr/bin and /usr/lib folder, how do I fix it? (iOS 10.2.1, iPhone 6 +)

So long story short, I was trying to free up storage on my root partition, and I made a stupid mistake. I moved my /usr/bin and /usr/lib folder to /var/stash/bin and /var/stash/lib respectively. ...
1
vote
2answers
188 views

plistbuddy command value from csv, search and insert

I have a plistbuddy command that I need to execute for 100 different users. The value I have to enter for the 100 individual users depends on the hostname. I was thinking I could use a csv that has ...
2
votes
0answers
96 views

What are .backup files and how do I remove them?

I'm working on removing hidden files from a directory, but keep running into issues with .backup files. I keep getting permission denied notifications even when using sudo. I'm not sure where they ...
4
votes
1answer
1k views

Add Environment Variable to PATH

I am new to the Apple "eco system" and I am trying to setup my environment variables for local development. Here is what I have in my ~/.bash_profile (simplified for brevity): export PATH="$...
0
votes
2answers
83 views

How to list all /dev/disks, not partitions ending in s1, s2, …?

I am trying to list (output) the drive its Mac OS X name from the serial number in the Bash 3.2 shell on the command line. For this I need to loop through all block devices not being a partition. So I ...
2
votes
2answers
361 views

How do I map a terminal command to a function key?

I have a terminal command that can control my external display's brightness. I'm trying to map that command to a key on the keyboard so it works like a "brightness up" and "brightness down" key. ...
3
votes
1answer
320 views

What the point of custom ANSI colors in Terminal Preferences?

In the preferences of the Terminal App, you can set custom ANSI colors for blue, green, yellow, bright red, etc. but they don't actually change anything in the Shell. For example using ls -G still ...
4
votes
0answers
98 views

iOS Cannot SIGINT or Ctrl+C when SSH'ed into it

I have a jailbroken iPhone that I often SSH into. For some reason, I am unable to Ctrl+C a foreground process or kill -INT a background process when said process is started in an SSH session, but I ...
3
votes
2answers
270 views

Convert an epoch date to human readable format?

echo "$some_string" | awk -F '|' '{print $1 $2}' $2 is a epoch date and I want to convert it to human readable format. I tried doing date -r $2 but no luck.
5
votes
1answer
129 views

How to test my installation script on macOS?

What is the best way to test an install script on macOS? I have written an installation script so that others can easily install the program qme-ng which I forked and am working on. However testing ...
4
votes
3answers
1k views

Generic exit function for iTerm2

I've recently begun to use iTerm2 instead of the macOS Terminal application and I'm really happy with it. I'm very used to use to exit command to close the instance that currently has focus. With ...
39
votes
5answers
6k views

.git-completion.bash producing error on macOS Sierra 10.12.6

I've followed the process for git-completion as per the description provided at https://medium.com/@farooqyousuf/autocomplete-git-commands-and-branch-names-in-terminal-on-mac-os-x-4e0beac0388a: The ...
2
votes
1answer
357 views

Getting error in Terminal when typing Passwd *Username*

I’ve been trying to change the root password via Terminal on macOS. I launched Terminal by holding cmd + S while booting, which logged me automatically in as root without password. When I type in ...
3
votes
2answers
69 views

How do I Find a string in a file and place a string above it?

I would like to find the String __MARKER__ in someFile.txt and place a String above it (e.g. Hello World!). How would I do that using sed? sed -i -e 's/__MARKER__/Hello world\n__MARKER__/' someFile....
10
votes
3answers
4k views

Installing ffmpeg from dmg and then running from a terminal, is there a better way?

From here: https://ffmpeg.org/download.html#build-mac I chose static builds 64-bit which too me to https://evermeet.cx/ffmpeg/ I then downloaded this: and opened it using this: which gave ...
1
vote
1answer
174 views

When I set an export PROMPT_COMMAND, it changes my terminal settings?

So, I wanted to add a timestamp to my terminal prompt and I followed this askUbuntu answer to do so. And it works fine. In my terminal preferences I have set the new tab to open the present working ...
1
vote
0answers
151 views

Set globstar to act recursively

In the answer to question about enable wildcards recursive: bash - What expands to all files in current directory recursively? the globstar could be activated by shopt -s globstar: I post snippet ...
2
votes
1answer
94 views

Randomize group of modification dates

I have several files that have the same modification date in a folder, and I would like to change the date for all files within that folder, and the same with other folders in the directory so that ...
3
votes
2answers
169 views

Automate package installation via shell script for macOS?

I am trying to write a shell script to automate installation of a bunch of dependencies for a project on macOS which will be an equivalent script for the same that works on EL6/EL7 and uses the yum ...
1
vote
1answer
373 views

Restore Terminal Tabs with Session History

I had a Terminal window with 7 or 8 tabs with a lot of history and long scrollback, with resume set to 10000 rows, that was always persisting between sessions. I have accidentally closed the window ...
2
votes
2answers
93 views

Get file path of movie playing in VLC

If VLC is running, playing a movie at file path X, is there any way I can know what file path X is from a Bash script? (For simplicity's sake we can assume that only one instance of VLC is running.) ...
3
votes
1answer
190 views

What shell command will clone a directory instead of making a deep copy?

I wish to take an APFS clone snapshot of a large directory using a shell script. In Finder, I can just Cmd-C, move to the other folder, and Cmd-V and within a few seconds I have a duplicate that takes ...
1
vote
1answer
34 views

`type -a` works even though `-a` not an option

I could check installed apps with command type -a $ type -a python python is /Users/gaowei/Desktop/Django/learning_log/ll_env/bin/python python is /Users/gaowei/anaconda3/bin/python python is /usr/...
0
votes
1answer
303 views

Kill all the active process

I could close specified apps like $ killall "PDF Expert" $ killall "Google Chrome" The active processes could be check with command top How could I kill all the process with codes like for process ...
3
votes
2answers
72 views

Seeking script to add to my automator service to make it reveal newly created item in finder

After much research (I am not familiar with Shell, Bash coding... and only just discovered the magic of Automator and Terminal usefulness), I've created an Automator service that captures a shot of ...