Basic newb question

How do I edit a file (config file, etc.) in KWrite (instead of VI) from the bash shell?

I can’t seem to “see” certain files using Dolphin and the only way I can locate/see them is using the shell but I’m a complete VI newb and would rather use KWrite for the moment.

What’s the command?

Thanks!!

Change to the required directory in your shell command line and enter:

kwrite filename &

The & at the end of the line is optional but if you give it, then the process is launched in the background automatically and you can enter the next command in the command line if you wish to…

Note this only works if you have the GUI running. If you need a simple CL editor use joe. ie joe filename

If you use KDE4…goto menue:
system filemanager filemanager-superuser mode

It worked for me

cheers
Otto

!!! make sure that you backup the original file !!!
cheers Otto

Best strategy for me is this.
Open the file, save it as xxx.old and then you can edit the file and save it to the original filename.
Perhaps you can see the settings of the editor to automatically make a backup file. Some do.

Super user mode is not the way to edit files normally unless you really require super user privileges for editing that file… Also when you edit and save a file as root and the file was previously owned by the user, now it would be owned by root and the original user can’t edit the file…

If you’re talking about hidden files (yes the ones whose file or directory name starts with a .) then there is a shortcut in Dolphin to show hidden files Alt + . or you can choose View->Show Hidden files

lots of way to skin this cat (i agree that vi is a difficult can of
worms, so keep reading):

  • set Dolphin so you can see “hidden files”

  • once you know where the file is you can pop up a run command
    (Alt+F2) and type in


kwrite [/path/filename]

or, if you need to edit a system file using root powers


kdesu kwrite [/path/filename]

and you will be asked for the root password

OR just continue to look via bash for the file and then once you
have the path you can do the SAME commands as above to launch and
edit–note that the bash terminal will remain on screen but busy and
not usable until you close kwrite–unless you add the “&” mentioned by
the other poster…like


kdesu kwrite [/path/filename] &

OR

use a cool and lightening fast terminal/bash program called Midnight
Commander as both a file manager and an editor (and other stuff) which
you can install with


sudo zypper in mc

and, then type mc at the command prompt and use the file manager
qualities to fly around the drive and then push F4 to open the easy to
use built in editor…

for more on the commander, at the command line type


man mc

but, to use mc to edit system files you will need to launch it as
root, like:


su - -c mc

personally i have this as a alias


ms='su - root -c /usr/bin/mc'

and for a root powered mc i just type ms and give my pass

lots of choices huh?
more freedom = more choices
yipee!!


DenverD
CAVEAT: http://is.gd/bpoMD [posted via NNTP w/openSUSE 10.3]

Dear dakrisht,

I hope you will find some gems in all the help above. But because of the sheer mass of them, I would specilay point you to DenverD’s remark:

  • set Dolphin so you can see “hidden files”

because as I read your first post, the fact that you want to edit files that Dolphin “does not see” is what brought you to go for a CLI and thence to your question.

Thus when you give Dolphin the right spectacles, all is solved.

Like DenveD I assume that the files Dolphin “does not see” are files with name starting with a . (dot). When you use Dolphins View menu, you will see the Show hidden files item. Use it.