LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   /usr/bin/wc not available in the system (https://www.linuxquestions.org/questions/linux-newbie-8/usr-bin-wc-not-available-in-the-system-552284/)

innak 05-08-2007 10:04 AM

/usr/bin/wc not available in the system
 
Please help!
I am new to Linux.
I need to use wc command.
If I run "which wc" the output is /usr/bin/wc
However, /usr/bin/wc file is empty. wc command doesn't work at all.
I would really appreciate any advice on how to install wc into my system or how to replace wc if something else can give me word count output.
Thank you for any help,
Inna

This is output from lsb_release -a
LSB Version: core-2.0-noarch:core-3.0-noarch:core-2.0-ia32:core-3.0-ia32:graphics-2.0-ia32:graphics-2.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID: SUSE LINUX
Description: SUSE LINUX Enterprise Server 9 (i586)
Release: 9
Codename: n/a

tredegar 05-08-2007 10:57 AM

What do you mean "wc command doesn't work at all."?
Linux usually gives error messages if something is wrong, and when it is silent, it is either waiting for some input (you don't see a prompt), or it has completed the command (you get a prompt back).

wc needs a filename in the current directory to count the words in that file eg
wc mytextfile

innak 05-08-2007 11:10 AM

Thank you for answering.
Nothing at all happens. Prompt returns right away, but no any output.
I am using it like this:
/usr/bin/wc filename.txt
If I go to /usr/bin directory and do ls -l ws, I am getting:
-rwxr-xr-x 1 root root 0 Mar 9 10:49 /usr/bin/wc

Was it not installed properly with Linux? What do I do?
Thank you for you help,
Inna

jschiwal 05-08-2007 11:16 AM

wc is supplied by the coreutils package. You can check the integrity of the package with the command: "rpm -qV coreutils".

By empty, do you mean that
ls -l /usr/bin/wc
says that it has zero size?

You could reinstall coreutils if so.
If that is the only program in coreutils that shows up as bad, you could use the unrpm program and copy the wc program to /usr/bin/.

tredegar 05-08-2007 11:18 AM

It seems that you have a file called usr/bin/wc which is of zero length. So it is unlikely to work.
When I do ls -l /usr/bin/wc I see this:

-rwxr-xr-x 1 root root 18348 Feb 13 2003 /usr/bin/wc*

So something is very wrong with your installation. Is everything else working alright? If so, then I'd just reinstall wc, otherwise, it might be a good idea to start afresh.

This is a very unusual situation, and I wonder how it happened. You haven't been "runnng as root" have you?

innak 05-08-2007 11:39 AM

I have no idea how it happened. The installation was done before me and all I need is to install small cron job on this machine (which is supposed to use wc).
Do you have an idea where I cat get/download wc program?
Thank you.

tredegar 05-08-2007 11:44 AM

Quote:

Do you have an idea where I cat get/download wc program?
Please see jschiwal's post above(#4), in this thread.

innak 05-08-2007 11:59 AM

Yes, thank you so much!

tredegar 05-08-2007 12:03 PM

Welcome to LQ! :)


All times are GMT -5. The time now is 05:29 PM.