LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   rules for terminal are too strict.Is there any alternative? (https://www.linuxquestions.org/questions/linux-newbie-8/rules-for-terminal-are-too-strict-is-there-any-alternative-708504/)

sumeet inani 03-02-2009 12:38 AM

rules for terminal are too strict.Is there any alternative?
 
Hello,
I am using openSUSE 10.3.when i use the terminal to copy file,change directory etc.I find that If the name begins with capital letter and I write a small one then there is an error.In DOS you can write first few letters(case insignificant) of folder.Is there a way to ask terminal to ignore the case.

jschiwal 03-02-2009 12:42 AM

Linux filesystems are case sensitive.
You can use auto completition to reduce the amount of typing.

billymayday 03-02-2009 12:43 AM

Nix's are case sensitive, so I doubt it. It is perfectly valid to have two files called "Test" and "test", and they are different files.

sumeet inani 03-02-2009 01:22 AM

To jschiwal,
What is auto competition.
To billymayday,
You mean i have to remember the case of file and name.Is there a way so that terminal can suggest file & folder name while I type irrespective of the case.

r3sistance 03-02-2009 01:29 AM

Hit Tab for it to complete the word as far as possible, double hit tab to show all possible suggestions based on what is currently writen, used for when you are writing paths.

billymayday 03-02-2009 01:33 AM

He meant "auto completion", which is where you can press "tab" part way though typing a command and the terminal will attempt to complete the typing for you. Try it.

Yes, I think you need to remember the case of the file.

jschiwal 03-02-2009 05:40 AM

You can enable cdspell to correct small errors in the spelling of the directories in the cd command. Also look at `^-r' which allows you to type just a few characters of a previous command to select it from the history buffer.

---

Thanks, billymayday. I fixed the typo.

sumeet inani 03-03-2009 11:54 PM

Am I right ?
 
to jschiwal,
I came to know that

To enable cdspell in your Bash, give following command:
#shopt –S cdspell
Your command interpreter is ready to check and correct spelling errors in change directory command.

I will try this.

i92guboj 03-04-2009 12:22 AM

It really can be implemented at application level, so it's up to the shell. This is what wine does, for example. I have no idea if bash, ksh, zsh or any other can do what you do in a convenient way. BUT (and it's a big BUT) don't complain later if the rest of the applications break for odd reasons related to the case of the file names. Remember that, at the underlying level, "TEST " and "test" will be two different files, and that can create confusion and lots of headaches. Also, note that even if you manager to implement this at shell level, that doesn't mean a thing about the rest of your applications.

I -for one- wouldn't do such a thing when running as root (you can really mess up your system and break things if you go arbitrarily naming important system files in a wrong way).

Last, but not least, linux is really a case sensitive system from the root, I'd just learn to live with it. I fail to see the problem. If your concern is that sometimes you are confused because you end with duplicate files like "TEST", "test" and "Test", you should know that faking up your shell is not going to fix that at all. For that you would need to change the filesystem drivers.

billymayday 03-04-2009 01:48 AM

Quote:

Originally Posted by i92guboj (Post 3464175)
Last, but not least, linux is really a case sensitive system from the root, I'd just learn to live with it. I fail to see the problem. If your concern is that sometimes you are confused because you end with duplicate files like "TEST", "test" and "Test", you should know that faking up your shell is not going to fix that at all. For that you would need to change the filesystem drivers.

Well put

sumeet inani 03-04-2009 10:36 PM

I just meant that if I write doa and there is a file named DOA then on pressing tab written letters should change to UPPER case and if there is file named Doa then another tab should change written letters to Doa like it happens in DOS.But now I know linux terminal different from DOS so no problem.
Thanks for suggesting spellcheck feature.

frieza 03-04-2009 10:45 PM

another good shortcut to experiment
try typing 'history' at the shell prompt
you should see an output like thus
Code:

  17  cat smb.conf
  18  ls
  19  kwrite smb.conf
  20  ls
  21  cat smbusers
  22  ls
  23  kwrite smb.conf
  24  fdisk -l
  25  mount /dev/sde1 /mnt/drive
  26  mount /dev/sde1 /mnt/drive
  27  mount /dev/sde1 /mnt/drive
  28  apt-get install ntfs-3g
  29  mount /dev/sde1 /mnt/drive
  30  cd /mnt/drive
  31  ls
  32  cp -rv World* /root/.wine/drive_c/program_files
  33  ls
  34  cd

it shows a history of the last 1000 or so commands you have used , if you want to use one of those commands again without having to type it all over again just type !# where # is the corresponding number in the history list for instance i see
[code]
27 mount /dev/sde1 /mnt/drive
[code]
you could re-issue that command by typing !27 at the prompt
try doing THAT in dos :p

i92guboj 03-04-2009 11:05 PM

Quote:

Originally Posted by frieza (Post 3465305)
try doing THAT in dos :p

It was actually easy to do the same, if you knew how to properly use doskey.exe. It wasn't quite as powerful as the linux shells history, but it was enough for the basic procedure that you describe.


Quote:

Originally Posted by sumeet inani (Post 3465297)
I just meant that if I write doa and there is a file named DOA then on pressing tab written letters should change to UPPER case and if there is file named Doa then another tab should change written letters to Doa like it happens in DOS.But now I know linux terminal different from DOS so no problem.
Thanks for suggesting spellcheck feature.

Mmm, so all you wanted was a more flexible autocompletion feature. Now that I think that could be done by putting this line in your ~/.inputrc file (as long as your shell supports readline (bash do and most distros will have that feature compiled into bash).

Code:

set completion-ignore-case On

Then open a new bash session and try it. If you have a dir called TMP and you write cd tm[tab] it should autocomplete just fine AND adjust the part that has already been written to match the true name of the file or directory, as long as there no other match. If there're many matches it will do nothing but if you TAB again it will show all of them, just like bash do usually, but disregarding case sensitivity.

frieza 03-04-2009 11:08 PM

yes i know doskey, that functionality is the same in alot of linux shells, just hit the 'up' and 'down' arrow keys to cycle through the history, rather cumbersome when you have to go through nearly 1000 commands to find the one you want though, hence the try THAT in dos

i92guboj 03-04-2009 11:20 PM

Quote:

Originally Posted by frieza (Post 3465323)
yes i know doskey, that functionality is the same in alot of linux shells, just hit the 'up' and 'down' arrow keys to cycle through the history, rather cumbersome when you have to go through nearly 1000 commands to find the one you want though, hence the try THAT in dos

Actually with doskey you could press f7 to show the history, and f9 + number to choose one command. Different modus operandi, but quite the same functionality that you described: list the history and run an arbitrary command on that list. It could do a few more things like auto completing a command with something already in the history (f8). All these, provided that my memory is still working at it should :p


All times are GMT -5. The time now is 10:56 PM.