LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Help! I think I broke the Less and Man commands... (https://www.linuxquestions.org/questions/linux-newbie-8/help-i-think-i-broke-the-less-and-man-commands-237126/)

Biggen 09-30-2004 12:06 PM

Help! I think I broke the Less and Man commands...
 
Well I guess this is what I get when playing around as root on a console and not know what I am doing.

If I go to run the less command to look at a file (i.e. less profile) mandrake does not like it. It scrolls through every file in my /usr/bin directory extremely quickly. For example, here is what the sample output looks like even if I just type "less" in the console:

Quote:

/usr/bin/less: line 1583: yuvsplittoppm*: command not found
/usr/bin/less: line 1584: yuvtoppm*: command not found
/usr/bin/less: line 1585: zcmp*: command not found
/usr/bin/less: line 1586: zdiff*: command not found
/usr/bin/less: line 1587: zeisstopnm*: command not found
/usr/bin/less: line 1588: zforce*: command not found
/usr/bin/less: line 1589: zgrep*: command not found
/usr/bin/less: line 1590: zip*: command not found
/usr/bin/less: line 1591: zipcloak*: command not found
/usr/bin/less: line 1592: zipgrep*: command not found
/usr/bin/less: line 1593: zipinfo*: command not found
/usr/bin/less: line 1594: zipnote*: command not found
/usr/bin/less: line 1595: zipsplit*: command not found
/usr/bin/less: line 1596: zless*: command not found
/usr/bin/less: line 1597: zmore*: command not found
/usr/bin/less: line 1598: znew*: command not found
/usr/bin/less: line 1599: zonetab2pot.py*: command not found
Again this is just a sample of the output from the bottom. It scrolls through all 1599 files before it stops and dumps back to a prompt.

I have no idea how I broke this. I believe it was when I was wanting to run less on a file and have its output piped to grep so I could search for something. I believe the command I used was something like "less xyz | grep xyz". Is there a way I can look through the recent commands issued as root as see if I can see exactly what I typed in?

My other problem is that "man" seems to also be affected. If I do just "man" in the console, the system asks me what man page I want. Ok, that works. So then if I try "man less", or "man more", or "man anything", this is what I get:

Quote:

/usr/bin/less: line 1587: zeisstopnm*: command not found
/usr/bin/less: line 1588: zforce*: command not found
/usr/bin/less: line 1589: zgrep*: command not found
/usr/bin/less: line 1590: zip*: command not found
/usr/bin/less: line 1591: zipcloak*: command not found
/usr/bin/less: line 1592: zipgrep*: command not found
/usr/bin/less: line 1593: zipinfo*: command not found
/usr/bin/less: line 1594: zipnote*: command not found
/usr/bin/less: line 1595: zipsplit*: command not found
/usr/bin/less: line 1596: zless*: command not found
/usr/bin/less: line 1597: zmore*: command not found
/usr/bin/less: line 1598: znew*: command not found
/usr/bin/less: line 1599: zonetab2pot.py*: command not found
Error executing formatting or display command.
System command (cd /usr/share/man && (echo ".pl 1100i"; /usr/bin/bzip2 -c -d '/usr/share/man/man1/more.1.bz2'; echo ".\\\""; echo ".pl \n(nlu+10") | /usr/bin/gtbl | /usr/bin/nroff -Tlatin1 -mandoc -c | /usr/bin/less -isrR) exited with status 127.
This started happening when the "less" command broke.

Any idea on how to fix this??

christhom 09-30-2004 12:34 PM

ok, in the future, you always want to do
<blah command> | grep foo | less
grep on the whole output, then page to see the results in a nice way.

Things you should look at. Firstly, clear all your LESS* environment variables. I assume you're using bash? type 'unalias -a'. See if that has any effect. If it works, something is either screwed with your LESS/LESSOPEN/LESSCLOSE/LESSKEY etc variables. Or the files they refer to.

Next look for suspicious things (like recently changes file times, about the time you were messing around) in /etc, looking for files /etc/less*.

Then, well, probably first, just test less itself, by using full path. /usr/bin/less foobar (where foobar is a file). any luck?

just some random things that I would do...

oh, btw - it's expected that man is broken, because man pipes things through $PAGER, which is usually less. you can work around by exporting PAGER=/bin/more. I assume your system has a *real* "more" command right?

Biggen 09-30-2004 02:00 PM

Thanks for the help!

Unfortunately, "unalias -a" didn't seem to do anything. I can still do just a "less" in the shell and get all that output as well.

I also don't have any files that are less* in the /etc directory.

I also tried to use the full path "/usr/bin/less and I get the same thing...

I also tried typing in at the shell "PAGER=/bin/more" but man still seems broken. I am not sure what you mean by a *real more* command, but I do have more and it works. I have been using it as a substitute for less.

Grrr. This is frustrating... Is the "less" command just one file. In other words, can the file be replaced with a working "less" or does this have to be fixed or reformatted??

christhom 09-30-2004 03:34 PM

1) by a *real* more - I mean is /bin/more a real binary, not just a symlink to less.
2) yes, at this stage, if /usr/bin/less gives you garbage, you can just replace it. it's part of the gnu less package, or you'll probably just be able to copy the file from a similar system (i.e one that is libc compatible), although it's usually best to replace the whole package, in case it's some weird config file you've barfed.


All times are GMT -5. The time now is 03:22 PM.