Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I noticed this several times today. If I type cd ../Directory to change to another directory, it prints "bash: cd: write error: Success". I can't determine what other previous commands might be related to this.

  • typeset -f prints nothing.
  • alias prints nothing.
  • type -a cd prints "cd is a shell builtin".
  • echo $CDPATH prints an empty line.
  • $BASH_VERSION prints "bash: 4.2.37(1)-release: command not found".
  • I only noticed this 2-3 times. The initial directory and target directory were identical in both situations. I changed directories in this manner many other times, but did not encounter the error always.

What could be causing this?

share|improve this question
Please add the output of type -a cd as Glenn requested. –  terdon Feb 22 '14 at 12:56
Please add the output of the type command to your question. Also, does this happen in all directories or only if you are in a specific one(s)? And what is the output of echo $CDPATH? –  terdon Feb 22 '14 at 13:26
What exact bash version (in $BASH_VERSION) are you running? –  Gabe Feb 23 '14 at 0:07
I have bash 4.2.37(1). –  Village Feb 23 '14 at 1:28

2 Answers 2

Your cd command is either an alias or most likely a bash function.

typeset -f  # displays functions
alias       # display aliases

If not found with the above commands which cd will locate the path of the cd command.

Look for the cd alias or function definition in the normal start scripts .bash_profile, .bashrc and .profile.

share|improve this answer
typeset -f, alias, and which cd all return nothing, and the other files only contain PATH=~/.context/tex/texmf-linux/bin/:$PATH. –  Village Feb 22 '14 at 10:33
use type -a cd –  glenn jackman Feb 22 '14 at 11:25
type -a cd prints "cd is a shell builtin". –  Village Feb 22 '14 at 13:02

Maybe a bug?

This sounds like a potential bug. I found a similar report showing the same message. The bug bash: pwd builtin exits with write error: Success.


This message will be displayed if ferror(stdout) returns non-zero. For some reason (probably the fflush() call immediately preceding the check), stdio is causing ferror() to return true without setting errno.

Does this happen twice in a row? The pwd builtin calls clearerr() after printing the error message, so even if the stdout error flag `sticks', that should clear it.

Can't update history?

The error makes me think that it was successful in changing directories, but wasn't able to write the command cd ../Directory to your $HOME/.bash_history. I'd confirm that this file is intact and is writable. Also confirm that your $HOME directory is writable and not full.

$ df -h $HOME
Filesystem                         Size  Used Avail Use% Mounted on
/dev/mapper/fedora_greeneggs-home  402G  157G  225G  42% /home
share|improve this answer
The /home partition has much space available. I cannot find anything strange in ".bash_history", it is set to read and write only for the owner. Whenever I quit a terminal, the data from that terminal still goes there. Is is possible this came up because I was running multiple terminal windows at the same time? –  Village Feb 22 '14 at 14:49
@Village - perhaps, but each time a command is run in a shell it should get a lock on the history file and release when it's done, every other process doing the same would just wait. –  slm Feb 22 '14 at 14:58

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.