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)

54
votes
10answers
28k views

How do I know if dd is still working?

I've not used dd all that much, but so far it's not failed me yet. Right now, I've had a dd going for over 12 hours - I'm writing an image back to the disk it came from - and I'm getting a little ...
48
votes
2answers
3k views

Shebang starting with `//`?

I'm confused about following script (hello.go). //usr/bin/env go run $0 $@ ; exit package main import "fmt" func main() { fmt.Printf("hello, world\n") } It can execute. (on MacOS X 10.9.5) $ ...
34
votes
6answers
7k views

Software developer switching from Linux to OS X, what are the gotchas?

I have used Ubuntu/Fedora/Red Hat/Suse but haven't used OS X at all. If I have to start using OS X regularly, what are the things I should look out for? Tools I use are GNU tool chain, C++/Boost, ...
28
votes
6answers
6k views

what does the @ mean in ls -l?

I am using Mac OSX. When I type ls -l I see something like drwxr-xr-x@ 12 xonic staff 408 22 Jun 19:00 . drwxr-xr-x 9 xonic staff 306 22 Jun 19:42 .. -rwxrwxrwx@ 1 xonic staff 6148 25 ...
27
votes
5answers
8k views

Is Mac OS X UNIX?

I have this argument recently saying Mac OS X was not UNIX, but Unix-like. I know there is a Single Unix Specification and those spec complaint could use the UNIX trade mark. Is Mac OS X an UNIX ...
26
votes
1answer
1k views

Why can Shell builtins not be run with capital letters but other commands can?

Why is this? When I do this CD ~/Desktop It doesn't take me to the Desktop. But this: echo "foo bar" | GREP bar gives me: bar
22
votes
3answers
8k views

Where does Mac OS X come from?

Discussing with Mac owners, I got several versions of where Mac OS X comes from. It is known to have some root in BSD, but how much, and where? Some say that Mac OS X has a FreeBSD kernel, with all ...
20
votes
4answers
7k views

What makes OSX programs not runnable on Linux?

I know there are many differences between OSX and Linux, but what makes them so totally different, that makes them fundamentally incompatible?
20
votes
6answers
12k views

How do you create a user with no password?

In os X it's possible to have users without passwords. If you inspect them with dscl their password show up as *. This is used for system users such as users for databases like mysql, pgsql etc. ...
19
votes
3answers
2k views

mv a file to /dev/null breaks dev/null

If I do: touch file; mv file /dev/null as root, /dev/null disappears. ls -lad /dev/null results in no such file or directory. This breaks applications which depend on /dev/null like SSH and can be ...
18
votes
6answers
10k views

Why Mac applications never get “closed”?

I'm a Linux/Windows/Mac user. I like all systems, *nixes more than Windows, but I like all nonethless. I started using a Mac this year, and a difference between Linux and Windows that I can't ...
18
votes
3answers
14k views

Open a RPM on a Mac?

I am on a MacBook Pro running Apple Leopard (Mac OS X 10.5.8). I would like to unpackage a RPM and view the files contained within the wget-1.11.4-2.el5_4.1.src.rpm . I don't need to install the ...
18
votes
5answers
2k views

What is the architecture of Mac OS X's windowing system?

I am familiar with how the X11 system works, where clients connect via a socket to the server process and send operations to the window server to perform certain operations on their behalf. But I do ...
17
votes
4answers
1k views

Finding command execution time in hindsight

I've just executed a long-running process from the bash prompt. In hindsight, I wish I'd run time on it, or noted down the time at which I kicked it off. Is there any way of getting this information ...
16
votes
6answers
21k views

How can I display the contents of a text file on the command line?

I would like to display the contents of a text file on the command line. The file only contains 5-6 characters. Is there an easy way to do this?
16
votes
3answers
6k views

File system compatible with all OSes?

I use Linux and Mac OS X on a regular basis, and sometimes I have to use Windows. I need to use a flash drive on all three, and I need a filesystem that will work well on all of them. None of the ...
15
votes
5answers
7k views

How can I tell what version of OS X I'm on from the command line?

I frequently find myself SSHing into various OS X machines, and it'd be useful if I could tell what version of OS X I was on when I'm doing that. uname -a doesn't quite work, since Darwin kernel ...
15
votes
3answers
564 views

Why don't shell builtins have proper man pages?

All shell builtins share the same manual page: BUILTIN(1) BSD General Commands Manual BUILTIN(1) NAME builtin, ! etc. Then there is a little text describing ...
15
votes
3answers
5k views

How do I configure Emacs to use 'ispell' on Mac OS X?

I'm using brew as my package manager for both Emacs and ispell. I have both installed. Doing a quick google, I was unable to figure out how to tell Emacs where ispell is and to load the appropriate ...
14
votes
4answers
12k 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?
14
votes
8answers
8k views

pgrep and pkill alternatives on mac os x?

Are there alternatives to pgrep and pkill commands on Mac OS X or should I just create aliases for them using other commands available for me?
14
votes
5answers
2k views

Bash in Linux v.s Mac OS

I am buying an iMac. I've been working on Linux for a long time and I do a bunch of bash scripting. I was wondering if all the bash commands and features are available on Mac OS ? Anyone has any ...
14
votes
1answer
2k views

git diff displays colors incorrectly

In order to get coloured output from all git commands, I set the following: git config --global color.ui true However, this produces an output like this for git diff, git log whereas commands ...
13
votes
6answers
2k views

Is there a root password on OS X and Ubuntu?

When you setup a new Ubuntu or OS X installation a user is generally created for you. On OS X it is whatever username you pick. On Ubuntu (the server version) usually the ubuntu user is created. The ...
13
votes
5answers
910 views

How to remove the (1) from filenames using the find command

I recently converted all of my FLAC files to a lower sampling rate of 44.1 kHz and bit depth of 24 bits (because iPhone/iPod don't support anything above that) using XLD on my Mac OS 10.7 (Lion). ...
12
votes
6answers
11k views

How can I page up or down in tmux with Terminal.app?

I have tmux installed. But I can not scroll up or down. I.e. as soon as I tmux I get only a portion of the screen and can not scroll up. crtl-b + Page Up does not work since I am in Mac and I can not ...
12
votes
4answers
2k views

OS X: how to keep the computer from sleeping during a ssh session

When I ssh into a OS X computer on my network the session lasts until the OS X goes into sleep mode. Is there a way to prevent this from happening during my SSH session, apart from physically bumping ...
11
votes
3answers
3k 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 ...
11
votes
3answers
11k views

How to persist ulimit settings in OSX Mavericks?

Before Mavericks, one could use /etc/launchd.conf to persist ulimit settings, for example: limit maxfiles 16384 unlimited limit maxproc 16384 unlimited It no longer works in Mavericks. What is the ...
11
votes
2answers
556 views

How to keep dotfiles system-agnostic?

Due to work I have recently started using OS X and have set it up using homebrew in order to get a similar experience as with Linux. However, there are quite a few differences in their settings. Some ...
11
votes
2answers
3k views

Differences between sed on Mac OSX and other “standard” sed?

I am having some issues in using an answer provided on this site for this question about a sed command to replace a blank line with two other lines of content, and it was brought up if the sed command ...
11
votes
5answers
2k views

Using text from previous commands' output

I know this is not how terminals work, but I find myself often wishing there was an easy way of using text (copying it, modifying it, etc) that is already on my terminal window history from some ...
11
votes
5answers
2k views

Disable Keyboard & Mouse Temporarily

I would like to know how one can disable the keyboard & mouse temporarily in OS X.
10
votes
2answers
884 views

Is it OK to use “.” to run files instead of source - in .bashrc in Ubuntu and OS X?

OK, so source runs the script in the current shell and . separately, as detailed in running script with ". " and with "source " for example, but, specifically, in my .bashrc file, ...
10
votes
9answers
2k views

What features does Darwin have that other Unixes don't, or vice versa?

Does Darwin have any features that are specific to it? Do other Unixe(s) have features that Darwin lacks?
10
votes
3answers
3k views

How can I determine the fs type of my current working directory?

I need a platform-independent and lightweight way of detecting the mount type of my CWD. Specifically, I need to determine if my CWD is in an SSHFS, NFS, CIFS, SMB, or local block store mount. I need ...
9
votes
4answers
2k views

Why would vim return non-zero exit code if I exit immediately after opening?

I'm running into a bit of a strange problem w/ vim on Snow Leopard: I get a non-zero exit code from simply running vim and then quitting. $ vim # exit immediately using :q $ echo $? 1 However, if I ...
9
votes
4answers
3k views

pv for directory copy

I need to copy a very large directory (talking in terabytes here) and want to monitor the progress. I found that pv is a nice utility, but how can I use it for copying directories recursively? (pv ...
9
votes
4answers
5k views

If I connect a physical device, how can I ever know which device file belongs to it?

Say I plug in several USB drives which don't get automatically mounted. How can I find out which device file belongs to which physical device, so I can mount it for example? I'm running Mac OS X but ...
9
votes
1answer
4k views

What does the “@” (at) symbol mean on OSX ls? [duplicate]

When I check permission of less files from the command line on my Snow Leopard OSX system using Bash I see -rw-r--r--@ for certain files and for others I just see -rw-r--r-- What does the @ mean here? ...
9
votes
1answer
5k views

Why the value of VSIZE in top is different from the value of VSZ (Virtual set size) in ps?

I know VSZ in ps is for the total address space allocated for the app and is sometimes aliased as vsize (mentioned in man page of ps on linux), but what's the definition of VSIZE in top? This top ...
8
votes
3answers
896 views

Why are interactive shells on OSX login shells by default?

In Linux and, to my knowledge, all Unix systems, terminal emulators run interactive, non-login shells by default. This means that, for bash, the started shell will: When an interactive shell that ...
8
votes
3answers
2k views

How can I print good looking code

Similar to using markdown on Stack Overflow to create monospace output, how can I do that for my programs. I tried lp filename.txt and was pleasantly please to find that it was able to use the local ...
8
votes
3answers
2k views

Directory size calculation difference

I need to get the size of directory in terminal for signing purposes. I'm using following command: du -s /path/to/dir I'm multiplying the result by traditional UNIX block size (512 bytes) and get ...
8
votes
3answers
3k views

Creating a Bash script that will execute a program and if it exits without crashing, will run it again

I'd like to know the easiest way of creating a bash script that will run an app in MacOSX (it's a UNIX based system so I assumed this was the right place). wait for the program to exit. If the exit ...
8
votes
1answer
8k views

lsof and listening ports

I am trying to get all the processes listening for a network connection on Mac OS X. netstat does not have the -p option and I am trying with lsof lsof -i -sTCP:LISTEN gives me a fair list of ...
8
votes
2answers
496 views

Prevent disk renumbering on reboot in OSX

I have 3 physical drives in my Mac Pro with OSX 10.6.4. Occasionally after rebooting the machine, the disk numbering changes such that the /dev/disk# does not reference the same drive as it did before ...
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
3answers
4k views

Why can't tr read from /dev/urandom on OSX?

A colleague suggested creating a random key via the following command: tr -dc A-Za-z0-9_\!\@\#\$\%\^\&\*\(\)-+= < /dev/urandom | head -c 32 | xargs It gave me the error: tr: Illegal byte ...
7
votes
2answers
410 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 ...