Hacker News new | ask | show | jobs
by bombcar 1706 days ago
Doesn’t command completion cause a disk scan? Which can be a problem if the system is failing in some way and you’re trying to recover.
4 comments

Can you not just avoid activating a completion attempt if you are in that scenario?
I think it is not as easy as you imply, especially if it is bound to muscle memory.

Side note: https://www.google.com/search?q=don%27t+say+just

What percentage of your time do you spend on a shell on a host where the disk is failing and tabbing could cause a catastrophic disk read vs being on a perfectly healthy system where tab complete is a nice feature?
What percentage of your time do you spend logged in as root? ;)
unless you're exclusively running shell built-ins, doesn't running any command at all potentially cause a disk scan
Usually the shell creates a cache of commands on start, which can be refreshed with `hash -r`.
As far as I can tell the hash table is initially empty after you first start the shell. At least, that's the case for bash.

  $ hash
  hash: hash table empty
Reminds me of the times I've had run out of space in a Linux system. When you SSH to the system and press TAB for command completion, all you get is some message regarding "the system running out of space".
Maybe in sh type shells. In csh/tcsh commands are hashed, so command completion is in memory. Thus the need for rehash.

There is a new setting in tcsh to allow for automatic rehash, but I have it disabled.

hash -r in bash. No idea if there's a setting, I'm too used to doing the rehash as required to've noticed if there was.