Questions about the command line and other Unix-like aspects of Mac OS X, including the Mach/BSD-based kernel and FreeBSD-based userland. You may want to consider using Ask Different instead.

learn more… | top users | synonyms (1)

7
votes
4answers
4k views

sed on OSX insert at a certain line

So I've been using 'sed' on linux for a while, but have had a bit of difficulty trying to use it on OSX since 'POSIX sed' and 'GNU sed' have so many little differences. Currently I'm struggling with ...
7
votes
2answers
414 views

Does OS X have its own line format?

Obviously there are at least two newline types: DOS and Unix. But does OS X have its own plaintext 'format'? I opened a text file in nano and was surprised to see: [ Read 26793 lines (Converted from ...
7
votes
3answers
495 views

How to permanently change both STDOUT and STDERR color to grey?

This question is similar to Can I configure my shell to print STDERR and STDOUT in different colors? But I am looking for a solution that will allow me to change both STDOUT and STDERR to ONE color. ...
7
votes
3answers
2k 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, ...
7
votes
1answer
3k views

Setting vim filetype with modeline not working as expected

As per the accepted answer to this question, I'm attempting to use modelines in vim to force filetype detection in some files. For example, at the top of a file named gitconfig (note there is no ...
7
votes
4answers
5k views

Mac OS X: dircolors not found?

I just switched to a Macbook Air. I installed zsh using homebrew, but when I use some of the code that I (originally had) in my .zshrc, I get an error saying that .dircolors was not found. Below is ...
7
votes
2answers
693 views

How to use the SVN CLI effectively

How can I make myself more productive with the SVN CLI? I need to complete repetitive tasks like these: find modified files in directory commit only SOME of them selecting them somehow other then ...
7
votes
4answers
3k views

Is there something like wine to run OSX apps on linux?

This question answers why Linux can't run OSX apps, but is there some application similar to Wine that allows one to do so?
7
votes
1answer
2k 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: ...
7
votes
2answers
236 views

Hibernate and security considerations

How do Linux and OSX handle sensitive memory pages (e.g. cryptographic keys) when running OS is suspended to disk? If the memory image written is encrypted, how are its keys handled?
7
votes
2answers
163 views

How do I only undo pasted text in vim?

TL;DR; version - How do I undo text that was pasted in from my OS copy buffer without undoing other text that was typed in since I went into insert mode? Longer description: Put something in your ...
7
votes
2answers
351 views

Bash inside Vim not working properly

In MacVim I'm using Conque to run bash commands inside Vim. I have a problem with the text navigation while using Conque. If I'm at the end of a line of text and press down Alt← I skip a word to the ...
7
votes
1answer
695 views

Screen cuts off beginning of long command when accessed through bash history

I'm using the default versions of bash and screen in OS X Lion. When I'm in a screen session and I scroll back through the bash history and I come to a command that is long enough to wrap. I might ...
7
votes
1answer
283 views

in zsh, how do I hide the backslashes in the completion menu

On Mac OS X 10.6, zsh. I have set in .zshrc: setopt automenu …to get a completion menu below the prompt. When I type: cd <TAB> I see a completion menu with all directories that have spaces ...
6
votes
5answers
4k views

How to copy all html files from a directory tree to a single directory?

I want to copy all the .html files in myDir and its subdirectories to ~/otherDir. Here's what I tried (it doesn't work): $ find myDir -name *.html -print | xargs -0 cp ~/otherDir usage: cp [-R [-H | ...
6
votes
5answers
2k views

How to make bash put prompt on a new line after cat command?

What I get: host:~ user$ cat example.txt some texthost:~ stas$ What I want to get: host:~ user$ cat example.txt some text host:~ stas$ Is there a way I can make cat behave like this? I'm using ...
6
votes
2answers
53k views

How to install apt-get or YUM on Mac OS X

I am new to Mac OS command line, I want to use either of apt-get or yum. Can anyone help me to install them and make them successful running?
6
votes
1answer
6k views

+ or @ mark after running 'ls -al'

In Mac OS X, run 'ls -al' gives me something like this. drwxrwxrwx+ 4 smcho staff 136 May 5 09:18 Public drwxr-xr-x+ 6 smcho staff 204 Feb 1 2010 Sites drwxrwxrwx 9 smcho staff ...
6
votes
2answers
2k views

Which is the best practice when replacing a system binary?

I'm working on Mac OS X which is shipped with several binaries mostly located in /usr/bin/ and /usr/sbin/. Since it doesn't have a native package manager like some Linux distros, I got used to ...
6
votes
1answer
4k views

Stuck process: is it a bad sign?

Sometimes a few process are in a stuck state. For example: PID COMMAND %CPU TIME #TH #WQ #POR #MREGS RPRVT RSHRD RSIZE VPRVT VSIZE PGRP PPID STATE 99357 plugin-container ...
6
votes
2answers
1k 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 ...
6
votes
1answer
3k views

Calculate the date from 1125 days ago on non-GNU systems?

On the Unix Bash commandline, I want to calculate the date from 1125 days ago using the base operating system (e.g. No Perl or Python). On systems running GNU Date, I can do something like this: ...
6
votes
2answers
311 views

Why do some applications stop working when permissions are changed in /usr/bin?

On OS X, a friend of mine changed the permissions on /usr/bin recursively using Finder, in order to grand write access to everyone. Here is how it's done: Go to /usr/bin in Finder, then mess with ...
6
votes
2answers
690 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 ...
6
votes
2answers
381 views

Why wouldn't a symlink to a symlink work?

I've run into a weird issue when installing SWI-Prolog using homebrew on my OSX 10.9 box. I'm trying to debug it to figure out whose bug it is (SWI-Prolog's, homebrew's, or OSX's), so I can report it ...
5
votes
2answers
1k views

How similar is Apple's terminal.app to a bash terminal on Linux?

I know that Apple's Terminal.app provides a bash shell. Are there any differences between this and a bash on Linux?
5
votes
3answers
5k views

How to cd to a Windows file share?

At work, I spend a lot of time manipulating files on a networked computer that's running SME Server (but that's set up for Windows filesharing, if that somehow makes a difference). I have been ...
5
votes
2answers
1k views

How can I get the tac command on OS X?

I like to use tac to reverse the output of cat. However, it's not available in the Mavericks terminal. I tried to find it on MacPorts and again it's not available. Can anyone please show me how to get ...
5
votes
3answers
534 views

Any tips for surviving Terminal.app?

I've recently switched to using a Mac full-time, and am having trouble getting used to Terminal.app after years of loving gnome-terminal. I miss having URLs show up underlined, using alt+arrow to ...
5
votes
1answer
1k views

What is equivalent to Mac's purge in Linux?

In Mac I use purge to free up some memory. What is equivalent to it in Linux(Ubuntu Server)? apt-get install purge gave me nothing. If you are no familiar with Mac's purge here is it's man page: ...
5
votes
2answers
151 views

run perl script with unknown perl location

I'm developing a perl script which expected to be downloaded by Mac users with a very small knowledge of shell, linux etc, let's say office managers and accountants. After the downloading the script ...
5
votes
2answers
350 views

Prevent a file from being deleted even after rm -f

I usually stay on StackOverflow but I think on this topic you guys are much more experts here. So today's exercise is weird, I have to write a script.sh and in it do whatever I can to prevent ...
5
votes
1answer
1k views

Where to install applications

I'm a long-time Windows user in the middle of a multi-year personal migration to Linux-based development. On Windows when I installed an application it got put in the Program Files folder and I'd ...
5
votes
2answers
403 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 ...
5
votes
2answers
341 views

Why does du report a size of 0 for some non-empty files on a HFS+ partition?

What is the explanation for the difference: $ ls -l /Applications/Safari.app/Contents/Info.plist -rw-r--r-- 1 root wheel 15730 11 jui 15:02 /Applications/Safari.app/Contents/Info.plist $ du -sh ...
5
votes
2answers
1k views

What should I be aware of when installing Linux on a Mac?

I have a Macbook Pro and I am loving it, though I still miss my Linux box, there are many things I need which are not completely compatible with Mac OS X. I heard many stories about installing Linux ...
5
votes
2answers
3k views

Spaces as line breaks from inline for loop command

Someone care to enlighten me as to why the spaces in the first command seem to be interpreted as line breaks? Also occurs substituting print for echo. $for l in $( find *.txt -exec head -1 {} \; ); ...
5
votes
2answers
962 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 ...
5
votes
2answers
310 views

Is it possible to record audio directly to a computer's optical drive?

There's a question over at audio.SE at the moment and I thought it may attract some answers here. I asked the user and he's happy to have it posted here to see if anyone has some ideas. Here it is ...
5
votes
3answers
292 views

Mac OS X find/grep generating “unknown --devices option”

I am entering a command I have done often with Linux, Unix perfectly fine but with Apple Mac OS X 10.8 (and probably before) I get a grep: unknown --devices option when I attempt to run the following ...
5
votes
1answer
3k views

Does Windows recognize Linux's symbolic links?

I was just wondering how a Windows system handles symbolic links. My best guess is that it will not recognize them, but I'm not entirely sure. Also, what do Macs do when confronted by one?
5
votes
1answer
610 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 ...
5
votes
1answer
370 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 ...
5
votes
4answers
5k views

How to use ifconfig to show active interface only

By default ifconfig will show me all available interfaces , but what if I just want to display active ones? Like, en0 only in below. en0: ...
5
votes
1answer
535 views

How can I search/browse in some process's memory?

I'm using MacOS X 10.7 and I'm not very familiar with unix. Is there a command for a search in some process's memory for a string?
5
votes
1answer
490 views

Explain to a Linux user how do BSD/OSX drivers work

Linux drivers come in a form of kernel modules (*.ko files), which can be given parameters when loaded into the kernel and usually live in /lib/modules/<kernel version>. What's the similar ...
5
votes
1answer
226 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 ...
5
votes
1answer
360 views

How to create yaboot partition using a ppc Mac

My computer g4 1.5 ghz PowerBook ppc I need to use this computer to make a yaboot partition on a USB stick. Here is documentation for making a yaboot partition with a Linux machine: ...
5
votes
1answer
67 views

How do folder name localizations work?

In Mac OS X, there are directories like Desktop, Users and Library. On localized systems, these would be named Skrivbord, Användare and Bibliotek (Swedish) But when I am in the terminal I can't ...
4
votes
5answers
785 views

If Mac OS X is UNIX, why is it that it is not open sourced and the license is proprietary?

If Mac OS X is a Unix, as answered in this question, why is it that it is not open sourced and the license is proprietary, as stated in this Wikipedia article? According the the genealogy from this ...