linux软件安装以及vim

linux软件安装

shell就是一个“翻译官”
让我们能与内核交流沟通:

  • shell分类
    shell

    补充知识点:
    mkdir 创建文件夹
    mkdir -p逐级创建文件夹
    rm删除非空的文件夹
    rm -r递归地删除 ,eg rm -r a/可以删除a/b/c等
    rmdir -p逐级删除文件夹
    cp复制 移动文件使用:
(base) [yangjy@GSCG01 test]$ ls #test文件夹下有两个文件
clean  sra
(base) [yangjy@GSCG01 test]$ cp -r clean/ sra/ #使用cp -r 将clean复制到sra文件夹下
(base) [yangjy@GSCG01 test]$ cd sra/   #成功!
(base) [yangjy@GSCG01 sra]$ ls
clean

cp 不能直接复制文件夹,只能直接复制文件,可以使用参数-r来辅助

(base) [yangjy@GSCG01 test]$ cp sra/ clean/
cp: omitting directory ‘sra/’ #报错
(base) [yangjy@GSCG01 test]$ cp sra/clean/ clean/
cp: omitting directory ‘sra/clean/’ #报错
(base) [yangjy@GSCG01 test]$ cp -r sra/clean/ clean/ #加上参数-r
(base) [yangjy@GSCG01 test]$ ls -lh #成功
total 0
drwxrwxr-x. 3 yangjy yangjy 19 Jan 30 09:52 clean
drwxrwxr-x. 3 yangjy yangjy 19 Jan 30 09:47 sra
环境变量
  • 如何查看环境变量----两个命令env以及export
  • 显示变量值 ----echo $变量名;一定要加上$,echo才能将变量名替换为实际变量值。
echo $PATH
/bin:/usr/bin:/home/yangjy/GEOgetools/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/GEOgetools/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/miniconda3:/root/usr/local/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/.GEOgetools/:/home/yangjy/.aspera/connect/bin/:/home/yangjy/.local/bin:/home/yangjy/bin

路径都是以bin结尾;可以通过ls 路径/bin来查看
通过ls 路径/bin | less来逐个的查看
所以,PATH存放命令的查找路径,类似快捷方式

如果出现ls无法识别;可能是破坏了环境变量,解决:PATH="路径"  eg:
PATH="/bin:/usr/bin:/home/yangjy/GEOgetools/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/GEOgetools/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/miniconda3:/root/usr/local/sratoolkit.2.10.8-centos_linux64/bin:/home/yangjy/.GEOgetools/:/home/yangjy/.aspera/connect/bin/:/home/yangjy/.local/bin:/home/yangjy/bin"
  • 配置环境变量
    -系统级配置文件: /etc/profile
- # 用户配置文件:~/.bashrc

使用vim ~/.bashrc可以进入;

  • ---> vim快捷键
    shift+g=G可以跳转最后一行
    在最后一行输入export 变量
    按ESC后 :wq保存并且退出
#通过配置该环境变量,使得重启后依然有效;
#关于vim
#使用vimtutor查看教程
===============================================================================
=    W e l c o m e   t o   t h e   V I M   T u t o r    -    Version 1.7      =
===============================================================================

     Vim is a very powerful editor that has many commands, too many to
     explain in a tutor such as this.  This tutor is designed to describe
     enough of the commands that you will be able to easily use Vim as
     an all-purpose editor.

     The approximate time required to complete the tutor is 25-30 minutes,
     depending upon how much time is spent with experimentation.

     ATTENTION:
     The commands in the lessons will modify the text.  Make a copy of this
     file to practise on (if you started "vimtutor" this is already a copy).

     It is important to remember that this tutor is set up to teach by
     use.  That means that you need to execute the commands to learn them
     properly.  If you only read the text, you will forget the commands!

     Now, make sure that your Shift-Lock key is NOT depressed and press
     the   j   key enough times to move the cursor so that Lesson 1.1
     completely fills the screen.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                        Lesson 1.1:  MOVING THE CURSOR


   ** To move the cursor, press the h,j,k,l keys as indicated. **
             ^
             k              Hint:  The h key is at the left and moves left.
       < h       l >               The l key is at the right and moves right.
             j                     The j key looks like a down arrow.
             v
  1. Move the cursor around the screen until you are comfortable.

  2. Hold down the down key (j) until it repeats.
     Now you know how to move to the next lesson.

  3. Using the down key, move to Lesson 1.2.

重点:
大写键caps lock不要打开
通过J可以移动光标。
hljk键可以左右上下移动,功能同键盘上的箭头键;


NOTE: If you are ever unsure about something you typed, press  to place
      you in Normal mode.  Then retype the command you wanted.

