 |
 |
 |
 |
| Using Fedora General support for current versions. Ask questions about Fedora and it's software that do not belong in any other forum. |

23rd May 2012, 09:57 AM
|
 |
"Shells" (of a sub world)
|
|
Join Date: May 2011
Location: Helvetic Federation (Swissh)
Age: 33
Posts: 2,602

|
|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by dd_wizard
If you are certain the command you ran was:
Code:
# rm -rf /usr/lib/my_exam_app
,
you couldn't have removed any system files. The only files you removed were conatined in the subfolder, my_exam_app.
As mentioned earlier, the locations mentioned by sea are the most likely places to have caused problems with the command line prompt.
dd_wizard
---------- Post added at 12:31 PM ---------- Previous post was at 12:27 PM ----------
If you accidently put a space immediately after "/usr/lib", all bets are off. I did something like that once when I tried to clean /tmp as root and put a space between / and the word tmp...  That's the day I learned to really appreciated backups!
dd_wizard
|
So, the problem is still the same?
And by that i mean, the ONLY failrue you reported, is that you see BASH-4.2 rather than USER@HOST, which is 99% a failure (bad syntax) of PS1
__________________
Fedora Manual: http://docs.fedoraproject.org
Script-Tools: https://sourceforge.net/projects/script-tools/
sudo st tweak repo toggle fedora-rawhide ; st iso dl-fed -respin && st iso usb
|

23rd May 2012, 10:46 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Location: Kashan
Posts: 31

|
|
|
Re: Problem with terminal and bash
What should I do for changing PS1 shell variable ? I wrote the below line to ~/.bashrc and ~/.bash_prodile and /etc/bashrc files and nothing happened !! what should I do ?
Code:
PS1="[\u@\h \W]\$ ";
How can I fix this bash problem ?
|

23rd May 2012, 10:53 AM
|
 |
"Shells" (of a sub world)
|
|
Join Date: May 2011
Location: Helvetic Federation (Swissh)
Age: 33
Posts: 2,602

|
|
|
Re: Problem with terminal and bash
No semicolon ; required, unless you place another variable onto the same line.
PS1="[\u@\h \W]\\$ "
Further, only place that line into 1 script, not in all.
Dont change existing lines, remove the lines you had typed before, and just place it in ~/.bashrc
Changes will be seen after reloading that bash script by:
source ~/.bashrc
If this doesnt help, there was an accident with /usr/lib, which i dont know how to recover but with a reinstall.
__________________
Fedora Manual: http://docs.fedoraproject.org
Script-Tools: https://sourceforge.net/projects/script-tools/
sudo st tweak repo toggle fedora-rawhide ; st iso dl-fed -respin && st iso usb
|

23rd May 2012, 11:30 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Location: Kashan
Posts: 31

|
|
|
Re: Problem with terminal and bash
It didn't fixed !!
I add
Code:
PS1="[\u@\h \W]\\$ "
to the end of ~/.bashrc and then run this command
So there is no way to recover it ? ( Not just with reinstalling ) ?
Will this problem cause a bad effect ?
Last edited by Programmer; 23rd May 2012 at 11:35 AM.
|

23rd May 2012, 12:18 PM
|
|
Registered User
|
|
Join Date: Aug 2009
Location: Waldorf, Maryland
Posts: 6,103

|
|
|
Re: Problem with terminal and bash
You are out of luck.
The space in "rm -rf /usr/lib/my_exam_app *" between the "...app" and the "*" means that /usr/lib/my_exam_app is deleted AND any files within the current working directory (the "*").
This is one of the problems Fedora is falling into by putting all its eggs in one basket (/usr). It is very difficult to recover from.
If you are developing your own applications, then they should be put in the /usr/local directory tree to isolate possible problems.
If you have a system backup (and you should), you can get the files lost from it. If you don't have a backup, you will need a list of the packages you installed to start with.
Normally you can get the list from a "yum list installed" (if the yum database has not been destroyed), and then reinstall each.
This will take a long time. The last time I did it took me some 8 hours (mostly due to the very long list... Doing them all at once is nice as many of the installed packages are dependencies of others and that would eliminate having to reinstall them).
This will not have recovered any local configurations that got deleted (that is what a system backup is for).
Other ways of handling it are to maintain/create a local repository of the installed packages. This eliminates a rather long network delay.
|

