The default Unix shell used by Terminal in Mac OS X

learn more… | top users | synonyms

9
votes
2answers
4k views

Make ls command sort by file type (e.g. directories and file extension)

How do I make ls sort by file type (e.g. directories first and then by file extension)? The answers suggested in (Super User) Make ls sort by file type result in unknown option errors from ls.
1
vote
4answers
90 views

Quote a filename in a script passed to chmod?

I'm having trouble quoting a filename that's eventually passed to chmod. The script was originally written for SSH's StrictModes and authorized_keys, but I had to expand it due to a bad UMASK that ...
1
vote
1answer
27 views

No commands installed from pip work in Terminal

I've been learning python and tried to install pep8, restviewer and other command line apps but when i try to run them, it shows a command not found error. -bash: restview: command not found I've ...
0
votes
0answers
53 views

.bash_profile is not working unless sourcing it manually

I got a new machine (yosemite osx), and I am trying to set it up. I have created .bash_profile, but unfortunately it doesn't work. Even if I log back in or restart the machine, and open terminal ...
5
votes
1answer
746 views

Can an alias be added to the dock via the command line?

I found this article but it handles the GUI solution. I would like to automate the setup of a new machine, and do that I've created Dropbox shares of a number of my common configurations. (I could ...
3
votes
5answers
845 views

Make shortcuts to directories via terminal

My problem is: whenever I'm coding, I work inside folders that are inside other folders and it's a long way to type: cd /folder1/folder2/.../folderN I know it's possible to make a shortcut to the ...
0
votes
0answers
14 views

Enable remote management remotely on a mac

I am trying to use remote desktop to send a script to all Macs on my network that creates an additional admin account and hides it. I am trying to do this using Apple Remote Desktop. However most of ...
7
votes
5answers
189 views

How to create an OSX Application to wrap a call to a shell script?

My goal is to include in a zip file what amounts to a shortcut, instead of telling my customer(s) to open up Terminal and run a shell script. My deployable essentially looks like this: $ unzip ...
0
votes
2answers
22 views

Adding Gradle to PATH

I am trying to add Gradle to my PATH. I have used the command export PATH=/myUsername/Applications/gradle-2.6/bin:$PATH but when I type gradle I get an error "command not found." So I went to ...
3
votes
3answers
4k views

How to make bash (Terminal.app) remember history of previous sessions?

In my computer at work, my bash shell remembers history from previous sessions, even if I just opened a new terminal. In my computer at home, this doesn't happen. I have the same OS 10.6.8 in both ...
3
votes
1answer
60 views

Why does this cause Mac OSX to print over SSH?

While screwing around and breaking things I came across these stupid commands (if executed in order it causes what I got): cd / && cat vmlinuz cd /boot/ && cat init* It causes ...
0
votes
0answers
22 views

Protect changes to plain text file written by standard user's execution of bash script