NOTE: The cursor keys should also work.  But using hjkl you will be able to
      move around much faster, once you get used to it.  Really!

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                            Lesson 1.2: EXITING VIM


  !! NOTE: Before executing any of the steps below, read this entire lesson!!

  1. Press the  key (to make sure you are in Normal mode).

  2. Type:      :q! .
     This exits the editor, DISCARDING any changes you have made.

  3. When you see the shell prompt, type the command that got you into this
     tutor.  That would be:     vimtutor 

  4. If you have these steps memorized and are confident, execute steps
     1 through 3 to exit and re-enter the editor.

NOTE:  :q!   discards any changes you made.  In a few lessons you
       will learn how to save the changes to a file.

  5. Move the cursor down to Lesson 1.3
#注意:如果键入了不确定的内容, press 回到正常模式,使用q!退出去。(不会保存修改)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Lesson 1.3: TEXT EDITING - DELETION


           ** Press  x  to delete the character under the cursor. **

  1. Move the cursor to the line below marked --->.

  2. To fix the errors, move the cursor until it is on top of the
     character to be deleted.

  3. Press the  x  key to delete the unwanted character.

  4. Repeat steps 2 through 4 until the sentence is correct.

---> The ccow jumpedd ovverr thhe mooon.

  5. Now that the line is correct, go on to Lesson 1.4.

NOTE: As you go through this tutor, do not try to memorize, learn by usage.



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                      Lesson 1.4: TEXT EDITING - INSERTION


                        ** Press  i  to insert text. **

  1. Move the cursor to the first line below marked --->.

  2. To make the first line the same as the second, move the cursor on top
     of the first character AFTER where the text is to be inserted.

  3. Press  i  and type in the necessary additions.

  4. As each error is fixed press  to return to Normal mode.
     Repeat steps 2 through 4 to correct the sentence.

---> There is text misng this .
---> There is some text missing from this line.

  5. When you are comfortable inserting text move to lesson 1.5.

重点:
如果想要删除某个字符/串,使用x来(是往后删除!);
按i进入编辑模式,按esc退出到浏览模式;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Lesson 1.5: TEXT EDITING - APPENDING


                        ** Press  A  to append text. **

  1. Move the cursor to the first line below marked --->.
     It does not matter on what character the cursor is in that line.

  2. Press  A  and type in the necessary additions.

  3. As the text has been appended press  to return to Normal mode.

  4. Move the cursor to the second line marked ---> and repeat
     steps 2 and 3 to correct this sentence.

---> There is some text missing from th
     There is some text missing from this line.
---> There is also some text miss
     There is also some text missing here.

  5. When you are comfortable appending text move to lesson 1.6.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Lesson 1.6: EDITING A FILE

                    ** Use  :wq  to save a file and exit. **

  !! NOTE: Before executing any of the steps below, read this entire lesson!!

  1. Exit this tutor as you did in lesson 1.2:  :q!
     Or, if you have access to another terminal, do the following there.

  2. At the shell prompt type this command:  vim tutor 
     'vim' is the command to start the Vim editor, 'tutor' is the name of the
     file you wish to edit.  Use a file that may be changed.

  3. Insert and delete text as you learned in the previous lessons.

  4. Save the file with changes and exit Vim with:  :wq  

  5. If you have quit vimtutor in step 1 restart the vimtutor and move down to the following summary.

重点:Press A 也可以进入编辑模式。与i进入编辑的区别:
i是在光标处进行编辑 ;A是在光标后进行编辑
Use :wq to save a file and exit

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                               Lesson 1 SUMMARY

  1. The cursor is moved using either the arrow keys or the hjkl keys.
         h (left)       j (down)       k (up)       l (right)

  2. To start Vim from the shell prompt type:  vim FILENAME 

  3. To exit Vim type:        :q!     to trash all changes.
             OR type:         :wq     to save the changes.

  4. To delete the character at the cursor type:  x

  5. To insert or append text type:
         i   type inserted text            insert before the cursor
         A   type appended text            append after the line

NOTE: Pressing  will place you in Normal mode or will cancel
      an unwanted and partially completed command.

使用esc在插入模式和编辑模式进行切换

                        Lesson 2.1: DELETION COMMANDS
                       ** Type  dw  to delete a word. **

  1. Press    to make sure you are in Normal mode.

  2. Move the cursor to the line below marked --->.

  3. Move the cursor to the beginning of a word that needs to be deleted.

  4. Type   dw   to make the word disappear.

  NOTE: The letter  d  will appear on the last line of the screen as you type
        it.  Vim is waiting for you to type  w .  If you see another character
        than  d  you typed something wrong; press    and start over.

---> There are a some words fun that don't belong paper in this sentence.

  5. Repeat steps 3 and 4 until the sentence is correct and go to Lesson 2.2.

使用dw 可以删除字符

                      Lesson 2.2: MORE DELETION COMMANDS


           ** Type  d$  to delete to the end of the line. **

  1. Press    to make sure you are in Normal mode.

  2. Move the cursor to the line below marked --->.

  3. Move the cursor to the end of the correct line (AFTER the first . ).

  4. Type    d$    to delete to the end of the line.

