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.

My bash shell will no longer change directory with cd. I noticed it earlier when working and found that any new shells I opened (terminal or xterm etc) would be stuck in the home directory and could not get out (already open terminals continued to work fine).

[~]$ pwd
/home/sys/dave
[~]$ cd /
[~]$ cd Documents/
[~]$ pwd
/home/sys/dave
[~]$ type cd
cd is a shell builtin
[~]$ alias
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

I thought it must be some weirdness I didn't have time to deal with such as a handler out of memory (having checked that cd wasn't aliased and using the builtin version).

So I (yes, I know) rebooted the machine.

Fresh boot, exactly the same problem.

CSH on the other hand works fine, so immediately after the snippet above:

[~]$ csh
[~]$ cd /
[/]$ pwd
/
[/]$ cd ~/Documents/
[~/Documents]$ pwd
/home/sys/dave/Documents
[~/Documents]$ 

I haven't installed anything new or performed any updates in the last few days and it was working fine until late this evening.

Ideas/assistance/HELP much appreciated!

** UPDATE **

So digging around I found this line in .bashrc

export PROMPT_COMMAND="cd"

If I unset PROMPT_COMMAND then everything works as normal.

But... WTF. I didn't put this line in the .bashrc and everything was working perfectly until tonight. Should I just comment it out, manually unset it, or just burn the computer as a witch?

share|improve this question

migrated from serverfault.com Mar 6 '13 at 16:57

This question came from our site for professional system and network administrators.

    
OS is CentOS 6.3 Final, Kernel is 2.6.32-279.11.1.el6.x86_64, command-line expansion through tab if I put in a full directory name and type/more etc again if I put in a FQ file path work fine. If that helps. –  Dave C Mar 5 '13 at 22:55
2  
If something on your system recently changed, and you are the only user and you didn't make that change, then perhaps your system has been compromised? –  Zoredache Mar 5 '13 at 23:10

1 Answer 1

up vote 19 down vote accepted

Setting PROMPT_COMMAND to cd is a pretty common prank, if you didn't set it, and you're the only user, then yes, you've been compromised.

If friends have access though, this is a prank I've seen numerous times, talk with them.

share|improve this answer
4  
Or if you're in an environment where you might have left your terminal unlocked. It depends on the corporate culture, but since unlocked terminals are a frowned upon practice, pranking between sysadmins is fairly common. –  Andrew B Mar 6 '13 at 0:22
3  
I think I've been pranked. +1 to my lab colleagues for a Linux prank. -1 to me for leaving the screen unlocked. Don't think I've been compromised, well at least I hope not - everything else looks well. Thanks to all for your answers. –  Dave C Mar 6 '13 at 15:59

Your Answer

 
discard

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.