dboucher
Posts: 2
Joined: Sat Jun 23, 2012 11:54 am

edit commands

Mon Jun 25, 2012 7:55 pm

real newbie question here.

editing the config.txt file i type "sudo edit config.txt"
that gets me in, from there i am lost, through dumb luck i managed to mash enough keys down to allow me to edit it. now that i have edited it i don't know how to save/exit it. so if some one could point me to the keys/combination to allow me to edit and then to exit, i would be very grateful. also i cant seem to find the | or pipe command on the keyboard it shows up as ~... thanks

dom
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 5097
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: edit commands

Mon Jun 25, 2012 8:05 pm

nano is an easier to use editor. The important keypresses are listed at bottom of screen. So in future
sudo nano /boot/config.txt

edit - I don't know about.

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: edit commands

Mon Jun 25, 2012 8:37 pm

edit is a symlink to run-mailcap. It doesn't do what you want.

If you want you can use editor - which I cannot remember what it is by default (maybe joe).

You can change the default editor by

Code: Select all

sudo update-alternatives –config editor

dboucher
Posts: 2
Joined: Sat Jun 23, 2012 11:54 am

Re: edit commands

Mon Jun 25, 2012 8:38 pm

thanks thats much easier, still cant find the key for pipe though.

DirkS
Posts: 7415
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: edit commands

Tue Jun 26, 2012 1:57 am

dboucher wrote:still cant find the key for pipe though.
Are you using a standard US keyboard? Your linux configuration seems to be for UK layout. Try <RIGHT-ALT>+~

Gr.
Dirk

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: edit commands

Tue Jun 26, 2012 2:04 am

Another approach, if you really are lost in the world of Unix editors, is to edit it on a Windows machine. Notepad ought to work.

But then, of course, you have to beware of the fact that Windows often makes it hard to do simple ASCII text edits. This is particularly true of people who think of MS Word as the only program you'll ever need...

That, and the fact that Windows editors might put CR-LF at the end of the line, instead of just LF. Now that I think about it, I think Notepad does this (so don't use Notepad), but, I think, Wordpad (which you should always use anyway, in lieu of Notepad) doesn't.

Or you could use GVIM under Windows - which is really the best solution of all...
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: edit commands

Tue Jun 26, 2012 8:45 am

DirkS wrote:
dboucher wrote:still cant find the key for pipe though.
Are you using a standard US keyboard? Your linux configuration seems to be for UK layout. Try <RIGHT-ALT>+~
What's that supposed to do? Doesn't get a pipe on the console for me.
The right solution will be to change the keyboard map. There is a recent thread on these forums so I won't repeat the advice there.

User avatar
SN
Posts: 1012
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: edit commands

Tue Jun 26, 2012 9:04 am

pipe = "|" character = on UK keyboards that's the one (shifted) just just to the left of Z
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

User avatar
bob_binz
Posts: 373
Joined: Thu Feb 02, 2012 7:58 pm
Location: Stockport, UK

Re: edit commands

Tue Jun 26, 2012 9:37 am

Another option for "pipe" is holding <Alt> and typing 124 on the numerical keypad (not the top row numbers) although this doesn't seem to work on my daft laptop with dual purpose keys and the Fn button!

User avatar
AndrewS
Posts: 3625
Joined: Sun Apr 22, 2012 4:50 pm
Location: Cambridge, UK
Contact: Website

Re: edit commands

Tue Jun 26, 2012 12:10 pm


User avatar
Newt_Othis
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm

Re: edit commands

Tue Jun 26, 2012 12:24 pm

If you're editing Linux files via Windows, I'd recommend using Notepad++
http://notepad-plus-plus.org/

It's very user friendly and respects the format of Linux text files better than Notepad.

It's also very handy for writing Python (and other) code as it understands the structure and will colourise the text accordingly, making it easier to read.

But, as previous posters have suggested, 'nano' is nice and easy to use on the RasPi itself.

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: edit commands

Tue Jun 26, 2012 12:32 pm

heh. I don't think I could handle "nano" - I don't like WordPerfect-like editors.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: edit commands

Tue Jun 26, 2012 3:39 pm

Joe Schmoe wrote:heh. I don't think I could handle "nano" - I don't like WordPerfect-like editors.
nano isn't anything like WordPerfect. The commands bear some resemblance to WordStar.

But honestly there are 101 different editors for Linux - you should be able to find one to suit you.

User avatar
RaTTuS
Posts: 9442
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: edit commands

Tue Jun 26, 2012 3:42 pm

vi -
use it
abuse it
learn it
it's always there
2 things to remember
esc:wq <- write and exit
esc:q! <- exit don't do anything

;-p
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

User avatar
geep999
Posts: 28
Joined: Fri May 18, 2012 10:20 pm
Location: East Herts, UK
Contact: Website

Re: edit commands

Tue Jun 26, 2012 6:12 pm

joe is a nice and simple basic editor

Code: Select all

sudo apt-get install joe
ctrl k x - save and exit
ctrl c - exit
Cheers,
Peter

User avatar
jojopi
Posts: 2986
Joined: Tue Oct 11, 2011 8:38 pm

Re: edit commands

Tue Jun 26, 2012 7:19 pm

joe is a horrendous abomination

Code: Select all

sudo apt-get remove joe
;)

A list of editors in debian, and quick-reference for the commands of the two true editors, emacs and vi: http://qref.sourceforge.net/quick/ch-edit.en.html

(I can not find the above in the current version of the debian reference.)

User avatar
Newt_Othis
Posts: 20
Joined: Tue Dec 06, 2011 1:12 pm

Re: edit commands

Tue Jun 26, 2012 8:52 pm

I'm always impressed at how passionate people can get about a text editor! :D

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: edit commands

Tue Jun 26, 2012 9:46 pm

Newt_Othis wrote:I'm always impressed at how passionate people can get about a text editor! :D
As a developer, it is what you spend most of your time in. It had better be good.
It's like your bed; you spend a lot of time there, you want it to be comfortable. And what is comfortable is a very personal decision.

P.S. Yes, I misspoke. I meant Word*, not WordPerfect. Sorry 'bout 'dat.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

User avatar
jojopi
Posts: 2986
Joined: Tue Oct 11, 2011 8:38 pm

Re: edit commands

Tue Jun 26, 2012 10:37 pm

Actually it is the abominable joe (no relation) that borrows its keystrokes (in the default, jstar, mode) from wordstar. (A decision that looks increasing weird, especially for beginners, since nobody under thirty has even heard of wordstar. Maybe in its jmacs and jpico modes it is not so ripe for uninstallation.)

nano's commands are based on those of pico, the composer of the old mail client, pine (which lives on as alpine). They are a very small subset of emacs' commands, with a few of the keystrokes repurposed as exit, save, etc. (to avoid multi-character sequences) and then back-named as "write^Out" to make them seem logical.

nano is actually very good for beginners (unlike joe), and it is also fine for casual editing of human text files and for small configuration files like /boot/config.txt. It even has basic syntax highlighting. Where it loses out to the real editors is that is has no advanced features (like regular expressions) at all.

W. H. Heydt
Posts: 7314
Joined: Fri Mar 09, 2012 7:36 pm
Location: Vallejo, CA (US)

Re: edit commands

Wed Jun 27, 2012 12:39 am

I'll second the vote for vi. But then, I learned to use vi on an ADM-3A in bsd 2.9 unix on a PDP-11/70....

Return to “Beginners”

Who is online

Users browsing this forum: No registered users and 39 guests