---> Somebody typed the end of this line twice. end of this line twice.
  5. Move on to Lesson 2.3 to understand what is happening.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Lesson 2.3: ON OPERATORS AND MOTIONS


  Many commands that change text are made from an operator and a motion.
  The format for a delete command with the  d  delete operator is as follows:

        d   motion

  Where:
    d      - is the delete operator.
    motion - is what the operator will operate on (listed below).

  A short list of motions:
    w - until the start of the next word, EXCLUDING its first character.
    e - to the end of the current word, INCLUDING the last character.
    $ - to the end of the line, INCLUDING the last character.

  Thus typing  de  will delete from the cursor to the end of the word.

NOTE:  Pressing just the motion while in Normal mode without an operator will move the cursor as specified.

使用 d$ (在一行前)使用,可以删除整行
使用 de (在字符前)使用,可以删除整个单词
使用 dw (在字符前)使用,可以删除一个单词

                     Lesson 2.4: USING A COUNT FOR A MOTION


   ** Typing a number before a motion repeats it that many times. **

  1. Move the cursor to the start of the line marked ---> below.

  2. Type  2w  to move the cursor two words forward.

  3. Type  3e  to move the cursor to the end of the third word forward.

  4. Type  0  (zero) to move to the start of the line.

  5. Repeat steps 2 and 3 with different numbers.

---> This is just a line with words you can move around in.

  6. Move on to Lesson 2.5.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                     Lesson 2.5: USING A COUNT TO DELETE MORE


   ** Typing a number with an operator repeats it that many times. **

  In the combination of the delete operator and a motion mentioned above you
  insert a count before the motion to delete more:
         d   number   motion

  1. Move the cursor to the first UPPER CASE word in the line marked --->.

  2. Type  d2w  to delete the two UPPER CASE words

  3. Repeat steps 1 and 2 with a different count to delete the consecutive
     UPPER CASE words with one command

--->  this ABC DE line FGHI JK LMN OP of words is Q RS TUV cleaned up.

2w ;3e ;0为移动的使用
d2w; d3e; d0 为删除的使用

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         Lesson 2.6: OPERATING ON LINES

                   ** Type  dd   to delete a whole line. **

  Due to the frequency of whole line deletion, the designers of Vi decided
  it would be easier to simply type two d's to delete a line.

  1. Move the cursor to the second line in the phrase below.
  2. Type  dd  to delete the line.
  3. Now move to the fourth line.
  4. Type   2dd   to delete two lines.

--->  1)  Roses are red,
--->  2)  Mud is fun,
--->  3)  Violets are blue,
--->  4)  I have a car,
--->  5)  Clocks tell time,
--->  6)  Sugar is sweet
--->  7)  And so are you.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                         Lesson 2.7: THE UNDO COMMAND

   ** Press  u  to undo the last commands,   U  to fix a whole line. **

  1. Move the cursor to the line below marked ---> and place it on the
     first error.
  2. Type  x  to delete the first unwanted character.
  3. Now type  u  to undo the last command executed.
  4. This time fix all the errors on the line using the  x  command.
  5. Now type a capital  U  to return the line to its original state.
  6. Now type  u  a few times to undo the  U  and preceding commands.
  7. Now type CTRL-R (keeping CTRL key pressed while hitting R) a few times
     to redo the commands (undo the undo's).

---> Fiix the errors oon thhis line and reeplace them witth undo.

  8. These are very useful commands.  Now move on to the Lesson 2 Summary.

高效删除行:dd
使用数字+dd实现多行删除
使用u进行修复,即撤销是之前的操作。

 Lesson 2 SUMMARY
  1. To delete from the cursor up to the next word type:    dw
  2. To delete from the cursor to the end of a line type:    d$
  3. To delete a whole line type:    dd

  4. To repeat a motion prepend it with a number:   2w
  5. The format for a change command is:
               operator   [number]   motion
     where:
       operator - is what to do, such as  d  for delete
       [number] - is an optional count to repeat the motion
       motion   - moves over the text to operate on, such as  w (word),
                  $ (to the end of line), etc.

  6. To move to the start of the line use a zero:  0

  7. To undo previous actions, type:           u  (lowercase u)
     To undo all the changes on a line, type:  U  (capital U)
     To undo the undo's, type:                 CTRL-R
                               Lesson 3 SUMMARY


  1. To put back text that has just been deleted, type   p .  This puts the
     deleted text AFTER the cursor (if a line was deleted it will go on the
     line below the cursor).

  2. To replace the character under the cursor, type   r   and then the
     character you want to have there.

  3. The change operator allows you to change from the cursor to where the
     motion takes you.  eg. Type  ce  to change from the cursor to the end of
     the word,  c$  to change to the end of a line.

  4. The format for change is:

         c   [number]   motion

你可能感兴趣的:(linux软件安装以及vim)