The default Unix shell used by Terminal in Mac OS X

learn more… | top users | synonyms

4
votes
3answers
2k views

Is it possible to have bash escape spaces in pwd?

I'd like to copy the current directory to the clipboard, something like: pwd | pbcopy. However, pwd does not escape the space, so something in "Application Support", for example, doesn't copy ...
2
votes
1answer
430 views

This script randomizes a MAC address--but I cannot renew DHCP afterwards

#!/bin/bash NEWMAC=`openssl rand -hex 6 | sed 's/\(..\)/\1:/g; s/.$//'` ifconfig $1 ether $NEWMAC ifconfig $1 down ifconfig $1 up I pass en0 or en1 as the sole argument to the script and run as ...
0
votes
0answers
1k views

using -exec command on mac os x

Does any know why the -exec does not work on mac os x lion terminal? It works on linux and other variants but not on mac os x find / -iname "*.mp3" -exec mv {} /mnt/mp3 \;
4
votes
1answer
363 views

Why does my Terminal command line screw up like this? (bash's fault?)

When I use the command line history ( CtrlR , CtrlP ) The command line screws up like this: The cursor is supposedly located at the end of the line ( just pressed CtrlE ) If I press enter, just ...
3
votes
1answer
364 views

How do I find where an environmental variable got set?

I installed a program to try it out, and decided I didn't like it so I moved the app to the trash. Today, in my shell, I noticed that there are a couple of PROGRAMNAME_BLAHBLAH environmental ...
2
votes
1answer
412 views

bash file recovery?

I think I messed up my bash file /bin/bash when trying to create my first script, it displays a message saying "process completed" and locks my terminal, if I switch to another shell e.g sh, then it's ...
1
vote
4answers
2k views

Executables in /bin and /usr/bin are not found in path

Somehow I can’t execute files in /bin or /usr/bin without providing the full path. This isn’t happening when running from Terminal, but, for example, iTerm can’t run bash (only /bin/bash), OnyX ...
7
votes
2answers
2k views

What is the difference between .bash_profile and .bashrc?

To make an alias for the Terminal in OS X, you can either put the aliases in .bash_profile or .bashrc. What is the difference between the two and why would I choose to put aliases in one and not the ...
3
votes
2answers
321 views

How do I add a flag to an alias?

Is it possible to add a flag to a bash alias you create yourself? e.g. con -a = 'ssh username@server1.domain.com' con -b = 'ssh username@server2.domain.com'
1
vote
2answers
1k views

iTerm2 terminals close immediately with “argpath=login error=No such file or directory”

Whenever I try to open a new terminal window in iTerm, it closes right away after displaying this: ## exec failed ## argpath=login error=No such file or directory Does anyone know what is causing ...
3
votes
2answers
2k 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 ...
1
vote
3answers
339 views

How can I change the default bash look?

My bash is white and black and I would like it to look much more colorful, how do I do that?
1
vote
1answer
310 views

How do I run Octave from a different directory?

I have recently installed Octave, a MATLAB clone, onto the following directory: /Applications/Octave.app/Contents/Resources/bin/octave I want to run it from a shell command prompt from a ...
5
votes
1answer
2k views

Why is a command line change to ~/Library/Preferences/com.apple.LaunchServices.plist not effective immediately?

When the Info window of Finder is used to associate files of a particular type with an application: the preference is effective immediately. When Terminal is used to make a comparable addition ...
1
vote
4answers
973 views

How to obtain Bluetooth ID (OS X)

I need to remotely grab the Bluetooth ID from multiple machines throughout my network. What are the best ways to remotely obtain the Bluetooth ID in OS X?
7
votes
4answers
17k views

How do I execute a bash script that requires root privileges?

I have this script lines from my ISP: sudo bash echo "plugin L2TP.ppp">>/etc/ppp/options echo "l2tpnoipsec">>/etc/ppp/options It works if I paste line by line into Terminal. I want to ...
0
votes
1answer
471 views

Allow the Terminal.app to pass command key based keystrokes to terminal programs

I want to allow programs running in the terminal the ability to interpret the keyboard short cut Cmd + S I have already Remapped the Terminals' default binding of Cmd + S to Ctrl + S via the ...
4
votes
2answers
2k views

How do I make find fail if -exec fails?

When I run this command in the shell (in a non-empty directory): find . -exec invalid_command_here {} \; I get this: find: invalid_command_here: No such file or directory find: ...
1
vote
1answer
172 views

How come compiling my .tex file with my alias is lagging?

I have written an alias in ~/.bashrc to compile my tex files into pdfs. I am sure that ~/.bashrc is sourced. alias p='rm -f *.pdf *.log *.aux;pdflatex *.tex;open *.pdf' However, after I edit my ...
2
votes
2answers
3k views

Is there a Mac equivalent for UDEV folder on linux?

I am writing a script which should backup my Documents folder onto a USB stick. I want the script to be executed every time I connect the USB stick. I found a solution here. But it seems like I can't ...
3
votes
1answer
986 views

Why don't my aliases in .bashrc work?

I have Lion on my Mac Air. I wrote some aliases in ~/.bashrc file, which looks like: # Aliases alias p='pdflatex *.tex;open *.pdf' alias bromine='ssh administrator@bromine.org' I then sourced my ...
4
votes
3answers
396 views

How to search for a file by a hash value with bash script (terminal)?

I am writing a script for Mac OS X Lion 10.7 and I would like to know how I can search for files based on their SHA1 hashes. I would like to search the whole file system for the file(s) I will be ...
5
votes
2answers
904 views

Can sudo use my existing aliases?

How can I let sudo use my existing aliases in my .bash_profile (or .bashrc, .profile …)? For example I want to be able to use ll instead of ls -laGF as sudo.
2
votes
2answers
171 views

Lion Fullscreen Desktop Switching Quirk

I make Java programs, many of which require input from the command line before they actually open a window. When I'm using the Terminal in fullscreen mode and I run java Program, it jumps over to an ...
8
votes
6answers
4k 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 ...
1
vote
1answer
887 views

listing all processes in iOS 5.0.1

How could one go about viewing all the processes in an ssh session to my (jailbroken)iphone? I'm currently able to ssh in, I have bash installed, core utilities installed, shell-cmds package installed ...
2
votes
1answer
852 views

How to use zsh and bash on iTerm2 at the same time?

Zsh is better than bash(obviously), but for some reason, from time to time I have to use bash. I am wondering is there any way for me to use them together without changeing them manually? What I ...
0
votes
1answer
700 views

What is the Apple_PubSub_Socket_Render environment variable for?

After running: env ; #from with in terminal I see the following output: ... Apple_PubSub_Socket_Render=/tmp/launch-pc2V6P/Render ... What is this environment variable used for? Not really ...
6
votes
1answer
11k views

Why must I source .bashrc every time I open terminal for aliases to work?

I added this line into my ~/.bashrc file. alias myserver='ssh davidfaux@davidfaux.com' However, when I open terminal and run myserver, terminal complains that -bash: myserver: command not found ...
3
votes
1answer
351 views

Screencapture Terminal command and then return to Shell script

I'm trying to run a shell script wherein I run the screencapture command, do a couple of modifications like file renaming, moving to Dropbox, shortening the url etc and then growling the url. Problem ...
2
votes
2answers
1k views

Creating wrapper script for Mail.app to send mail from Terminal

I'm trying to send mail from terminal with the help of bash and applescript. I use bash for taking care of arguments and the email message body. Then I have tried using Applescript to send the mail ...
1
vote
1answer
1k views

How to change bash version with homebrew

I have used homebrew to install the newest version of bash on my local system. I have added a symbolic link from: /usr/local/bin/bash to /usr/local/Cellar/bash/4.2.20/bin/bash and added the line: ...
7
votes
2answers
3k 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.
0
votes
3answers
277 views

Why does Terminal ignore capital “B”?

this happens to me from time to time: when I am using the Terminal, suddenly the terminal starting to ignore the capital 'B', regular 'b' works fine, other capital letter work fine. other applications ...
1
vote
1answer
689 views

Run a Cocoa application on Lion as another user

I'm trying to run an application as the user 'steve' with the window displayed on my desktop ( brendan ). This is what I have been doing so far. sudo -u steve open -a /Path/To/MyApplication.app ...
2
votes
4answers
781 views

List the extensions installed in Safari for Mac OS X, and state whether each one is enabled

I'd like a list, from which text can be copied. (Not a screenshot of preferences.) This information does not appear in any of the following: Safari System Profiler in Snow Leopard System ...
2
votes
2answers
1k views

Why does iterm2 close new sessions immediately?

I've made some changes to my .bashrc file in my new MacBook, mainly aliases for common commands. Shortly after, iterm2 immediately closes every new session or tab with the following cryptic message: ...
1
vote
3answers
1k views

How can I create a folder named like the current date in bash

So I'm messing around in my .bashrc making different aliases and playing with my prompt. I'm trying now to make an alias that will move into a specific directory, make a new directory based on the ...
2
votes
1answer
236 views

Long command in terminal.app cause a bug

If I am in the last line of Terminal.app and enter a long command, it does not create new line, but instead overwrites the same line. How can I solve this bug?
1
vote
1answer
485 views

Bash problem Mac OS Terminal

Hi when I pressed the up arrow to see the previous command, it rewrote the current command from half. Example: 21 /usr/local/sphinx/etc > /usr/local/sphinx/bin/search --config ...
5
votes
2answers
643 views

Strange behavior in Terminal with custom .bash_profile

It's hard to describe the behavior, but here's a short clip: http://www.youtube.com/watch?v=9KqHBA94FPI Basically, when entering multi-line commands, at the end of the first line, the insertion ...
4
votes
3answers
949 views

Bash script to toggle wifi in lion

Is it possible to have a bash script that toggle my wifi on and off? I am using lion (10.7.2).
2
votes
3answers
4k views

/bin/sh: rm: command not found

I have problems with some applications that use AppleScript shell script feature. For example, Growl's uninstall scripts shows an error: error "/bin/sh: rm: command not found" number 127 The source ...
5
votes
2answers
672 views

Smarter Bash Tab Completion

As a recent switcher from Ubuntu (Well recent switch backer if that's a word) I'm finding myself in the command line a lot more than when I was a mac user before. One thing I really loved about Ubuntu ...
9
votes
2answers
4k views

How do I reset the scrollback in the terminal via a shell command?

When using Terminal.app, you can clear the screen by using the shell builtin clear or by pressing ^+L (Control-L). However, all this does is push the current screen content back one screen height ...
4
votes
1answer
738 views

Accented characters and terminal redirection

I'm having problems dealing with accented characters in file names in the Terminal. Consider the following: $ touch leão.png $ ls > test.txt $ open -a TextWrangler test.txt The accented ...
2
votes
2answers
3k views

How can I exit “bash”?

I don't know how to get my .profile aliases back in to the terminal every time I try them, this error massage comes up: apaw:~ apaw$ cdp -bash: cdp: command not found How do i exit this -bash? I ...
3
votes
2answers
235 views

what is DELUXE-USR-LOCAL-BIN-INSERT in ~/.profile file?

My .profile file includes the following obscure lines. What are they for? ## # DELUXE-USR-LOCAL-BIN-INSERT # (do not remove this comment) ##
0
votes
2answers
3k views

How do I use arguments together with bash aliases

Today, I learned the very handy trick: man [some command] -t | open -f -a Preview I'd like to create an alias in my .bash_profile file as a shortcut. In order for this to work, I need to pass an ...
1
vote
2answers
512 views

What changes have been made to bash in Lion?

I am working on some bash shell scripting for a local login script and it works fine on Leopard and Snow Leopard but fails on Lion. I was curious if there was a place that listed the differences in ...