LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   executing a program from command prompt (https://www.linuxquestions.org/questions/linux-newbie-8/executing-a-program-from-command-prompt-882988/)

New123 05-27-2011 03:49 AM

executing a program from command prompt
 
I'm very new to Linux. I'm trying to run an application from the command prompt. I've set the path in .bashrc. My executable file and all other files needed by it are saved in the same directory as the path. When I enter the executable name to run it, I get an error message saying that the command is not found.

What else do I need to set or check?
New123

EricTRA 05-27-2011 03:54 AM

Hello and Welcome to LinuxQuestions,

Can you post the command you are trying to execute so that we know what you've tried and give you a dedicated answer? Did you set the permissions on the file you want to run? Check permissions with
Code:

ls -l
in the directory where you saved the files.

Kind regards,

Eric

jrecortel 05-27-2011 03:56 AM

try
Code:

./program_name
Just Make sure it has execute permission.

New123 05-27-2011 04:02 AM

Quote:

Originally Posted by EricTRA (Post 4368400)
Hello and Welcome to LinuxQuestions,

Can you post the command you are trying to execute so that we know what you've tried and give you a dedicated answer? Did you set the permissions on the file you want to run? Check permissions with
Code:

ls -l
in the directory where you saved the files.

Kind regards,

Eric

Hi there!

It is not a command that I'm trying to run, it is an executable file. Unfortunately I don't have my laptop with me. I'll give more details when I get home. Thanx for the quick response!
New123

EricTRA 05-27-2011 04:29 AM

Hi,

If you're referring to a Windows executable file, then you'll need Wine to run it. Windows executable files are not going to execute natively on Linux. Looking forward to your feedback. Post the exact command line as you tried please.

Kind regards,

Eric

frankbell 05-27-2011 08:08 PM

"./" means "run a program in the current directory." "." means "the directory I'm in right now" (more properly termed the "working directory").

If you want to run /usr/bin/foo and /usr/bin is in your path, it should be enough just to enter "foo" on the command line.

If you cd to /usr/bin, then you might need to enter "./foo" or it may be enough to enter "foo."

I can run "gedit" (the Gnome editor) from a terminal simply by entering "gedit."

As EricTRA pointed out, the program must be a *nix executable.

New123 05-30-2011 04:50 AM

Hi there,

The file that I'm trying to run, is a Linux executable file. When I look at its properties, it shows me that it is an executable. It is an executable that is part of a Linux package used for finite state machines. The executable and all the files that it is using is in /home/drinaduplessis/newxfst. I change my directory from the command prompt to this, and doing ls -l, shows that I am in the correct directory. As I understand I should now be able to type in the executable name, which is xfst. If I do I get a message saying 'no such file or directory'. Before I changed the permission of the file to read and write, I got a message saying something like 'command invalid' or something to that effect. I can run a PERL program from the directory without a problem.

What else do I need to check?

Regards
New123

knudfl 05-30-2011 04:58 AM

Quote:

As I understand I should now be able to type in the executable name, which is xfst


You should not type 'xfst' , but ./xfst

New123 05-30-2011 05:03 AM

Thanx! Will try that!
New123

New123 05-30-2011 05:09 AM

Hi again!

Have tried ./xfst - still the same error message!
New123

EricTRA 05-30-2011 05:14 AM

Hello,

What file are you trying to execute? Type the following and post output please:
Code:

file xfst
Kind regards,

Eric

New123 05-30-2011 05:40 AM

This is what I get after entering file xfst.

drinaduplessis@drinaduplessis-laptop:~$ cd /home/drinaduplessis/newxfst

drinaduplessis@drinaduplessis-laptop:~/newxfst$ file xfst

xfst: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.18, stripped
drinaduplessis@drinaduplessis-laptop:~/newxfst$

When xfst is executed it should allow me to run script files with xfst commands.

New123

EricTRA 05-30-2011 05:49 AM

Hi,

Thanks for the feedback. Can you confirm you're running a 32-bit OS? Execute:
Code:

uname -a
and post output please.

Kind regards,

Eric

New123 05-30-2011 06:04 AM

This is the output:

drinaduplessis@drinaduplessis-laptop:~$ uname -a

Linux drinaduplessis-laptop 2.6.32-21-generic #32-Ubuntu SMP Fri Apr 16 08:09:38 UTC 2010 x86_64 GNU/Linux

drinaduplessis@drinaduplessis-laptop:~$

EricTRA 05-30-2011 06:12 AM

Hi,

It looks like you're running a 64-bit kernel:
Code:

x86_64 GNU/Linux
and you're trying to execute a 32-bit application
Code:

xfst: ELF 32-bit LSB executable
Do you have a 64-bit version of that application available? If so, then remove the 32-bit and install the correct version for your platform. If not, you could try installing the ia32 libraries which might work also.

Kind regards,

Eric


All times are GMT -5. The time now is 10:46 AM.