2

In my csh terminal, when I do:

ls tab -- it shows everything in the current directory as a possibility

cd tab -- it shows only directories in the current directory as a possibility. If no directories exist, in the current directory, it won't list anything

I would like to have cd tab to behave similar to ls tab and show both files & directories. How to do this?

1

That must be tcsh, not csh. For tcsh, you could add this to you ~/.tcshrc:

complete cd p/1/f/
  • I have two addon queries 1). I traced original 'cd' behavior to complete cd p/1/d/in my global/system .cshrc. Now is it possible to undefine this global cshrc's complete command instead of adding complete cd p/1/f/ to my local cshrc? 2). Can you point to any good online resource to explore this complete command of csh? – BluVio May 21 '15 at 5:12
  • @BluVio, the tcsh man page comes to mind. Can't help you much more, I switched from tcsh to zsh decades ago, and I tend to agree with the general opinion that there's no point using (t)csh in this day and age. Also note that tcsh has that directory completion on cd even if you don't source that global config file (unless you start it with -f). – Stéphane Chazelas May 21 '15 at 8:24
  • Thanks. Gone through the tcsh man page and gained a little insight. uncomplete cd is the answer to above my question#1. BTW, strangely (for me) man page says keyword 'f' is for files but it completes both files & directories!! – BluVio May 21 '15 at 9:17
  • @BluVio, a directory is one of many types of files. You've got regular files (probably the ones you're thinking of), devices, directories, fifos, symlinks, sockets, and more depending on the system. The f is for that general meaning of file. – Stéphane Chazelas May 21 '15 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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