LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 10-18-2003, 10:29 AM   #1
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Rep: Reputation: 15
Question When booting 'Bringing up interface eth0' slow and many newbie questions


Well. That's all the problem is. It takes about a minute. And produces such messages as sending probe 1, 2, 3, 4 and claiming addresses. Not too sure what it is for, but I'm guessing it's something to do networking: I have an ethernet 10/100 connection. Something which I haven't tried yet...

Being very new to Linux I have an abundance of questions which are hopefully so simple that all the experts out there can laugh at them before answering:

a) In Uni, they use Emacs as the editor, and a very useful command I was taught there was Ctrl-x, Ctrl-u to bring up a console screen within Emacs. When I tried this, I got a nice error message though. How do I enable it?

b) The console screen has a silly $ sign after each line. How do I get rid of this?

c) I created a user, but is this necessary since I am the only one to use it?

d) Perhaps the biggest problem: I installed Linux to essentially program. However, upon trying a very simple C++ Hello World program, using emacs as the editor, and creating (I think) the hello executable using the following command:

hello: hello.cpp
g++ -g hello.cpp -o hello

the file hello* appears in the directory. And I can't run it! I've tried running hello*, hello, but nothing seems to work. All I get is

bash: hello: command not found


And who's bash? And how do I get rid of that silly name?

Thank you! (Doubtless I will have further questions as I play around with Linux more...)
 
Old 10-18-2003, 10:57 AM   #2
JoeDuncan
Member
 
Registered: Aug 2003
Location: Ottawa
Distribution: Redhat 5.2, 6.0, 6.1, Mandrake 7.2, 8.0, 9.1, 9.2, 10.0, Gentoo, Debian 3.1r0
Posts: 224

Rep: Reputation: 30
Ok, I can answer some of these questions...

b) You have to edit your .bash_profile file in your home directory and change (or create) the value for the environment variable PS1. If you want a familiar DOS or Windows looking prompt you can try:

PS1=\w>
(or PS1="\w>" from the command line to temporarily change the prompt)

Lookup the PS1 bash environment variable on the net for more options...

c) Generally, it is best to use the user you created because then you won't be doing everything as root. If you do every thing as root, you can potentially screw up your system very quickly, and you give quicker access to viruses, trojans, worms, hackers etc....

d) this is because your executable is not in the PATH, try "./hello", which specifies to look for "hello" first in "./" which is a reference to the current path... the "*" is just an indicator meaning the file is executable...

bash is your command shell, and you can't get rid of it, unless you want to use another shell, but they all have silly names, a few are: zsh, tcsh, korn etc... bash is the Unix equivalent of "command.com" it reads input from the command line, parses it and executes the corresponding commands/programs... it also stores environment variables (like the aformentioned PS1) and allows some limited scripting. Some of the other shells allow full-fledged programming, but you can discover that for yourself...
 
Old 10-18-2003, 11:01 AM   #3
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Can you tell us what distro you are using?

Do you use your ethernet card? Is it connected to a network? Does it work?

a) Sorry -I don't use emacs - could it be a different version? have you got the latest one?

b) Can you post what it looks like and what you want it to look like

c) You should use a user rather than root so that it is more difficult to accidentally damage your system.

d) Make sure you have executeable permissions on the file - if the file is not in your path you should run it as "/path/to/hello" or if it is in the current directory "./hello"

Bash stands for "Bourne Again SHell".

What do you want to get rid of?
 
Old 10-18-2003, 11:20 AM   #4
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Using Mandrake 9.1. I also have Windows XP on the laptop (please don't kill me...) I use the connection frequently to connect with the home PC (using a FireWire cable), and also to connect to the Uni network. When it went through the sending probe 1 and claiming address stuff, I wasn't connected to anything.


At the moment the console has

[cy00@localhost WHEREEVER_I_AM]$

as the prompt. I have no idea how to change/edit bash. It just seems annoying to have my login displayed and at a localhost. AND with a $ after it. Can't I just have WHEREEVER_I_AM > instead?

Hello World!

It works! But why do I need the ./? Where does just hello actually look? I was told / is the root directory, and ./ is the current directory in Linux. Surely there is some way to just look in the current directory within the console?

Thank you for all the help so far!
 
Old 10-18-2003, 12:30 PM   #5
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Anyone? Please? =[
 
Old 10-18-2003, 12:47 PM   #6
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
To set your prompt:
export "PS1=\$PWD> "

Bash will look at all directories in your path which may/maynot include the current directory. To see your current paths:
echo $PATH|sed s/\:/\\n/g
 
Old 10-18-2003, 01:09 PM   #7
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Thank you David! That first one is so useful! How do I make it permanent?

Tried that second thing you said, and it indeed does not search the current directory. Isn't it a bit dangerous for it to search all those directories? What if you had multiple instances of the executable in different directories???

Now my Linux likes to sometimes let me run hello.exe without the ./, and sometimes it needs it.

Thanks in advance!
 
Old 10-18-2003, 01:51 PM   #8
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
To make the prompt permenant add the command to the end of your profile script:
~/.bash_profile

It is not dangerous at all. If two or more instances are found then the one in the first path will be used.

I can't beleive that it will only sometimes run with or without ./ unless the current directory is in your path variable which I wouldn;t reccomend doing.
 
Old 10-18-2003, 02:12 PM   #9
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Just a little tiny more help before I run away.

I tried this thing as root: ~/.bash_profile but I get:

bash: ~/root/.bash_profile: permission denied

Where do I open it from? And as who?

I realise now that I need to know who is using the comp! So can I get it so it says


USER /WHEREEVER/WHATEVER >


And helpful people on this board have told me to use su to switch to admin, how do I switch back!

Thanks!
 
Old 10-18-2003, 02:25 PM   #10
quatsch
LQ Addict
 
Registered: Aug 2003
Location: New York, NY
Distribution: gentoo, gentooPPC
Posts: 1,661

Rep: Reputation: 48
you switch back from being root by the command
exit

As for editing ~/.bash_profile, don't do it as root. The ~ specifies the home directory of whoever is issuing the command, so if you use it as root, it will go to the home directory of root and not that of the normal user. The reason why you get permission denied is that the file is write protected by default. The one for a normal user isn't, though.
 
Old 10-18-2003, 02:25 PM   #11
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
Edit the file:
~/.bash_profile

"~/" Means your home directory. So for edit the file called ".bash_profile" in the home directory of which ever user you want to change the prompt for.
 
Old 10-18-2003, 02:50 PM   #12
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Still can't access it. Permission denied.

Where exactly do I type it? As soon as I enter the console?

I type:


~/.bash_profile


And get:


bash: /home/cy00/.bash_profile: Permission denied
 
Old 10-18-2003, 02:55 PM   #13
david_ross
Moderator
 
Registered: Mar 2003
Location: Scotland
Distribution: Slackware, RedHat, Debian
Posts: 12,047

Rep: Reputation: 66
You don't type it - you edit it using your normal text editor like vi, pico, emacs, kate or gedit.
 
Old 10-18-2003, 03:06 PM   #14
cubeman
Member
 
Registered: Oct 2003
Distribution: Mandrake 9.1
Posts: 35

Original Poster
Rep: Reputation: 15
Woops!

I added export "PS1=\$PWD> " to the end of the file, saved it, but no change! I have tried restarting and relogging as well.

The .bash_profile looks like this:


if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

PATH=$PAH:$HOME/bin

export PATH
unset USERNAME
export "PS1=\$PWD> "


How should I modify it now to get:


USER /WHERE_I_AM >


where USER is root or other.
 
Old 10-18-2003, 04:25 PM   #15
icyfire
Member
 
Registered: Feb 2002
Location: Bay Area, California
Distribution: Ubuntu
Posts: 110

Rep: Reputation: 15
cubeman,

First of all, try setting it up in ~/.bashrc, where ~ is your home directory (also written as /home/your_username. This worked for me. Second, in the .bashrc, add this line:
Code:
PS1="[\u: \w]\$"
. Make sure that the quotes are after the PS1=.

If you want to customize your prompt (add colors, other options) check out this great little HOWTO:
http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html

tldp.org is a great webpage for nearly everything. If you want another example prompt, here's mine.
Code:
PS1="[\[\033[1;31m\]\t\[\033[m\]][\[\033[1;32m\]\u\[\033[1;36m\] Up: (\$(upt))\[\033[1;34m\] \w\[\033[m\]]\$ "
upt is a script I found online and I'll be happy to post it for you if you like.

~icy

Last edited by icyfire; 10-18-2003 at 04:27 PM.
 
  


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
Bringing up interface eth0 Delaying eth0 initialization. [ FA bansal_ashok Linux - Networking 4 05-27-2005 11:09 AM
bringing up interface eth0: [FAILED] Birgi Linux - Networking 33 10-07-2004 06:00 AM
Bringing up interface eth0 error tommytomato Linux - Newbie 11 05-19-2004 10:10 PM
Bringing up interface eth0... failed Commish66 Linux - Networking 10 02-20-2004 12:27 AM
Bringing up interface eth0: determining ip information for eth0... failed ralphethomas Linux - Networking 0 01-24-2004 06:33 PM


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