LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 11-28-2008, 09:29 AM   #1
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Rep: Reputation: 0
Question Why cant I execute certain files?


Apologies if this is a silly question, I have done a LOT of searching and fiddling around but cannot find an answer.

Basically I have installed lynx but cannot run it. Please see my latest attempt:

/opt/bin # ls -l lynx
-rwxr-xr-x 1 root root 1140456 Jan 20 2008 lynx
/opt/bin # ./lynx
/bin/sh: ./lynx: not found


As you can see I can see the lynx file and it looks like I have execute permissions (to my newb eyes), but when I try to run it I get "not found". Thanks in advance for any comments whatsoever, even insults would be welcome at the moment

Machine: Freecom Network Drive Pro
Distro: OpenFSG
 
Old 11-28-2008, 09:59 AM   #2
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
There's no need for ./ and you don't need to be in /opt/bin just type lynx when you start a terminal session.
 
Old 11-28-2008, 10:06 AM   #3
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks for the reply, but just tried your suggestion and got the same problem:

/opt/bin $ lynx
-sh: lynx: not found
 
Old 11-28-2008, 10:12 AM   #4
salter
Member
 
Registered: Oct 2008
Posts: 100

Rep: Reputation: 15
Based on your command-line output you are logged in as root and have lynx installed in /opt/bin and your lynx is owned by root. All in all it should work.

I had once problems accessing web files by the Apache browser due to some SELinux settings on the directory containing those files, which was solved by copying the files to a new directory and replacing the old directory with the new one. It was a weird solution to a weird problem.

In your case it seems easier to install lynx properly in /usr/bin uing some package manager.

Last edited by Tinkster; 10-30-2010 at 04:07 PM.
 
Old 11-28-2008, 10:14 AM   #5
{BBI}Nexus{BBI}
Senior Member
 
Registered: Jan 2005
Location: Nottingham, UK
Distribution: Mageia 6, KDE Neon
Posts: 4,313

Rep: Reputation: 212Reputation: 212Reputation: 212
Try executing it from your /home/username directory. Type ~ then press enter, now type lynx. If that doesn't work try /opt/bin/lynx. If both ways fail, it is most likely because /opt/bin is not in your path. Type env and look for a line like this: PATH=/opt/bin.

Last edited by {BBI}Nexus{BBI}; 11-28-2008 at 10:22 AM. Reason: Additional info added
 
Old 11-28-2008, 10:25 AM   #6
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Tried your suggestions.

/home/.users $ ~
-sh: /home/.users/admin: Permission denied


Even though

/home/.users $ cd /home/.users/admin
~ $


works fine.

Also tried suggestion from {BBI}}NEXUS{BBI} to copy to /opt/bin but get the same problem. I reckon a hammer or an axe might be required soon...
 
Old 11-28-2008, 10:44 AM   #7
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
/home/.users $ ~
-sh: /home/.users/admin: Permission denied
~ is not a command. But it means "my home".
So typing just ~ is like typing /home/.users/admin which also isn't a command. So you get "Permission denied "

cd is a command. It means change directory to ....
so you can cd ~ or cd /home/.users/admin

lynx doesn't work because as {BBI}Nexus{BBI} said, /opt/bin/ is not in root's path (and you were trying as the root user)

Please read {BBI}Nexus{BBI}'s post #5 again, and try /opt/bin/lynx
 
Old 11-28-2008, 10:48 AM   #8
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Apologies I misquoted, I meant to say that I had tried salter's suggestion. I have also tried {BBI}Nexus{BBI} too:

/ # /opt/bin/lynx
/bin/sh: /opt/bin/lynx: not found
 
Old 11-28-2008, 11:17 AM   #9
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Just out of curiosity, what is the output of the following two commands?
Code:
file /opt/bin/lynx
ls -al /opt/bin
Please, use code tags to embed pieces of code or output. Just embed text in [CODE] and [/CODE]

Last edited by colucix; 11-28-2008 at 11:19 AM.
 
Old 11-28-2008, 11:18 AM   #10
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
OK
What's the output of
Code:
ls  -l  /opt/bin/lynx
?

(That's "minus Ell" not "minus one")
 
Old 11-28-2008, 11:25 AM   #11
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Code:
/ # file /opt/bin/lynx
/bin/sh: file: not found
and

Code:
/ # ls -al /opt/bin
drwxr-xr-x    2 root     root         4096 Nov 27 23:08 .
drwxr-xr-x   12 root     root         4096 Jan 21  2008 ..
lrwxrwxrwx    1 root     root            5 Nov 27 09:57 bzcat -> bzip2
lrwxrwxrwx    1 root     root           20 Nov 27 09:58 bzip2 -> /opt/bin/bzip2-bzip2
-rwxr-xr-x    1 root     root            0 Nov 28 17:55 bzip2-bzip2
-rwxr-xr-x    1 root     root         7568 Mar 21  2008 bzip2recover
lrwxrwxrwx    1 root     root            3 Nov 27 09:58 captoinfo -> tic
lrwxrwxrwx    1 root     root           22 Nov 27 09:58 clear -> /opt/bin/ncurses-clear
-rw-r--r--    1 root     root         5895 Nov 16 22:41 index.html
-rwxr-xr-x    1 root     root        44336 Nov 11 23:55 infocmp
lrwxrwxrwx    1 root     root            3 Nov 27 09:58 infotocap -> tic
-rwxr-xr-x    1 root     root      1140456 Jan 20  2008 lynx
lrwxrwxrwx    1 root     root           18 Mar 19  2008 nc -> /opt/bin/netcat-nc
-rwxr-xr-x    1 root     root            0 Nov 28 17:55 ncurses-clear
-rwxr-xr-x    1 root     root         4959 Nov 11 23:55 ncurses5-config
-rwx------    1 root     root            0 Nov 28 17:55 netcat-nc
-rwx------    1 root     root       325080 Sep 27 19:44 openssl
lrwxrwxrwx    1 root     root            4 Nov 27 09:58 reset -> tset
-rwx------    1 root     root       360480 Apr  8  2008 rsync
-rwx------    1 root     root       108156 Feb 21  2008 sudo
-rwxr-xr-x    1 root     root        44292 Nov 11 23:55 tic
-rwxr-xr-x    1 root     root         8612 Nov 11 23:55 toe
-rwxr-xr-x    1 root     root         8952 Nov 11 23:55 tput
-rwxr-xr-x    1 root     root        14412 Nov 11 23:55 tset
-rwx------    1 root     root        77248 Feb 21  2008 visudo
-rwxr-x--x    1 admin    root        16141 Jan 21  2008 wakelan
 
Old 11-28-2008, 11:39 AM   #12
tredegar
LQ 5k Club
 
Registered: May 2003
Location: London, UK
Distribution: Fedora38
Posts: 6,147

Rep: Reputation: 435Reputation: 435Reputation: 435Reputation: 435Reputation: 435
Quote:
/ # file /opt/bin/lynx
/bin/sh: file: not found
Means you do not have the file command installed, or it is not on your PATH. This is unusual IMHO, but no matter.

In your listing of /opt/bin/ lynx is there, and is executable by all.
So it should work. But it doesn't.
What, please is the output of env
?
Is your filesystem corrupted? have you tried running fsck ?
 
Old 11-28-2008, 11:59 AM   #13
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Yes, file is missing, cant install it either (get an error). This is an unusual distro.

Code:
/opt/bin # env
USER=admin
MAIL=/var/mail/admin
SSH_CLIENT=xxx.xxx.xxx.xxx 3939 22
OLDPWD=/
HOME=/home/.users/admin
SSH_TTY=/dev/ttyp0
LOGNAME=admin
TERM=xterm
PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/sbin
SHELL=/bin/sh
PWD=/opt/bin
SSH_CONNECTION=xxx.xxx.xxx.xxx 3939 192.168.1.111 22
TZ=GMT0
and

Code:
/opt/bin # fsck -N
fsck 1.38 (30-Jun-2005)

Last edited by confusarama; 11-28-2008 at 12:04 PM.
 
Old 11-28-2008, 12:01 PM   #14
confusarama
LQ Newbie
 
Registered: Nov 2008
Posts: 10

Original Poster
Rep: Reputation: 0
Oh bllx! Just gave out my ip address. Dont look
 
Old 11-28-2008, 12:03 PM   #15
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by confusarama View Post
Oh bllx! Just gave out my ip address. Dont look
You can always edit the message and change them to something like XXX.XXX.XXX.XXX.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Not able to execute binary files mmk_77 AIX 1 04-05-2007 05:42 PM
Why the './' to execute files? SlowCoder Linux - Newbie 8 03-09-2007 01:09 AM
how can i execute applications with SH files ? HalkEkmek Ubuntu 1 02-16-2006 01:27 PM
Cannot execute executable files without ./ brady9953 Linux - Newbie 3 10-13-2003 03:19 PM
normal user can't execute files in cd..? doublefailure Linux - Hardware 0 09-11-2002 01:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:04 PM.

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