23rd May 2012, 12:28 PM
|
|
Registered User
|
|
Join Date: Apr 2012
Location: Kashan
Posts: 31

|
|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by jpollard
You are out of luck.
The space in "rm -rf /usr/lib/my_exam_app *" between the "...app" and the "*" means that /usr/lib/my_exam_app is deleted AND any files within the current working directory (the "*").
This is one of the problems Fedora is falling into by putting all its eggs in one basket (/usr). It is very difficult to recover from.
If you are developing your own applications, then they should be put in the /usr/local directory tree to isolate possible problems.
If you have a system backup (and you should), you can get the files lost from it. If you don't have a backup, you will need a list of the packages you installed to start with.
Normally you can get the list from a "yum list installed" (if the yum database has not been destroyed), and then reinstall each.
This will take a long time. The last time I did it took me some 8 hours (mostly due to the very long list... Doing them all at once is nice as many of the installed packages are dependencies of others and that would eliminate having to reinstall them).
This will not have recovered any local configurations that got deleted (that is what a system backup is for).
Other ways of handling it are to maintain/create a local repository of the installed packages. This eliminates a rather long network delay.
|
Thank you for your answer
I reinstalled 20 apps and there is no problem with my apps but the only bad thing is my bash and terminal that is not appears just like before and instead of starting like this :
Code:
[root@localhost programmer]#
It starts like this :
and this injures me and I want to fix it
|

23rd May 2012, 06:10 PM
|
|
Official Gnome 3 Sales Rep. (and Adminstrator)
|
|
Join Date: Jul 2011
Location: Leamington Spa, UK
Age: 30
Posts: 1,707

|
|
|
Re: Problem with terminal and bash
If you are certain that all the packages are fully installed, you can probably repair your shell settings by grabbing the defaults from /etc/skel:
Code:
cp /etc/skel/.bash* ~
|

23rd May 2012, 07:34 PM
|
 |
Registered User
|
|
Join Date: Sep 2009
Posts: 1,409

|
|
|
Re: Problem with terminal and bash
From rereading two of your posts, I think you are ok from a system perspective. You said in Post #12:
Code:
# cwd
/home/programmer
# rm -rf /usr/lib/my_exam_app
There is no cwd command in linux, so I'm assuming you typed the Windows equivalent of pwd by mistake. That means you were in your home directory, /home/programmer, when you typed the command in Post #15:
Code:
# rm -rf /usr/lib/my_exam_app *
What happened was the folder /user/lib/my_exam_app and all the files and folders it contained were deleted. That's what you expected and shouldn't be a problem. However, the extra space between "/usr/lib/my_exam_app" and "*" also recursively deleted all the files and folders in the current directory. Since that was /home/programmer, you did no damage to your linux install. But you did delete files in your home directory. That explains why your prompt is broken. The file "/home/programmer/.bashrc" sources the file "/etc/bashrc", which sets your prompt, PS1. Perhaps the easiest thing to do is create a new user account and compare the files in that home folder to the ones in your broken home folder. You can copy any files you need from the new account's home folder to your own.
dd_wizard
---------- Post added at 11:34 AM ---------- Previous post was at 11:32 AM ----------
Haha! Gareth got his post off before I did. His recovery suggestion will fix your .bash* files, but you may need some other hidden files and folders.
dd_wizard
|

23rd May 2012, 07:51 PM
|
 |
"Shells" (of a sub world)
|
|
Join Date: May 2011
Location: Helvetic Federation (Swissh)
Age: 33
Posts: 2,602

|
|
|
Re: Problem with terminal and bash
As the local user "programmer", where you see the bash, what is the output of:
Code:
cat /etc/passwd|grep $USER
# or as root enter:
cat /etc/passwd|grep prog
EDIT:
Oh, and about the PS1, i forgot you had (?) to export it:
export PS1
__________________
Fedora Manual: http://docs.fedoraproject.org
Script-Tools: https://sourceforge.net/projects/script-tools/
sudo st tweak repo toggle fedora-rawhide ; st iso dl-fed -respin && st iso usb
Last edited by sea; 23rd May 2012 at 07:55 PM.
|

24th May 2012, 10:11 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Location: Kashan
Posts: 31

|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by sea
As the local user "programmer", where you see the bash, what is the output of:
Code:
cat /etc/passwd|grep $USER
# or as root enter:
cat /etc/passwd|grep prog
EDIT:
Oh, and about the PS1, i forgot you had (?) to export it:
export PS1
|
Code:
bash-4.2$ cat /etc/passwd|grep $USER
programmer:x:1000:1000:Hamidreza.M:/home/programmer:/bin/bash
bash-4.2$ su
Password:
[root@localhost programmer]# cat /etc/passwd|grep prog
programmer:x:1000:1000:Hamidreza.M:/home/programmer:/bin/bash
[root@localhost programmer]#
---------- Post added at 01:41 PM ---------- Previous post was at 09:11 AM ----------
Quote:
Originally Posted by dd_wizard
From rereading two of your posts, I think you are ok from a system perspective. You said in Post #12:
Code:
# cwd
/home/programmer
# rm -rf /usr/lib/my_exam_app
There is no cwd command in linux, so I'm assuming you typed the Windows equivalent of pwd by mistake. That means you were in your home directory, /home/programmer, when you typed the command in Post #15:
Code:
# rm -rf /usr/lib/my_exam_app *
What happened was the folder /user/lib/my_exam_app and all the files and folders it contained were deleted. That's what you expected and shouldn't be a problem. However, the extra space between "/usr/lib/my_exam_app" and "*" also recursively deleted all the files and folders in the current directory. Since that was /home/programmer, you did no damage to your linux install. But you did delete files in your home directory. That explains why your prompt is broken. The file "/home/programmer/.bashrc" sources the file "/etc/bashrc", which sets your prompt, PS1. Perhaps the easiest thing to do is create a new user account and compare the files in that home folder to the ones in your broken home folder. You can copy any files you need from the new account's home folder to your own.
dd_wizard
---------- Post added at 11:34 AM ---------- Previous post was at 11:32 AM ----------
Haha! Gareth got his post off before I did. His recovery suggestion will fix your .bash* files, but you may need some other hidden files and folders.
dd_wizard
|
Thank you very much . My problem solved and there is no problem . Thank you  
|

24th May 2012, 12:47 PM
|
|
Registered User
|
|
Join Date: Dec 2008
Location: Paris, FR
Posts: 134

|
|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by Programmer
my bad on this , I did :
Code:
# rm -rf /usr/lib/my_exam_app *
Will this command influence the file and directories in /usr folder ? is it recursively go to /usr ?
( I want to know have some my files and folders in /usr folder been deleted or not ? )
|
You did delete all files & folders in the dir where you ran the rm command. From your symptoms, I'd say you did it in your home so what you've lost is your configuration files, and some other stuff probably. Anyway, you can get bash back at least by copying things over to your home from /etc/skel/ .
testdisk will let you recover some deleted files also, but no guarantees here.
|

24th May 2012, 03:19 PM
|
 |
Registered User
|
|
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,300

