Sometimes the shell mode will get confused as to what the current working directory is (like if you use aliases to move to a new directory, or if you use the conveniences like!$
).M-x dirs
will tell the shell buffer to figure out what the current working directory is.