Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I occurred a really weired problem, which is touch : command not found.

I was going to create a blank file, so I type the touch command which didn't work.

I'm running centOS 5.

Any ideas?

BTW: the vi command also not found.

And I didn't find touch in the /bin dir, how can I reinstall "touch"?

share|improve this question
1  
Stop crossposting. superuser.com/questions/138964/… –  Ignacio Vazquez-Abrams May 8 '10 at 3:26
add comment

3 Answers

up vote 0 down vote accepted

/bin/touch is in the coreutils package. You can install this package by running:

yum install coreutils

If yum reports that the package is already installed, then you can run the following commands to reinstall it:

rpm -e --justdb --nodeps coreutils
yum install coreutils

The rpm command removes the rpm database entry for coreutils, which will allow yum to install it again.

vi can be installed from either the vim-minimal or vim-enhanced packages.

share|improve this answer
    
It works, and all the issues has gone! Really Appreciate! –  liuxingruo May 10 '10 at 4:40
add comment

At first guess, i'd say your $PATH variable is either empty or broken. Try typing the commands in their entirety, complete with path:

/usr/bin/touch test.txt
/usr/bin/vi test.txt

This is assuming CentOS 5 keeps them in /usr/bin (which I don't have handy to confirm, you can also try /bin)

Also, while you're at it:

/usr/bin/echo $PATH

and make sure /usr/bin (or wherever) is listed in there.

share|improve this answer
    
bash: /usr/bin/touch: No such file or directory bash: /bin/touch: No such file or directory bash: /usr/bin/echo: No such file or directory –  liuxingruo May 8 '10 at 3:38
    
this is my $PATH(root) /usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/‌​usr/sbin:/usr/bin:/root/bin –  liuxingruo May 8 '10 at 4:05
add comment

Since it isn't your PATH, it sounds like you can access much of anything.

The first thing I would do is see if your permissions are all messed up for some reason. This of course assumes you can access either stat or ls.

I would also check your /var/log of dmesg to see if you have had a disk error on such a scale that it is not even read-only, or if it is, things have gone really bad.

share|improve this answer
add comment

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.