Search code examples
macosbashunixcd

What does cd’s `-@` option do?


So, if I man cd, I get the manpage for bash builtins.

If I cd -?, I get the following:

cd -?
-bash: cd: -?: invalid option
cd: usage: cd [-L|[-P [-e]] [-@]] [dir]

I know what the first two options are. Then I searched for both options.

My system info:

  • OS X 10.9 (Mavericks)
  • bash 4.3.18 (installed with the Homebrew package manager for OS X)

However, if I run which cd, I get /usr/bin/cd. Homebrew doesn’t touch anything outside of /usr/local, so I can only assume this is the system’s cd.

But I can’t find the documentation for that option! It’s driving me crazy.

Does anyone know what -@ does?


Solution

  • It's a new option (as of bash-4.3). The changelog contains the following description:

    'cd' has a new `-@' option to browse a file's extended attributes on systems that support O_XATTR.

    (changelog)

    Type help <name> or man bash to get more info on bash commands. (In the bash man page you can search for cd by typing / followed by a search string and enter. n to go to the next hit, shift+n to go backwards).

    The bash man page contains the following:

    On systems that support it, the -@ option presents the extended attributes associated with a file as a directory.