I have written a simple bash script that I want to use as a time clock for employees (work-studies) in my computer lab. The script works great. 1. Each work-study has two icons (two separate bash ...
15
votes
3answers
34k views

Using terminal to get current fan speed?

I would like to view the current fan speeds of my MacBook and iMac using terminal. I've found that running spindump then cat /tmp/spindump.txt | grep "Fan speed" will show it, but that's very slow and ...
0
votes
0answers
8 views

Bash Script to Login to server and copy a folder to local drive

I have created a nice netboot image that I use to fix computers that misbehave. Reformatting them and restoring from this solves problems for us all time and has proven to be a remarkably efficient ...
2
votes
3answers
53 views

bash completion in terminal - files vs folders

I just recently started out with MacOS, but there one some strange completion behaviour with the bash shell (compared to OpenSuse Linux with tcsh where I come from) that is bugging me: For example, ...
1
vote
1answer
40 views

Why is there a left bracket before my bash prompt?

I've notice that after I execute commands, a left bracket character will appear before the previous line. It seems to be partially dependent on what's in $PS1. I've tried unsetting $PROMPT_COMMAND and ...
0
votes
0answers
23 views

How to turn off bash_profile from automatically opening when opening Terminal?

I recently changed the ownership of the .bash_profile file from root to MyUsername. Since then, when I start/open Terminal, the bash_profile file automatically opens too. To disable it from doing ...
0
votes
2answers
1k views

Launchd unloading LaunchDaemon

I have a script scheduled to run as LaunchDaemon. Script runs fine when launched manually through terminal. I have two commands sudo launchctl unload -F /Library/LaunchDaemons/com.test.plist sudo ...
0
votes
0answers
39 views

Conditional lsof loop in bash script

I found this example of a conditional lsof loop and want to adapt it to my situation. typeset fSrc="/path/to/sourcedir" typeset fTgt="/path/to/targetdir" while : ; do ls /path/to/sourcedir | ...
2
votes
1answer
52 views

Bash script with lock folder problems for large files

My script is: #!/bin/bash # Path to a lock folder LOCK_PATH="/Volumes/PROOFS_WATCH/copy.lock" trap 'rmdir "$LOCK_PATH"; exit' 1 6 15 if mkdir "$LOCK_PATH"; then echo "Lock file did not ...
0
votes
2answers
57 views

Shell command to count pages in a PDF (other than pdftk)?

I have been using this to get a page count of PDFs in shell scripts in OS X: pdftk "$i" dump_data | grep NumberOfPages | awk '{print $2}' | tr -dc '[0-9]' (where $i is the PDF filename) However, ...
1
vote
1answer
95 views

Bash script - Delay cp command until after file write is complete

cp /Folder1/*.mov /Folder2/ cp /Folder1/*.mov /Folder3 rm /Folder1/*.mov This runs every 60 seconds using Chron that copies any *.mov file from one folder to 2 other folders and then removes the ...
1
vote
0answers
43 views

Mac Terminal (+bash +tmux +set-o vi) missing characters at end of line

Often when editing a historical bash command in vi mode (after pressing ↑), and then moving backwards in the text using b. When I begin editing the text after pressing i or a, the extra text I insert ...
0
votes
1answer
54 views

How to create a 'Sharing Only' account via terminal in OS X?

I'm attempting to create a 'Sharing Only' account in an OS X app. I've tried code based on examples like these: Can user accounts be managed via the command line? What steps are needed to create a ...
1
vote
2answers
29 views

Formatting 'defaults domains' output on multiple lines

Just a quick question here. I'm trying to format the output of the command: defaults domains so that it puts each domain on a new line, so I can use that parsed output in a different command. I've ...
3
votes
1answer
43 views

Running shell scripts in single-user mode

I'm planning on running a couple of scripts in single-user mode to speed up (and simplify for less savvy users than myself) the configuring of a few aspects of some Macs that I set up for other ...
3
votes
1answer
45 views

Put Back from trash from Terminal

I sent a lot of files and directories from an external hard drive into the trash by mistake. All those files and directories had the same grandfather directory but not the same father directory. I can ...
0
votes
0answers
18 views

How to undo a $PATH variable change? [duplicate]

Is it possible to undo a change to the $PATH variable on OS X Yosemite? I was trying to add to the $PATH and accidentally changed the entire thing to one path. I just need to know if I can undo this ...
25
votes
5answers
4k views

Did `man ls > temp.txt`. Output textfile is corrupted

When I execute man ls > temp.txt the output text file is corrupted. By corrupted I mean that first and last letters in some words are overly repeated. Several first lines in temp.txt: LS(1) ...
2
votes
1answer
162 views

Changing MAC Address and undoing changes

I was trying to change my MAC address. I saw an answer that suggested I disassociate my device with this: sudo /System/Library/PrivateFrameworks/Apple80211.framework/Resources/airport -z sudo ...
0
votes
2answers
176 views

Update bash to version 4.0 on OSX

Is it possible to actually update bash to version 4.0 in OSX Yosemite? echo $BASH_VERSION 3.2.57(1)-release This article and this thread refer to the same question, but they install a new shell ...
4
votes
2answers
193 views

How can I display contents of trash using terminal?

How can I display contents of trash using terminal?
3
votes
1answer
43 views

Permanently saving changes to $PATH [duplicate]

I have ruby and homebrew running for a while and I'm starting to play with Bash. I have encountered a problem with my PATH variable as echo'd: ...
0
votes
2answers
44 views

Dock shortcut for an interactive bash script

I'm new to OSX and all I want it an application shortcut in Dock that opens the terminal and types the first command and waits for me to provide the password. Here is the script I want to run: ...
2
votes
0answers
20 views

Terminal: disable printing/output of keyboard commands

I have the same problem as this person – I am running a C script and somehow when I pass the EOF signal with Ctrl+D, ^D gets printed to the console. My question is therefore: is it possible to ...
11
votes
7answers
8k views

sourcing bash profile for root users

Apologies in advance if this question is going to annoy the hell out of everyone as I appreciate, it's been asked in various ways many times before. Please be assured, I have read the archives and ...
0
votes
0answers
40 views

Mac doesn't recognise simple commands like 'ls'

I installed Apache and tried to change the permissions for one of Apache's working directories. After that my machine keeps changing the default path. I can't access the simple commands unless I set ...
1
vote
3answers
125 views

To give STDIN for Sed?

Pseudocommand echo '1,2,3,5' | sed -n data.txt which gives sed: 1: "data.txt": extra characters at the end of d command I want to give linenumbers for search from other command. Actually awk ...
0
votes
0answers
28 views

using FISH shell — set default folder for multiple tabs?

I'm using fish shell in OS X. Using the standard bash shell, you can open multiple tabs in Terminal, cd to a different directory in each, and then save the setup as a Window Group (via Window > ...
0
votes
0answers
57 views

Stealthy Mac, Disabling network services on OS X (Non-Server)

I have written a bash script to harden OS X Security and be as stealthy as possible. The script: Disable bonjour Start firewall and block all non-essentials incoming traffic Enable Stealth Mode to ...
2
votes
2answers
618 views

Bash not running script at /opt/local/etc/bash_completion.d/

I wanted to have bash autocompletion for git commands, so I dropped a bash script file into /opt/local/etc/bash_completion.d/. When I open a new Terminal, the script file in ...
2
votes
1answer
5k views

iTerm colors for Prompt, Command, and Output

Right now my iTerm2 looks like this... Everything is the same color and is hard to read. Can I make any of the Prompt, Command, and Output different colors like this?
0
votes
1answer
187 views

OS X 10.10.4 Yosemite, has the default PATH changed?

Today I had to configure a new macbook, running 10.10.3 out of the box and immediately upgraded to 10.10.4. After installing homebrew I went to configure the default PATH, and opened /etc/paths. I ...
1
vote
0answers
23 views

In bash script, how to have a script that runs in the background and starts when an application is opened

I'm making a script which should run when I open Safari. I want it to open when the user logs in and run in the background, then have part of the script to run when Safari opens. Is this possible in ...
1
vote
1answer
76 views

Turn Wifi off/on with a single key?

Is there a way to assign the WiFi on/off function to one of the function keys like F4 that I otherwise never use? I assume Applescript would be required. However I may want to use a BASH script ...
0
votes
0answers
35 views

Nano: how to obtain syntax highlighting?

I have a default installation of nano under /usr/bin/, and I am trying to make nano highlight the bash scripting language code. I have been searching around, but I had no success: I got always some ...
0
votes
1answer
45 views

Enable Web Inspector in Safari v 8.0 in Yosemite OS

I'm trying to show/hide the web inspector tool in mac os "Yosemite" using bash script, I used the following command in terminal but it didn't work even after I restarted Safari, so am I doing ...
0
votes
0answers
46 views

Show Google Search in Address Bar in Safari v8.0 in OS Yosemit

I'm trying to show/hide google search in Safari v8.0 in mac os "Yosemite" using bash script, I used the following command in terminal but it didn't work even after I restarted Safari, so am I doing ...
1
vote
1answer
28 views

How to hide favourites bar in mac os using bash script?

I'm trying to disable and enable the favourite bar in mac os "Yosemite" using bash script, I used the following command in terminal but it didn't work even after I restarted Safari, so am I doing ...
0
votes
0answers
20 views

AppleScript and Configurator

I have written a bash script to modify a mobileconfig file (iOS profile in a xml-plist format) as per this link and I am now in the process where I would like to interact with Configurator via ...