|
|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by jpollard
[...]
The space in "rm -rf /usr/lib/my_exam_app *" between the "...app" and the "*" means that /usr/lib/my_exam_app is deleted AND any files within the current working directory (the "*").
This is one of the problems Fedora is falling into by putting all its eggs in one basket (/usr). It is very difficult to recover from.
|
User developed or installed apps should go into /usr/local or /opt. There is NO RELATIONSHIP between this thread and F17 putting everything into /usr/lib* and /usr/bin. There is no special problem created in F17 vs earlier, since deleting /usr/lib on F16 & older distros is quite catastrophic too.
Your objection is a non-sequitur here and wrong in other contexts. You CONSTANTLY make ridiculous objections to every change in Fedora and have become little more than a Fedora hating troll. Please go find another Linux distro that doesn't include and new cutting edge changes you hate so much. You are not contributing when you merely make nonsense objections unrelated to actual problems.
Quote:
Originally Posted by Cygn
You did delete all files & folders in the dir where you ran the rm command. From your symptoms, I'd say you did it in your home so what you've lost is your configuration files, and some other stuff probably. Anyway, you can get bash back at least by copying things over to your home from /etc/skel/ .
testdisk will let you recover some deleted files also, but no guarantees here.
|
Yes - you seem to have lost all the files in your home directory.
Use these command to restore a BASIC home directory;
cd
cp -r /etc/skel/.[a-z]* .
Use a backup if you have one. develop a backup strategy if you don't.
Yes testdisk might help - but use it SOON.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
|

25th May 2012, 07:49 AM
|
|
Registered User
|
|
Join Date: Apr 2012
Location: Kashan
Posts: 31

|
|
|
Re: Problem with terminal and bash
Quote:
Originally Posted by stevea
User developed or installed apps should go into /usr/local or /opt. There is NO RELATIONSHIP between this thread and F17 putting everything into /usr/lib* and /usr/bin. There is no special problem created in F17 vs earlier, since deleting /usr/lib on F16 & older distros is quite catastrophic too.
Your objection is a non-sequitur here and wrong in other contexts. You CONSTANTLY make ridiculous objections to every change in Fedora and have become little more than a Fedora hating troll. Please go find another Linux distro that doesn't include and new cutting edge changes you hate so much. You are not contributing when you merely make nonsense objections unrelated to actual problems.
Yes - you seem to have lost all the files in your home directory.
Use these command to restore a BASIC home directory;
cd
cp -r /etc/skel/.[a-z]* .
Use a backup if you have one. develop a backup strategy if you don't.
Yes testdisk might help - but use it SOON.
|
Thank you . I did that
|

28th November 2012, 12:51 PM
|
|
Registered User
|
|
Join Date: Jul 2011
Posts: 2

|
|
|
Re: Problem with terminal and bash
thanks to all and top of the day for replies
I mistakenly deleted /etc/bashrc
but /etc/bashrc~ and /etc/bashrc~~ are still there
my terminal has also changed to $bash-4.2.
I have reinstall /etc through yum
by doing
yum reinstall /etc
what is the next thing I need to do. I was working on ns 2.34 and then there was the concluding partof installtion where one add a file
|

28th November 2012, 02:59 PM
|
 |
Administrator
|
|
Join Date: Aug 2009
Posts: 6,612

|
|
|
Re: Problem with terminal and bash
/etc/bashrc~ is probably a backup created by whatever editor you used to edit that file at some point in time.
You can probably check /etc/bashrc~ to make certain it is what you want and then copy it back to /etc/bashrc (check both /etc/bashrc~ and /etc/bashrc~~ and choose which one is closest to what ou need, copying that file back to the original)
Use a copy, not a move, and do it as root user.
cp /etc/bashrc~ /etc/bashrc
If it comes down to having to reinstall anything, then you would need to reinstall bash
yum reinstall bash
(You can't reinstall /etc with yum since /etc is not a package)
Edit:
For future reference, you would have been better off creating a new thread for this question instead of adding to an old (over 6 month old) thread. More people would have seen it and probably responded before now, especially since this thread had been marked as being solved.
Last edited by DBelton; 28th November 2012 at 03:06 PM.
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
Current GMT-time: 14:03 (Tuesday, 21-05-2013)
|
|
 |
 |
 |
 |
|
|