Mac OS X is a series of Unix-based operating systems and graphical user interfaces developed, marketed, and sold by Apple Inc. Named Darwin, it has a Mach kernel and FreeBSD heritage.
4
votes
1answer
2k views
find & sed (search and replace)
I'm using the following command on my mac:
$find . -name “*.java” -exec sed -i ’s/foo/bar/g’ {} \;
and it seems to have no effect.
I have two files in the directory that end in .java, which both ...
4
votes
2answers
95 views
remove duplicate files
On my Mac OS X 10.6.7, iTunes duplicated every single file in my music library. Now I have 3,840 files instead of 1,920. The problem is that iTunes didn't simply duplicate the whole folder, but each ...
4
votes
2answers
175 views
Zsh: Automatically modify executed command
I've recently installed grc (generic colorizer) to my system via MacPorts, giving me the ability to get colorized output for plenty of commands which by default don't support it (see screenshot ...
4
votes
1answer
170 views
terminal - having “$” instead of MyComputer:~ me$
Right now in my MacOS X terminal I have MyComputer:~ me$ before all the commands.
In some videos I saw they have just $ - that's much less clutter, how is it done?
4
votes
1answer
6k views
How to know when and which user logged into the system under Mac OS X? Last is not enough!
In Mac OS X, if I don't touch it for a while, it will lock the screen and one must use password to unlock it, but this kind of log in is not recorded by last command. I want to know if anybody tried ...
4
votes
1answer
2k views
Sharing Mac Snow Leopard directory via NFS
I am running a Mac Pro using Snow Leopard (not server). I would like to share a directory with a linux machine. I have edited /etc/exports on the Mac to:
/Volumes/mstore/home/sdavis -maproot=root ...
4
votes
3answers
196 views
Best way to work through / display a tree of images sorted by size
I've got a deep directory tree containing .PNG files. I'd like to find all the .PNG files in the directory, sort them in order of size from smallest to largest, and then display every 50th image.
...
4
votes
1answer
93 views
Where does GCC look for its internal executables?
I have installed GCC to a custom prefix. When it is invoked, it complains that it cannot find some of its internal binaries.
My computer's "official" GCC keeps them here:
...
4
votes
3answers
802 views
Grep_color on mac
I am trying to get my regex highlighted on mac using terminal. I have put this is my .profile:
export GREP_COLOR='1;30;40'
Nothing changes, so I added the same to my bash.profile still nothing, ...
4
votes
1answer
106 views
Running an application with alternate/modified system time
I am looking for a way to start an application with an alternate system time than that which is set. Basically one of the beta programs I use has a bug (it really is a bug) that no longer lets it ...
4
votes
2answers
298 views
How to synchronize a networked drive and an external drive (Ubuntu & OS X)?
In light of a recent hardware failure, I've decided that it's time to be a little less lax regarding back-ups.
What I have:
An Ubuntu 10.10 'server/NAS'
A MacBook 5,2
A WD external HDD
The server ...
4
votes
1answer
123 views
I can't ssh on localhost at a certain port on os x
Here are basics information:
$ which ssh
/opt/local/bin/ssh
It's like that because I'm using MacPorts and it did install there.
I did the sudo port load openssh
When doing a netstat -an | grep ...
4
votes
1answer
488 views
Bash history with timestamps
I would like to keep timestamps on the commands logged in my Bash $HISTFILE, is it possible?
I did not manage to set it up using man bash as an information source.
My other options are as follows:
...
4
votes
2answers
567 views
SSH LocalCommand on exit
In ~/.ssh/config you can use the LocalCommand directive to execute a local command whenever you connect to a remote machine via SSH. But how do I execute a command when I exit an SSH connection? It ...
4
votes
1answer
317 views
Can you perform system calls from OSX Terminal?
So I get system calls in the context of a C program, but my textbook doesn't really address making system calls in Terminal (on Mac OSX). Can you do these on the command line like with "commands", or ...
4
votes
1answer
180 views
Icon not showing in applications on OSX
I just re-installed Firefox, but the thumbnail is not showing in the dock applications folder. The icon DOES show both in dock and in finder.
I have tried to re-install Firefox again but without ...
4
votes
1answer
444 views
Printing the current date/time with sub-second precision
GNU date(1) understands the %N format spec, which outputs nanoseconds, so:
$ date +%H:%M:%S.%N
outputs 19:10:03.725196000
BSD date doesn't understand %N. How can I print the current time with ...
4
votes
1answer
227 views
DTrace to trap any chmod applied to certain files
Underneath the Mac OS X directory /audit I have certain files which users can access and chmod to their liking.
I need to audit any chmod done on any files by recording the time, user and file being ...
4
votes
2answers
153 views
FHS differences between OS X, Linux and FreeBSD
I've read that there is a different behavior between FreeBSD and Linux with the /usr/local, in FBSD ports are installed there, in Linux not, can someone explain more on this?
I'd like to know where ...
4
votes
1answer
80 views
Execute multiple bash commands on the output of find
I want to execute some commands using the find -exec option, but I'm not sure what' wrong with this code. Currently, it's only processing the first find result, then getting stuck. I'm using bash in ...
4
votes
4answers
99 views
Restrict search of locate to specific directories
Is there a way to restrict locate output to specific directories on Mac OS X Snow Leopard? I read about using regex on a Ubuntu forum. However, on my mac locate does not accept -r option. I also ...
4
votes
4answers
75 views
Tool to compare files on one disk with registry information on another?
Been a long time since I got very far under the hood in Unix so I'm probably not even using proper terminology when I say 'registry,' but here's the situation.
I have a disk thats dying. Lots of i/o ...
3
votes
2answers
3k views
How can I install the `ll` command on Mac OS X?
I'm using Mac OS X. When I SSH into servers I find the ll command useful, but it's not available on my local machine. How can I install it?
3
votes
2answers
390 views
How to change default “reading” program?
right now when I run man smth or similar less is used to view it. However, on Mac OS X, I really like scrolling with touchpad instead on up/down or page-up/page-down buttons. Is there a way to just ...
3
votes
2answers
327 views
Accessing a remote OSX system from OSX, Linux, Windows
Is it possible to connect to a remote OSX machine using OSX, Linux or Windows in a way similar to Windows' remote desktop?
3
votes
2answers
3k views
Bypass ssh password prompt from a shell script
I've got a shell script that ssh'es into a server using public key authentication and runs a command on that machine. This works fine on machines where the users have installed the public key on the ...
3
votes
2answers
366 views
Total in `ls -l`
When I run ls -l, the following is displayed:
>: ls -l
total 320
-rw-r--r-- 1 foo staff 633 5 Apr 13:23 A.class
-rw-r--r-- 1 foo staff 296 5 Apr 13:24 A.java
...
What does the ...
3
votes
2answers
93 views
Make copies of a single directory to multiple directories with different names
I'm trying to replicate a single directory (with sub-directories) to a bunch of new directories based on a list. For example I can:
mkdir Fred Barney Thelma Louise Foo Bar
How would I copy a premade ...
3
votes
2answers
498 views
On Mac OS X, how to encrypt a small folder and copy that to Google Drive or DropBox?
On Mac OS X, right now I use the following to back up a small project folder to a USB Flash drive:
alias a='alias'
a dateseq='date "+%Y-%m-%d %H:%M:%S"'
a backup_proj='cp -a ~/code/MyProj ...
3
votes
2answers
495 views
Fix or alternative for mktemp in OS X
I'm looking at a bash script someone else wrote that uses mktemp:
TEMP=`mktemp --directory`
However, this line does not work on my machine (OS X 10.6).
How would I fix this line so that it is ...
3
votes
3answers
2k views
Fork bomb on a Mac?
I just learned about a fork bomb, an interesting type of a denial of service attack. Wikipedia (and a few other places) suggest using :(){ :|:& };: on UNIX machines to fork the process an infine ...
3
votes
2answers
1k views
Why isn't my environment variable visible from the command line?
I'm trying to run the James SMTP server on Lion (Mac OS X 10.7.2). When I do this:
sudo JAVA_HOME=/Library/Java/Home ./james-2.3.2/bin/run.sh
it works fine.
However, I'd like to make JAVA_HOME an ...
3
votes
2answers
169 views
How to bind “ß” to Meta-s?
I am using Carbon-Emacs on MacOS X 10.6 with the US-International keyboard layout. Usually, I can use Alt+s to print the letter "ß". However, Emacs interprets this as Meta+s and complains that there ...
3
votes
2answers
2k views
Discovering the number of running and blocked processes in Mac OS X
In Linux, I could discover the number of running and blocked processes running
grep "procs_running" /proc/stat
and
grep "procs_blocked" /proc/stat
Is there a way to do it in Mac OS X? ...
3
votes
2answers
1k views
rsync “skipping non-regular file” when cloning my Aperture library
I am trying to use rsync to maintain a backup copy of my Aperture library. When I run the sync command to see what would happen this is the outcome:
rsync --dry-run -r "/Volumes/Data/Aperture ...
3
votes
1answer
250 views
Verbose DNS query to see DNS query order?
I typically determine the IP of a host by doing: $ host -t A example.com. Is there a more verbose version of this that tells me whats happening in the background, specifically the order of what is ...
3
votes
2answers
685 views
Motd doesn't show up
I'd like to set a custom motd ("message of the day") on my machine (currently Mac OS X 10.6.5 using Bash with Terminal.app).
In /etc/ there was no motd file so I created one with some sample text. ...
3
votes
1answer
462 views
How do I share applications windows between OS X and Linux?
I originally asked this question over on Super User, but I didn't get any answers.
I'm trying to set up Xdmx on my Macbook Pro and my Ubuntu 10.04 workstation so that I can share my MBP's keyboard ...
3
votes
1answer
21 views
stat on an encrypted volume in osx takes a long time
My workstation is a MacBook Pro with an SSD. For security reasons, my main volume is encrypted.
I ran this command on a folder:
time find . -exec stat {} + >/dev/null
real 0m5.205s
user ...
3
votes
1answer
635 views
using terminal (mac os x) to move position of an applications window
An application - AI Writer (http://www.iawriter.com/) - somehow got stuck off screen with only the corner showing. I can't grab it or use other means to move it from that position.
All new windows ...
3
votes
1answer
50 views
Is there a way to integrate the unix “man pages” into OSX's Dictionary app?
I was thinking it would be cool to be able to look things up in the man pages the same way one looks up words with the "Dictionary" app.
Is there a way to add the man pages that OSX supplies into ...
3
votes
3answers
704 views
In Mac OS X Snow Leopard, how can one file's permissions be matched to another?
I need to make the permissions of a file exactly match the permissions of another file in OS X 10.6.
I don't see 'getfacl' or 'setfacl' as suggested in some other posts for Linux. And, it doesn't ...
3
votes
1answer
300 views
Routing Tables: What is the effect of the RTF_IFSCOPE flag?
(Related to this question I posted a while ago on apple.stackexchange.)
What is the difference between the following two routing table entries:
default E.F.G.H UGSc 0 ...
3
votes
1answer
396 views
Connect to Webdav (https) with domain\user
I have a problem trying to connect with our network webdav share on mac osx. I can connect from windows, so it's working. On Mac OSX I have set the routes, and I can connect when using "Transmit" but ...
3
votes
1answer
127 views
On OS X, how do I log in interactively as root starting from my normal user account?
I have been doing this for a while:
sudo su -
but it uses 'sh' rather than 'bash', which is what I'd like to do.
Which command will log me in as root and get me a bash shell even if that's not the ...
3
votes
1answer
488 views
Bind unprivileged application to privileged port on Mac OS X
I'd like to create launchd.plist file for an httpd server. Problem is - when the httpd is run as privileged user it daemonizes, which is not allowed by launchd.plist manual page. If I don't run it as ...
3
votes
2answers
2k views
In OSX ssh-keygen creates a key but then the session won't connect
I made a key, but it logs me back out as i try to setup passphraseless logins to localhost:
$ rsa-keygen -t rsa
$ cat id_rsa.pub > authorized_keys
$ ssh localhost
The authenticity of host ...
3
votes
0answers
125 views
IPFW Port Forwarding
This is my situation: I want to connect to an OpenVPN server from my office (we're using a proxy, only ports 80 and 443 are allowed).
Server IP address is: 176.31.250.232:843
My static IP address ...
3
votes
2answers
209 views
Installing gcc without root?
I'm running OSX, and I don't have root, or an existing compiler. Is there any way I can install gcc?
Are there official or trusted unofficial mach-o binaries that can be downloaded for a certain ...
3
votes
0answers
99 views
Can I get WCHAN from ps on Mac OS X 10.7.4?
From the manual it seems that ps -AO wchan should tell me what everything is sleeping on, but everything comes up as -. (And nwchan as 0). Did they do away with the old sleep()/tsleep() interface in ...
