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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
10-29-2003, 09:12 AM
|
#1
|
Member
Registered: Aug 2003
Posts: 253
Rep:
|
re: how do I open file from command line
Oh the shame of it!!
How do I open grub.conf from the command line? I know how to cd there (cd /etc), but don't know how to open the file from the prompt. Too dependent on gui.
Thanks,
ergo_sum
|
|
|
10-29-2003, 09:14 AM
|
#2
|
LQ 5k Club
Registered: Oct 2003
Location: Western Australia
Distribution: Icewm
Posts: 5,842
Rep: 
|
i use mdk, to read but not edit
cat /directory/filename
to edit read the vim tutorial or man vim etc
vim /directory/filename
|
|
|
10-29-2003, 09:15 AM
|
#3
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
You need to use an editor like vi, emacs,joe, jove (there are plenty)
General syntax (vi can be substituted with any editor you choose):
$ vi <file-to-edit>
|
|
|
10-29-2003, 09:45 AM
|
#4
|
Member
Registered: May 2003
Location: philadelhpia pa
Posts: 92
Rep:
|
if you only need to VIEW the file
theres more (may be linked to pg too)
more file_name
|
|
|
10-29-2003, 10:32 AM
|
#5
|
Member
Registered: Aug 2003
Posts: 253
Original Poster
Rep:
|
Thanks all.
ergo_sum
|
|
|
10-29-2003, 10:33 AM
|
#6
|
Member
Registered: Aug 2003
Posts: 253
Original Poster
Rep:
|
PS:
Can I edit a file through 'cat'?
Command line access was because I had to su to get there, and I didn't want to log-off and then log-on as root.
ergo_sum
|
|
|
10-29-2003, 11:23 AM
|
#7
|
Senior Member
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113
Rep: 
|
Yeah - cat > file
then just type until done and hit ctrl-d. And I'd use less to view it because, well, less is more.
Not sure I followed the last bit, but you can launch an X app as root from an xterm.
-- Duh - you can *create* a file with cat. To edit it, you'd have to use ed or sed. *g*
Last edited by slakmagik; 10-29-2003 at 11:24 AM.
|
|
|
10-29-2003, 11:35 AM
|
#8
|
LQ Veteran
Registered: Sep 2003
Posts: 10,532
|
One small other nitpick:
cat > file => creates the file or overwrites, so you always start with a empty file.
cat >> file => append to file or create if it doesn't excists.

|
|
|
All times are GMT -5. The time now is 11:36 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|