Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


  Search this Thread
Old 10-18-2010, 10:41 AM   #1
LQ Newbie
Registered: Oct 2010
Location: Ireland
Posts: 5

Rep: Reputation: 0
bash: emacs: command not found

help guys, im very new to linux!
i am using scientific linux, fedora 12
accidentaly i changed LD_LIBRARY_PATH of the root profile to a different location. so terminal cannot understand any command as i type. is there any other ways to access .bashrc file exept using editors emacs, vi, nedit. my own profile works fine but i dont have permission to access the root folder. only commands the terminal responds to are pwd, cd, echo. i dont have any clue how to restore the library because it locates here:

[root@localhost ~]# echo $PATH

[root@localhost ~]# nedit .bashrc
bash: nedit: command not found
[root@localhost ~]# ls
bash: ls: command not found
[root@localhost ~]# vi .bashrc
bash: vi: command not found
[root@localhost ~]# su
bash: su: command not found

Reinstalling linux is my last options, isnt it?

thanks for support
Old 10-18-2010, 11:12 AM   #2
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
you can simulate a copy with only bash builtins, though this form will only work with text files and you'll loose all tabs. It serves to make a backup of your .bashrc though:

{ while read line ; do echo "$line"; done } < .bashrc > bashrc.backup

then create a temporary .bashrc in a similar way

{ while read line ; do echo "$line"; done } > .bashrc

(type away, entering a correct LD_LIBRARY_PATH)

finish with ctrl-D

then login again and edit the backup, save as the original and you're done.

If i find a better way to "copy" via builtins i'll update. Also, have in mind the same technique can be used to make "sed style", stream oriented editing, using some parameter expansion trickery inside the while loop.

Last edited by Juako; 10-18-2010 at 11:23 AM. Reason: missed LD var name (had put LD_PRELOAD) :P
Old 10-18-2010, 11:13 AM   #3
LQ Guru
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 8,410

Rep: Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849Reputation: 849
try logging in as yourself then this line
su root
It will ask for a password, give it. You should then be logged in as user root with your own permissions.
Otherwise use an install cd or dvd to boot, and get a console from that (Ctrl_Atl_F2)

lastly, you can log in with
init=/bin/bash as a boot parameter and it throws you into a shell. give it a path, mount the disk (mount -a) and do stuff then
Old 10-18-2010, 11:40 AM   #4
Registered: Mar 2010
Posts: 202

Rep: Reputation: 84
Update: found the way to preserve the lines intact

simulate /bin/cat
alias cat='( IFS=$'\\n'; while read line; do echo "$line"; done ) <'
simulate /bin/cp
cat .bashrc > bashrc.backup
create new .bashrc
cat > .bashrc
(end with ctrl-D)

Last edited by Juako; 10-18-2010 at 11:41 AM. Reason: added escapings
Old 10-19-2010, 05:38 AM   #5
LQ Newbie
Registered: Oct 2010
Location: Ireland
Posts: 5

Original Poster
Rep: Reputation: 0
thank you guys! i am sure your suggestions would work perfectly. i found that emacs command is hidden in usr/bin folder, thus just run it over there and could open .bashrc file


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
bash: command not found Pengye Linux - General 5 06-01-2008 11:57 PM
bash command not found gobicse Linux - Newbie 3 12-19-2007 05:46 PM
bash: rpm: command not found && sudo: alien: command not found Java_Code Ubuntu 7 07-27-2006 11:57 PM
bash: command not found jc80 Fedora 3 03-14-2004 03:11 PM
bash: emacs: command not found appel Linux - Software 1 08-05-2003 09:18 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:42 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration