LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-24-2010, 12:52 PM   #1
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Rep: Reputation: 0
"ls -lh" is not working


We have brought a Fedora 8 dedicated server from godaddy. On that "ls -lh" commad is not working. The following are the output of ls -lh
# ls -lh
ls: invalid option -- h
Try `ls --help' for more information.

In man page of ls and ls in "ls-- help " there is the option -h. But not working that.
We haven't done any modification on the machine. Anybody know how I get the proper output of "ls -lh"

Thanking you,
Nikesh
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 06-24-2010, 12:58 PM   #2
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
are you using BASH?

I just did ls -lh, and it works fine, so maybe you are in a different shell---Do "env | grep SHELL" or "echo $SHELL" to see what you are using.
 
Old 06-24-2010, 01:00 PM   #3
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Ummmmm---you said you checked the man page, so my idea may be off-base. Also look at aliases (Just enter "alias" in a terminal)
 
Old 06-24-2010, 01:41 PM   #4
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Original Poster
Rep: Reputation: 0
Thanks for the reply.

I am using Bash shell.
Also i checked the aliases of the server. below is the alias output.

# alias
alias l.='ls -d .* --color=auto'
alias ll='ls -l --color=auto'
alias ls='ls --color=auto'
alias vi='vim'
alias which='alias | /usr/bin/which --tty-only --read-alias --show-dot --show-tilde'

Any idea how to solve this.
 
Old 06-24-2010, 01:45 PM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
1. try "ls -l -h"

2. try getting rid of the existing ls aliases.

3. Otherwise, no clue
 
Old 06-24-2010, 03:47 PM   #6
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Original Poster
Rep: Reputation: 0
tried the ls -l -h . Its also showing the error message
# ls -l -h
ls: invalid option -- h
Try `ls --help' for more information.
 
Old 06-24-2010, 09:44 PM   #7
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Try:
/bin/ls --human-readable
/bin/ls -h
/bin/ls --version

and share the output with us.
 
Old 06-25-2010, 11:06 AM   #8
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Original Poster
Rep: Reputation: 0
# /bin/ls -h
/bin/ls: invalid option -- h
Try `/bin/ls --help' for more information.

# /bin/ls --human-readable
/bin/ls: unrecognized option `--human-readable'
Try `/bin/ls --help' for more information.

# /bin/ls --version
ls - GNU fileutils-3.13
 
Old 06-25-2010, 11:47 AM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Please do "bash --version"

and "echo $SHELL"
 
Old 06-25-2010, 11:50 AM   #10
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Original Poster
Rep: Reputation: 0
# bash --version
GNU bash, version 3.2.33(1)-release (i386-redhat-linux-gnu)
Copyright (C) 2007 Free Software Foundation, Inc.

# echo $SHELL
/bin/bash
 
Old 06-25-2010, 11:53 AM   #11
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Now we are getting somewhere!! Here's mine:
Code:
[mherring@mystical ~]$ bash --version
GNU bash, version 4.1.7(2)-release (x86_64-unknown-linux-gnu)
Copyright (C) 2009 Free Software Foundation, Inc.
Time for a system update!! (Fedora is now up to v.13, I think)

Last edited by pixellany; 06-25-2010 at 11:54 AM.
 
Old 06-25-2010, 11:58 AM   #12
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by pixellany View Post
Please do "bash --version"

and "echo $SHELL"
What effect would the bash version have on how the /bin/ls executable behaves? AIUI, once bash has forked itself and "exec"ed the executable it no longer has any influence on what the executable does ... ?
 
Old 06-25-2010, 12:06 PM   #13
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
I have no clue how the bash version might be related to the behavior of ls-----the main point is that the OP's system is out of date. A complete system update (eg clean install of the current Fedora) will likely solve MANY issues.

Is "ls" one of the builtins? i.e. are "ls" and "/bin/ls" actually 2 different commands?
 
Old 06-25-2010, 12:10 PM   #14
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,578
Blog Entries: 31

Rep: Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208Reputation: 1208
Quote:
Originally Posted by nikeshp View Post
# /bin/ls --version
ls - GNU fileutils-3.13
Perhaps the -h/--human-readable option was not supported in that version but that would be inconsistent with the option being described in the --help output.

Perhaps the /bin/ls binary is dependent on a shared library to implement the -h/--human-readable option and that library is AWOL. Do other commands such as df work with the -h/--human-readable option?

I can't see why /bin/ls would be making any system calls while parsing its options but running /bin/ls via strace just might give a clue and is easy to do.

Does /bin/ls --human-readable work on any other Fedora 8 systems? If so, can you copy /bin/ls from the problem system to a system where it works (under a different name!) and see if it works there? Can you compare checksums of /bin/ls on the problem system and on other Fedora 8 systems (running the same version of /bin/ls)?
 
Old 06-25-2010, 02:07 PM   #15
nikeshp
Member
 
Registered: Jan 2010
Location: Cochin
Posts: 35

Original Poster
Rep: Reputation: 0
Hi All,

I copied /bin/ls from another machine (Fedora 9) and overwritted the /bin/ls of fedora 8. Now the command "ls" work properly without any issues.

Not only that I faced some difficulties to overwrite /bin/ls. /bin/ls was having file attributes. Appendable (-a) and immutable (i)

# lsattr ls
s---ia-------- ls

I removed the file attributes and overwrote /bin/ls after taking a backup.

Now All are working fine for me. Thank you very much for helping me to solve this issue.

Thanks,
Nikesh
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
My "expect" script is not working... Won't "send" commands... edomingox Programming 4 04-02-2009 03:25 PM
net working eth0 eth1 wlan0 "no connection" "no LAN" "no wi-fi" Cayitano Linux - Newbie 5 12-09-2007 07:11 PM
Symlinks working from "inside" 'chroot' to "outside" ? amn Linux - Newbie 2 12-07-2007 01:09 AM
"dig mx" or "ping" not working because of bind9? alexxxis Debian 4 01-06-2007 11:26 PM
commands "init" and "modprobe" not working Diagmato Fedora 2 07-22-2005 11:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:55 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration