command line

时间:2023-03-09 10:05:13
command line

command line

terminal <终端>

vim 编辑工具

  • vim 编辑命令

    • j 光标上移
    • k 光标下移
    • l 光标左移
    • h 光标右移
    • x / dd 删除一行
    • v 多行模式
    • :w 保存
    • :q 不保存退出 (+!强制退出)
    • :wq / :x / shift + zz 保存并推出
    • / 搜索
    • :set nu 设置行号 / : set nonu 取消行号
    • i 启动 insert 模式
    • o 创建一行,并启动insert模式
  • vim + 文件名 (进入文件编辑环境,有该文件即打开编辑,无则创建并编辑)

    • vim /etc/hosts 进入域名编辑环境
  • 查看当前启动进程

    • ps -ef 查看当前启动的所有进程
    • ps -ef | grep 查看node启动的进程号
    • kill <-9> <进程号> 杀死 <不管请求是否完成> <当前进程>
  • 编辑环境配置<配置 ll la ls>

    • 用户目录下(~)创建并编辑 .bash_profile 文件
      • 配置 ll la ls
        alias ll='ls -l'
        alias la='ls -A'
        alias l='ls -CF'
    • 命令行执行 cp/usr/share/vim/vimrc ~/.vimrc
      • 编辑.vimrc文件
        " Configuration file for vim
        set modelines=0 " CVE-2007-2438
        " Normally we use vim-extensions. If you want true vi-compatibility
        " remove change the following statements
        set nocompatible " Use Vim defaults instead of 100% vi compatibility
        set backspace=2 " more powerful backspacing
      • 设置编辑器显示样式
        syntax on
        set nu!
        set autoindent
        set tabstop=2
        set shiftwidth =2
        set ai!
        set showmatch
        set incsearch