Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230
editing .conf files from CLI
-
- Posts: 13
- Joined: 2010-07-18 15:02
editing .conf files from CLI
hello
i was wondering how can i edit a .conf file using the debian CLI
i tried doing it by accessing to the file graphically, but it wouldn't allow me to do changes on it, since i should have access as root
so i'm root on CLI, but the problem is i don't know how to edit the file from there (by "edit the file" i mean insert configuration lines in it)
anyone can help?
thanks
i was wondering how can i edit a .conf file using the debian CLI
i tried doing it by accessing to the file graphically, but it wouldn't allow me to do changes on it, since i should have access as root
so i'm root on CLI, but the problem is i don't know how to edit the file from there (by "edit the file" i mean insert configuration lines in it)
anyone can help?
thanks
-
- Posts: 13
- Joined: 2010-07-18 15:02
Re: editing .conf files from CLI
thanks a lot
i also encountered something called "gedit <filename>", it opens the file in graphic mode, but with root privileges (if executed as root)
i also encountered something called "gedit <filename>", it opens the file in graphic mode, but with root privileges (if executed as root)
Re: editing .conf files from CLI
gedit is a gui-editor.
To start it as you you will have to open it with gksu:
Or
and open the file from the menu-bar. You might also do both commands from a command-prompt.
There is a howto about opening gui-apps as root in the how-to-section (by craigevil). I will add the link in a sec.
Voila, i am back:
http://forums.debian.net/viewtopic.php?f=16&t=53366
To start it as you you will have to open it with gksu:
Code: Select all
gksu gedit <filename>
Code: Select all
gksu gedit
There is a howto about opening gui-apps as root in the how-to-section (by craigevil). I will add the link in a sec.
Voila, i am back:
http://forums.debian.net/viewtopic.php?f=16&t=53366
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.
- Telemachus
- Posts: 4574
- Joined: 2006-12-25 15:53
- Been thanked: 2 times
Re: editing .conf files from CLI
If it's an important file (this is a general tip, not just for .conf files), and you are not very comfortable with the CLI, you should always make a backup first.
Here's one way to do that:
That makes a copy of the file with a simple datestamp in your home directory. After you make the copy, you can switch to root (if needed) and edit however you like. If things go very wrong, you still have the backup.
Here's one way to do that:
Code: Select all
cp -v /path/to/file.conf ~/file.conf-$(date "+%Y-%m-%d")
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
-
- Posts: 13
- Joined: 2010-07-18 15:02
- Telemachus
- Posts: 4574
- Joined: 2006-12-25 15:53
- Been thanked: 2 times
Re: editing .conf files from CLI
You're welcome. Now that I think of it, I just wrote up a more detailed walk-through of this kind of thing in another thread. Check that out if you think it may help. For what it's worth, I think every Debian user should have at least a basic comfort level editing files in the CLI, just in case something ever happens and you can't get at the GUI. But there's certainly nothing wrong with using Gedit for most of your work.
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
-
- Posts: 134
- Joined: 2009-08-29 19:42
- Location: Austin, TX
Re: editing .conf files from CLI
::looks down in guilt::Telemachus wrote:But there's certainly nothing wrong with using Gedit for most of your work.
I just like the syntax highlighting...
- Telemachus
- Posts: 4574
- Joined: 2006-12-25 15:53
- Been thanked: 2 times
Re: editing .conf files from CLI
Hmm. Vim and Emacs do that, no? (In the terminal, too. And in a modern terminal, you can usually get 256 color support as well.)jollysnowman wrote:::looks down in guilt::Telemachus wrote:But there's certainly nothing wrong with using Gedit for most of your work.
I just like the syntax highlighting...
"We have not been faced with the need to satisfy someone else's requirements, and for this freedom we are grateful."
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
Dennis Ritchie and Ken Thompson, The UNIX Time-Sharing System
-
- Posts: 134
- Joined: 2009-08-29 19:42
- Location: Austin, TX
Re: editing .conf files from CLI
vim can do that? I guess I never bothered to look into it. And I never got used to emacs; I learned vi first and the emacs commands just felt unnatural.
Re: editing .conf files from CLI
jollysnowman wrote:vim can do that? I guess I never bothered to look into it. And I never got used to emacs; I learned vi first and the emacs commands just felt unnatural.
http://a.imageshack.us/img821/5853/editorshigh.png
left side: gedit. Top: gedit itself. Bottom: embedded-terminal in gedit with vim.
right site: terminal. Top: nano. Bottom: the missing emacs.
The question is not: which one has highlighting, but is there any editor out there without it?
Those commands:
http://forums.debian.net/viewtopic.php? ... 15#p309829
should get you going.
Two links:
http://www.swaroopch.com/notes/Vim
ftp://ftp.vim.org/pub/vim/doc/book/vimbook-OPL.pdf
I like gedit too.
"I am not fine with it, so there is nothing for me to do but stand aside." M.D.