LinuxQuestions.org
Help answer threads with 0 replies.
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 10-18-2010, 11:41 AM   #1
konildi
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
/usr/local/src/root/bin:

[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, 12:12 PM   #2
Juako
Member
 
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 12:23 PM. Reason: missed LD var name (had put LD_PRELOAD) :P
 
Old 10-18-2010, 12:13 PM   #3
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 7,564

Rep: Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696Reputation: 696
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, 12:40 PM   #4
Juako
Member
 
Registered: Mar 2010
Posts: 202

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

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

Last edited by Juako; 10-18-2010 at 12:41 PM. Reason: added escapings
 
Old 10-19-2010, 06:38 AM   #5
konildi
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
 
  


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


All times are GMT -5. The time now is 12:45 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