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 05-19-2011, 08:15 AM   #1
alexa-lol
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu
Posts: 8

Rep: Reputation: Disabled
How to start file in different directory


Hej
I am having troubles starting superPI benchmark test on Linux. I have it in a file named 'super pi' so ./super_pi doesn't work. I can't figure it out how to do it.

In cmd(Win) I would do it like this
cd C:/super pi/
super_pi
If the file would be located in C:/super pi/

The problem is I somehow can't tell the path to the file.

Cheers
 
Old 05-19-2011, 08:16 AM   #2
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,133
Blog Entries: 2

Rep: Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836Reputation: 4836
"doesn't " work is not a sufficient description of this error. Please post the exact error-message.
 
Old 05-19-2011, 08:25 AM   #3
Arcane
Member
 
Registered: May 2006
Location: Latvia, Europe
Distribution: random
Posts: 303

Rep: Reputation: 241Reputation: 241Reputation: 241
Aren't you using linux with graphical environment and file manager with gui? It would be way easier. If you want from terminal steps are similar to Windows. Type "cd path" then run with "sh filename" but are you sure that the file you want execute is linux compatible or you are trying run .exe?
 
Old 05-19-2011, 08:47 AM   #4
alexa-lol
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
hej
thanks..
Well I could not change the directory. The problem is super pi is are 2 words. I renamed it to super and now it works. But how would I move to the directory named super pi or any other with space in the name?

I also get Segmentation fault. I will update all of the drivers and try again.
 
Old 05-19-2011, 08:50 AM   #5
Nylex
LQ Addict
 
Registered: Jul 2003
Location: London, UK
Distribution: Slackware
Posts: 7,464

Rep: Reputation: Disabled
Quote:
Originally Posted by alexa-lol View Post
I renamed it to super and now it works. But how would I move to the directory named super pi or any other with space in the name?
A few ways:

1. Use tab completion. Start typing the name of the directory, hit the TAB key and it should automatically complete (assuming the part you've typed is unique)

2. Escape the spaces with "\", e.g. "cd dir\ with\ spaces".

3. Put the directory name in double quotes.

Last edited by Nylex; 05-19-2011 at 08:53 AM.
 
Old 05-19-2011, 08:58 AM   #6
Arcane
Member
 
Registered: May 2006
Location: Latvia, Europe
Distribution: random
Posts: 303

Rep: Reputation: 241Reputation: 241Reputation: 241
Also
4.Use * to give anything in that place. For example "cd super*" will pick folder starting with super(case matters!) in name. If you have only one called that way there will be no problem otherwise it may not work and you may need use "cd super*pi" which will take starting super and ending pi.

Last edited by Arcane; 05-19-2011 at 09:00 AM.
 
Old 05-19-2011, 10:38 AM   #7
whk
Member
 
Registered: Jun 2005
Posts: 202

Rep: Reputation: 35
Just my MHO

On the super pi file you need to use thusly:

# /<your path>/super\ pi/

On tab completion there is also a double tab '<tab><tab>'
where you get a list with only typing the first two letters of the file
if there are similar file names.

You can make an .sh file (see advanced bash) for your convenience.
Or cover-copy/paste a file.
Or an alias.
Also make complete readme notes on what you did and when.

hth
 
Old 05-19-2011, 02:04 PM   #8
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by Arcane View Post
it may not work and you may need use "cd super*pi" which will take starting super and ending pi.
What if you have two folders: "super pi" and "supergfdgghhpi"? It's unlikely, but there will always be the possibility of conflicts when using globs for such a purpose.

By the way, if you use Linux, it's a good idea to avoid putting spaces in filenames since they are a pain to work with in the command line. Use underscores ("_") or dashes ("-") instead.

Last edited by MTK358; 05-19-2011 at 02:06 PM.
 
Old 05-19-2011, 02:12 PM   #9
alexa-lol
LQ Newbie
 
Registered: May 2011
Distribution: Ubuntu
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thumbs up

thank you all for replying

I used \ but the thing just did not want to work. I have resolved my issues now .

Cheers
 
Old 05-19-2011, 02:19 PM   #10
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443
Blog Entries: 3

Rep: Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721Reputation: 721
Quote:
Originally Posted by alexa-lol View Post
I used \ but the thing just did not want to work. I have resolved my issues now .
What do you mean by "did not work"?

Remember, there has to be a space after the "\". What the backslash does is it tells bash to interpret the following character literally.
 
  


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
Get first file of directory then copy to other directory andd rename the file Faye Linux - Software 4 01-30-2011 09:16 AM
[SOLVED] can not start jar app using symlink in different directory due to file not found! nocountryman Linux - Software 4 03-17-2010 04:11 AM
fail to start xterm: "could not exec /usr/OSE/bash: No such file or directory" freeindy Linux - General 3 11-28-2008 12:22 AM
"No such file or directory" when trying to start up wlan0 with ifconfig Jonasfrax Linux - Wireless Networking 1 08-26-2008 07:12 AM
How to protect a file/directory in your home login directory (RH Linux) jitsenho Linux - Security 9 07-03-2006 11:08 PM


All times are GMT -5. The time now is 10:25 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration