LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 03-26-2007, 08:34 PM   #1
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
BASH command for open file


I'm having a mind blank. What is the BASH command for opening a file? I need to open yum.conf as root and can't remember the command for opening a file. I know in Ubuntu its apt-get, but the CentOS terminal doesn't like it.
 
Old 03-26-2007, 08:49 PM   #2
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Hi.

vi / emacs / nano / pico. Or ed if you're feeling hardcore.

Dave.
 
Old 03-26-2007, 09:08 PM   #3
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
OK, maybe I should rephrase the question. I don't want to look at its code, I want to open it with a text editor as root. How do I do that?
 
Old 03-26-2007, 09:16 PM   #4
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Confusion reigns.

The utilities I mentioned are all text editors. yum.conf has no code - it's a text file.

If you need to go root, do 'su', then open the file in one of the above editors, or maybe gedit, or perhaps kate.

Dave
 
Old 03-26-2007, 09:25 PM   #5
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
So I would type "kate yum.conf"? gedit doesn't work.
 
Old 03-26-2007, 09:27 PM   #6
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
If kate is installed, then yes.
 
Old 03-26-2007, 09:31 PM   #7
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
no kate. what about joe? or Emacs?
 
Old 03-26-2007, 09:33 PM   #8
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Yeah. Whatever you've got.
 
Old 03-26-2007, 09:33 PM   #9
Zention
Member
 
Registered: Mar 2007
Posts: 119

Rep: Reputation: 16
su -
$EDITOR /etc/yum.conf

This assumes that $EDITOR is setup.

Not sure why you are mentioning BASH, I assume you mean command line.

To read a file's contents using bash it would be:

echo $(</etc/yum.conf)
 
Old 03-26-2007, 09:41 PM   #10
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
It is still opening it in the terminal, not showing anything. Can I run as root somehow and just click on the document?
 
Old 03-26-2007, 09:43 PM   #11
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
Code:
su -
nautilus
or
Code:
su -
konqueror
 
Old 03-26-2007, 09:52 PM   #12
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
OK, using emacs, I can open it, but unless I am root, it will not save changes. The file on right-click gave the option open with emacs.
 
Old 03-26-2007, 09:55 PM   #13
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
So do 'su -', then run 'nautilus' (if you're using GNOME) or 'konqueror' (if you're using KDE), then do right-click->Emacs on the file, and Emacs will be running as root, so will save changes.

After 516 posts, have you honestly never had to edit a file as root before?
 
Old 03-26-2007, 09:58 PM   #14
phantom_cyph
Senior Member
 
Registered: Feb 2007
Location: West Africa
Distribution: Slackware/Debian (when necessary)
Posts: 2,464

Original Poster
Blog Entries: 1

Rep: Reputation: 127Reputation: 127
Not in CentOS. In Ubuntu, I just logged in as root once I logged in as my user, and edited it. The problem is, I am using XCFE right now. Maybe I should switch back to KDE real quick...
 
Old 03-26-2007, 10:03 PM   #15
ilikejam
Senior Member
 
Registered: Aug 2003
Location: Glasgow
Distribution: Fedora / Solaris
Posts: 3,109

Rep: Reputation: 97
If you're OK with emacs, then just do the following in a shell from KDE, or XFCE
Code:
su -
<password>
emacs /etc/yum.conf
 
  


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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash command/script to return group of file IHateFriction Programming 3 03-09-2007 12:31 PM
Getting a remote file 'http://...' with a bash command gletare Linux - Software 9 11-29-2006 11:03 AM
bash script - open new window running a command zippity Linux - Newbie 1 07-13-2004 11:16 AM
re: how do I open file from command line ergo_sum Linux - Newbie 7 10-29-2003 11:35 AM
linux command error message bash: /usr/bin/find: No such file or directory sundaram123 Linux - General 8 04-02-2002 07:18 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 05:00 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
Open Source Consulting | Domain Registration