Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

Questions tagged [command-line]

Using programs and commands that do not have a graphical user interface (GUI) but are rather controlled by typing text commands into a terminal program, or shell.

0
votes
1answer
31 views

How can I make macOS respect HOSTALIASES environment variable?

According to the Apple developer documentation, setting HOSTALIASES will make a process look in that file for hostnames instead of /etc/hosts. However when I tested this with ping and a replacement ...
0
votes
0answers
17 views

How do I create a minimal chroot jail in macOS?

I am trying to figure out the minimal things I need to do to create a chroot jail in macOS. I have seen a few scripts online (https://github.com/skissane/mkjail, https://github.com/jsarenik/Mac-Hroot),...
0
votes
0answers
13 views

On Mac terminal keyboard key action macros?

I want to assign long commands in one key on Mac terminal. For example, I have assigned command php bin/magento under F13 key from "Terminal → Preference → Profiles → Basic → ...
0
votes
0answers
22 views

Add IP alias on macOS like on Ubuntu? [duplicate]

I want to add a second IP address on my Mac like on Ubuntu. On Ubuntu I use this: $ sudo ip addr add 192.168.1.12/24 dev eth0 On my Mac I used this: $ sudo ifconfig en0 alias 192.168.1.12/24 On ...
3
votes
1answer
31 views

Is it possible to fix the spacing when using “ls” with colored output?

This is the exact same issue found here: https://unix.stackexchange.com/questions/165154/changing-the-spacing-between-files-in-ls When you run the command ls -G or CLICOLOR=1; ls the spacing in the ...
1
vote
1answer
15 views

extract if_index without grep from scutil --dns

I'm using the grep command to extract active interfaces from the output of the scutil command with the --dns option. $ scutil --dns | grep 'if_index' I am suspecting if a user's machine with ...
0
votes
0answers
9 views

Receive notification in program on a network event [closed]

In my program i have to detect whenever a new interface goes active and reachable by the internet. So far i am doing it in Shell script by using networksetup -listnetworkserviceorder | grep '...
1
vote
1answer
17 views

Does a wget showing full request headers, exist on mac? The GNU wget on mac doesn't but the GNU wget on windows (Wget 1.19)

Does a wget showing full request headers, exist on mac? The GNU wget on mac doesn't but the GNU wget on windows (Wget 1.19) The example output that I want, is what I get on GNU Wget in Windows (This ...
1
vote
1answer
25 views

How do I decode the contents of Apple System Logs in /var/log/DiagnosticMessages (using the command line)

I would like to decode the contents of the files in /var/log/DiagnosticMessages. My laptop currently has 52MB of such files: $ ls -l total 53572 -rw-r--r--@ 1 root admin 483660 Mar 11 22:48 2019....
1
vote
0answers
22 views

“open” command not working after upgrade to High Sierra

After my recent upgrade to High Sierra, the command line command "open" no longer opens much. I have tried it on PDF, PPTX, png. It does work on ascii text files. The 'Preview' app does open if I ...
2
votes
0answers
52 views

Pip Installed Tools: “command not found” | Homebrew Installed Python Tools Work Fine

I installed Python 3 with Homebrew and a tool I was installing through Homebrew auto-installed Python 2.x. So, I have both and pip (etc) is installed for both, unlike the macOS default Python. ...
3
votes
4answers
684 views

“which” command doesn't work / path of Safari?

Why can’t I locate programs like Chrome or Safari or FireFox with the which command line tool? pasocon:~ ThisUser$ which python /anaconda3/bin/python pasocon:~ ThisUser$ which firefox pasocon:~ ...
2
votes
1answer
37 views

How can I make sure that the title of a Terminal tab/window is identical to the command I typed

I noticed that for aliases etc the title of a Terminal tab/window often isn't the same as the command I typed. This is sometimes confusing, especially for long-running processes with similar names. ...
0
votes
1answer
51 views

Why does chunkwm fail with “Permission denied” error for .chunkwmrc

ashleyharvey@Themis:~$ ls -al .chunkwmrc -rw------- 2 ashleyharvey staff 4.7K Apr 4 22:24 .chunkwmrc ashleyharvey@Themis:~$ chunkwm /bin/bash: /Users/ashleyharvey/.chunkwmrc: Permission denied So, ...
1
vote
1answer
20 views

LSCOLORS format

I want to configure my .bash_profile and I've seen this post about BSD based ls configuration: https://www.cyberciti.biz/faq/apple-mac-osx-terminal-color-ls-output-option/ I just don't know what is ...
25
votes
1answer
3k views

I Accidentally Deleted a Stock Terminal Theme

I accidentally deleted a stock Apple terminal theme that I'd like to get back. The one I accidentally deleted is called "Pro" (under the Profiles tab in the Terminal settings). Is there a way to get ...
0
votes
0answers
25 views

How do sort files by name in ls without putting capitals first? [duplicate]

How do I really sort files by name in ls without putting capitals first? $ ls -l total 0 -rw-r--r-- 1 apple staff 0 3 Apr 13:38 C -rw-r--r-- 1 apple staff 0 3 Apr 13:38 a -rw-r--r-- 1 apple ...
3
votes
1answer
648 views

Software update wants to install Command Line Tools. Why? I have no Xcode installed

Next to the mac OS 10.14.4-Update, Softwareupdate also shows me the following as a further update / download: Command Line Tools (macOS Mojave version 10.14) for Xcode 10.2 Now if I need it, I am ...
1
vote
3answers
70 views

grep command is killed

I am running grep -o $string ~/giant_file where string="foo bar baz" This process keeps being killed after running for awhile and generating results, and I don't understand why. When it is killed, ...
4
votes
0answers
29 views

Is there a script/cmd that I can create/run that will allow me to install .dmg? [duplicate]

I have been working on a "Mac Rollout Project". After I run the Macs through the Apple setup, I have a list of .DMG / Applications that I have to install. There is no particular order that the .DMG / ...
7
votes
2answers
519 views

How does the mv command work with external drives?

On the same drive I assume it would change something like a FAT table to repoint to the location of files. Question When going to a different drive (maybe even partition) does the mv command first ...
1
vote
1answer
34 views

How to fix Permission Denied error when starting up MongoDB

So I'm newbie to learning react and node and thought of building something based on MERN stack - I installed mongodb using npm install -g mongodb then it says its installed - then to create data ...
1
vote
1answer
15 views

How to provide detailed listing of /tmp directory

The standard options to ls are not working: I get the following 14:53:37/a2a $ls -l /tmp lrwxr-xr-x@ 1 root wheel 11 Jan 9 14:16 /tmp -> private/tmp $ls -lrta /tmp lrwxr-xr-x@ 1 root wheel ...
5
votes
3answers
877 views

Compilation error with Mojave: error: ‘_Atomic’ does not name a type

After updating to Mojave 10.14.4 and Xcode 10.2, I fail to compile GCC 8.3.0. The error message is In file included from /usr/include/sys/sysctl.h:83, from ../../gcc-8.3.0/gcc/config/...
0
votes
2answers
29 views

Best way to run Shell commands on VirtualBox Guest

What's the best way to run shell commands on a MacOS guest VM? Can't seem to run it through VirtualBox's guestcontrol, only lets you launch apps, not run commands directly. Saw some people suggest SSH,...
21
votes
5answers
3k views

How can I quit an app using Terminal?

I want to quit a certain applications on my Mac using Terminal. For example, how do I kill “Slack”? Do I need its PID number?
0
votes
1answer
50 views

How to make `sudo su` run startup scripts?

Supposedly the bin/sh shell that is the default root shell is not strictly a "bash" shell, but is a POSIX compliant equivalent. According to this site, when you invoke the shell executable of a "...
1
vote
0answers
22 views

How to find the list of icons that can be used in mac cli applications

I'm currently developing a node cli application and having used npm tools, my interest has been piqued by the use of npm-check and its use of icons in its cli interface. eg: There must be plenty of ...
0
votes
1answer
73 views

How do I observe and control a macOS update using `softwareupdate`?

I made the mistake (don't ask) of entering softwareupdate -ia --verbose in Terminal, which is now stuck doing — I don't know what: Software Update Tool Finding available software Downloading ...
-1
votes
1answer
30 views

“arp -a” output differs on computers attached to the same network

When I type arp -a I get all devices on the local network, right? My question is this: how come when I type this command on two separate machines, I get two different results? And when I ping the ...
3
votes
1answer
54 views

Extract numbers from string using shell

Using shell script, how do I extract two sets of numbers from a string like "R14C11"? I'd like to get the result as an AppleScript list. R14C11 -> {14, 11} R5C9 -> {5, 9} "R" and "C" will be ...
9
votes
3answers
1k views

Is xar preinstalled on macOS? [duplicate]

$ which xar /usr/bin/xar It's in /usr/bin. Does that mean it's preinstalled on mac?
0
votes
0answers
48 views

Find commande doesn't list existing file

Ok so! I search the file latexindent. The command typpe latexindent given me latexindent is /Library/TeX/texbin/latexindent. I execute find /Library/TeX/texbin/ -name "*latexindent*" but I don't have ...
0
votes
1answer
24 views

How to prevent browser from redirecting AT ALL using terminal

I have a very limited knowledge of this stuff so I hope this explanation makes sense.... My parents have somehow got on my MacBook, and made it so that they can change any setting and view/modify my ...
0
votes
0answers
13 views

Get Keychain password when managed by Network Access Server

I have a corporate macOS computer where the password is managed by a Network Access Server for Active Directory. If an admin changes my password on their system and my computer is connected to the ...
0
votes
1answer
21 views

How to activate Recoverit when 'csrutil' doesn't *on macbk pro 10.13.6

Terminal messaged 'failed to modify system integrity configuration. This tool needs to be executed from the Recovery OS.' Where is Recovery OS.Objective to recover data from Emptied Trash...precious ...
0
votes
1answer
121 views

Mac OS Mojave 10.14.1 File Sharing services off after restart

I have a late 2014 Mac Mini, running Mojave 10.14.1, which I'm using as a file server to a few users in our lab. The server will occasionally see power outages due to weather. The machine reliably ...
0
votes
1answer
31 views

How to read mail via command on Mac?

I set my mail agent tool to send and to receive mails with many accounts such as a gmail account. I want to read the mail via command line for triggering cronjob purpose. For example, | grep "...
1
vote
1answer
15 views

Ignore entire folder using du -I

I tried to ignore an entire subfolder of the current folder when running du: du -I=./subfolder -sh This, however, gives me the grand total size of the current folder as if the -I never worked. I ...
2
votes
1answer
30 views

On macOS, why is the output of log stream different to log show?

On macOS, why is the output of log stream different to log show? Specifically: log stream --predicate '(process == "smtpd") || (process == "smtp")' --debug In this case --debug also shows info ...
7
votes
2answers
732 views

Difference between two quite-similar Terminal commands

I have a script that I run as part of my development (it's the activation script for a Python venv environment). The way the documentation suggests that we run it is by going to the folder containing ...
2
votes
2answers
118 views

Does macOS have a command to retrieve detailed CPU information like /proc/cpuinfo on Linux? [duplicate]

Linux has a command to retrieve detailed CPU information using cat /proc/cpuinfo. Using this command, users can get CPU and CPU's core information like below. processor : 0 vendor_id : ...
2
votes
1answer
32 views

Why does lsof exceed kern.maxfiles?

Running Mojave 10.14.3 I notice there are currently more files open than the maxfiles allowed. How is this possible? In this case I do not have any symptoms or error messages, but in the past I have ...
2
votes
1answer
86 views

Copy SSH Public Key to clipboard WITHOUT newline appended

Every Google search for copying a Mac's SSH Public Key to clipboard yields the following command, which results in a newline appended: pbcopy < ~/.ssh/id_rsa.pub This is undesirable as I need to ...
2
votes
2answers
49 views

How to show current time in mac terminal prompt?

I have this: PS1+="\D{%H:%M:%S}"; But this displays the time the prompt started. I want the prompt to show the current 12 hour (not 24 hours) time live (so it keeps changing, and then when a command ...
3
votes
1answer
236 views

“Permission denied” when running macOS installer from command line

I'm trying to install High Sierra to an external drive, from a system which is running Mojave. I can't run the GUI installer (it warns me about trying to install an older version of the OS), so I'm ...
0
votes
1answer
19 views

Network proxy setup in terminal

I am trying to create a bash script that will update the mac's proxy settings and a few other places when a user changes their password every 60 days. So far I am trying to use this command for the ...
3
votes
1answer
219 views

Is there command to grant Full Disk Access for specific application?

You can allow an application to access data if you change settings in Security & Privacy → Privacy → Full Disk Access. Is there command to accomplish the same in terminal?
1
vote
1answer
63 views

Match the Creation Date of 2 sets of files with same name

I've just converted hundreds of AIF recordings from a few days ago to WAV, but I need the newly created files to keep the original Creation Date of the recordings. Filenames are identical apart from ...
3
votes
2answers
101 views

How to update shell programs

How do I update shell programs like crontab for example? On my Mac I've got version from 29th of December 1993, but on a server linux machine that I am using version of crontab is much better in terms ...