查看: 1921|回复: 0

[教程] 【一网打尽】Raspberry Pi Course Week 2 – Day 3.0 (Editing Files)

[复制链接]
  • TA的每日心情
    开心
    2016-8-4 10:56
  • 签到天数: 242 天

    连续签到: 1 天

    [LV.8]以坛为家I

    发表于 2015-3-27 15:40:53 | 显示全部楼层 |阅读模式
    分享到:

    There are a number of text editors available for the Raspberry Pi and Linux.  Each editor has been designed for a specific purpose from general text editors and word processors to editors designed for programmers.  Emacs, vi,vim, nano and leaf pad are a few editors that each have their own unique methods of editing files.

    Today you will learn the basics of Leafpad which is not as technical as Nano but has the advantage of being visual editor with basic document styling.  Nano is more complex and has a steeper learning curve but does have the advantage of being more flexible.

    Open Leafpad by going to the Applications menu, select the Office menu and click on Leafpad.  Leafpad will open with a blank document.  Type a sentence into the document.  Adjust the font size by clicking on the Optionsmenu, click the font item.  The window that appears will allow you to modify the font size and select different fonts as well as applying varying styles.

    Select a font size of 22 and click OK.  The preview window previews the font size.  Save the document by selecting File –> Save as.  Enter the document name as suntimebox.txt and click Save.

    Close down Leafpad and re-open it.  Open the document by selecting File–>Open and select the suntimebox.txt document.  The document will appear in the window.

    To see a more complex editor at work, close down Leafpad.

    Nano is a text editor that is invoked from a terminal window.  Nano is a quick tool for editing configuration files on your Raspberry Pi so it is found in most distributions or types of Linux based operating systems.  These types are also known as flavours.

    Opening a terminal window by double clicking on the XTERM icon located on the desktop.

    lx-raspberry-pi-terminal.png


    Enter the following and press enter.

    sudo nano water.txt

    This will start Nano with a file name called water.txt.   The menu system for Nano looks a little complex to start with but you will get the hang of it.  The symbol that is represented by the ^ symbol are menu options.  For example the ^X Exit means to exit. The commands can be invoked by holding down the control key (CTRL) and pressing the letter relating to the command.  The ^Xin this instance means to hold down the control key and press the X.  This will cause the Nano text editor to exit.

    Press CTRL^X to exit.

    Start nano again but this time enter

    sudo nano sand.txt

    Enter a sentence into the editor and hold down the CTRL and press X.

    A message will appear explaining that you are exiting Nano and that you should save any changes.

    Press ‘y’ to save the file.

    The second message asks you if you want to save the file name as sand.txt.  Press enter to save the file.  To confirm that you have created a file, enter the following into the terminal.

    $cat sand.txt

    You should see the sentence that you entered appear in the terminal window.

    Now enter

    sudo nano sand.txt

    This will load the sand.txt file into nano  From here you can continue editing the file if you wish.

    There are many editors to choose from when using a Raspberry Pi and nano is a great editor learn.  Leafpad is very basic but does allow you to style documents quickly.


    回复

    使用道具 举报

    您需要登录后才可以回帖 注册/登录

    本版积分规则

    关闭

    站长推荐上一条 /4 下一条



    手机版|小黑屋|与非网

    GMT+8, 2024-11-19 13:34 , Processed in 0.118559 second(s), 16 queries , MemCache On.

    ICP经营许可证 苏B2-20140176  苏ICP备14012660号-2   苏州灵动帧格网络科技有限公司 版权所有.

    苏公网安备 32059002001037号

    Powered by Discuz! X3.4

    Copyright © 2001-2024, Tencent Cloud.