[关闭]
@mrz1 2018-01-01T14:17:39.000000Z 字数 13640 阅读 734

linux-命令

笔记

主要内容

  • linux-命令杂项

CMD命令:

  1. convert E:/fs:ntfs E盘装换NTFS格式
  2. Ping 192.168.139.130
  3. $ tasklist 查看进程

hash命令学习

  1. [root@zhang user1]# help hash
  2. hash: hash [-lr] [-p pathname] [-dt] [name ...]
  3. Remember or display program locations.
  4. Options:
  5. -d forget the remembered location of each NAME 清空指定的命令hash
  6. -l display in a format that may be reused as input 显示所有的
  7. -p pathname use PATHNAME is the full pathname of NAME
  8. -r forget all remembered locations 清空所有命令的hash
  9. -t print the remembered location of each NAME, preceding
  10. each location with the corresponding NAME if multiple
  11. NAMEs are given 打印hash记录的命令位置

history命令学习

  1. [root@zhang user1]# help history
  2. history: history [-c] [-d offset] [n] or history -anrw [filename] or history -ps arg [arg...]
  3. Display or manipulate the history list.
  4. Display the history list with line numbers, prefixing each modified
  5. entry with a `*'. An argument of N lists only the last N entries.
  6. Options:
  7. -c clear the history list by deleting all of the entries 清空命令历史
  8. -d offset delete the history entry at offset OFFSET. 删除指定位置的命令历史
  9. -a append history lines from this session to the history file 追加历史行到历史文件中
  10. -n read all history lines not already read from the history file 从历史文件中读取所有命令历史
  11. -r read the history file and append the contents to the history
  12. list 读取所有命令历史文件追加history 列表中
  13. -w write the current history to the history file
  14. and append them to the history list 写当前的历史记录到文件中去
  15. -p perform history expansion on each ARG and display the result
  16. without storing it in the history list
  17. -s append the ARGs to the history list as a single entry
  18. If FILENAME is given, it is used as the history file. Otherwise,
  19. if $HISTFILE has a value, that is used, else ~/.bash_history.
  20. If the $HISTTIMEFORMAT variable is set and not null, its value is used
  21. as a format string for strftime(3) to print the time stamp associated
  22. with each displayed history entry. No time stamps are printed otherwise.

命令历史

环境变量
  • HISTSIZE:命令历史的条数
  • HISTFILE:默认为~/.bash_history
  • HISTFILESIZE:HISTFILE文件记录历史的条数
history 常用命令
  • -d: 删除指定的命令
  • -c:清空命令
  • -a:手工追加当前会话的命令历史到历史文件中去
  • n :显示最近的n条命令
调用历史命令
  • !#:重复执行第#条命令
  • !!:重复执行上一条命令
  • !str:执行指定str开头的命令(最后一个)
  • !?:获得最后执行的状态码
控制命令历史的记录方式

主要和HISTCONTROL这个环境变量有关(/etc/profile

  • ignoredups:忽略重复
  • ignorespace:忽略空白开头
  • ignoreboth:上面2个都启用

ls

  1. NAME
  2. ls - list directory contents 列出目录的内容
  3. SYNOPSIS
  4. ls [OPTION]... [FILE]...
  5. DESCRIPTION
  6. List information about the FILEs (the current directory by default). Sort
  7. entries alphabetically if none of -cftuvSUX nor --sort is specified.
  8. Mandatory arguments to long options are mandatory for short options too.
  9. -a, --all
  10. do not ignore entries starting with . 列出所有的, 包括隐藏文件
  11. -A, --almost-all
  12. do not list implied . and .. 列出所有文件, 不包括.和..这2
  13. --author
  14. with -l, print the author of each file 列出作者
  15. -b, --escape
  16. print C-style escapes for nongraphic characters 打印非打印符号用c-style
  17. --block-size=SIZE
  18. scale sizes by SIZE before printing them; e.g., '--block-size=M' prints
  19. sizes in units of 1,048,576 bytes; see SIZE format below 指定大小单位
  20. -B, --ignore-backups
  21. do not list implied entries ending with ~ 不列出结尾是~的条目
  22. -c with -lt: sort by, and show, ctime (time of last modification of file
  23. status information); with -l: show ctime and sort by name; otherwise:
  24. sort by ctime, newest first
  25. -C list entries by columns 列方式列出条目
  26. --color[=WHEN]
  27. colorize the output; WHEN can be 'never', 'auto', or 'always' (the
  28. default); more info below 设置输出颜色
  29. -d, --directory
  30. list directories themselves, not their contents 列出目录自身
  31. -D, --dired
  32. generate output designed for Emacs' dired mode 列出emacs目录模式
  33. -f do not sort, enable -aU, disable -ls --color 不做排序
  34. -F, --classify
  35. append indicator (one of */=>@|) to entries 在目录后面添加/
  36. --file-type
  37. likewise, except do not append '*'
  38. --format=WORD
  39. across -x, commas -m, horizontal -x, long -l, single-column -1, verbose
  40. -l, vertical -C
  41. --full-time
  42. like -l --time-style=full-iso
  43. -g like -l, but do not list owner 不列出所有者
  44. --group-directories-first
  45. group directories before files; 先列目录,在列出文件
  46. can be augmented with a --sort option, but any use of --sort=none (-U)
  47. disables grouping
  48. -G, --no-group
  49. in a long listing, don't print group names 不打印组名字
  50. -h, --human-readable 文件大小自动调整为合适单位
  51. with -l, print sizes in human readable format (e.g., 1K 234M 2G)
  52. --si likewise, but use powers of 1000 not 1024 使用1000作为k,m的换算单位而不是1024
  53. -H, --dereference-command-line
  54. follow symbolic links listed on the command line 追踪符号连接
  55. --dereference-command-line-symlink-to-dir
  56. follow each command line symbolic link
  57. that points to a directory
  58. --hide=PATTERN
  59. do not list implied entries matching shell PATTERN (overridden by -a or
  60. -A) 不列出匹配的正则
  61. --indicator-style=WORD
  62. append indicator with style WORD to entry names: none (default), slash
  63. (-p), file-type (--file-type), classify (-F)
  64. -i, --inode
  65. print the index number of each file 打印inode
  66. -I, --ignore=PATTERN
  67. do not list implied entries matching shell PATTERN 不列出匹配的正则
  68. -k, --kibibytes
  69. default to 1024-byte blocks for disk usage
  70. -l use a long listing format 使用长格式显示
  71. -L, --dereference
  72. when showing file information for a symbolic link, show information for
  73. the file the link references rather than for the link itself 符号链接,显示连接到的文件
  74. -m fill width with a comma separated list of entries 条目逗号分割
  75. -n, --numeric-uid-gid
  76. like -l, but list numeric user and group IDs 类似-l,只是用户名和组使用数字,而不是名字
  77. -N, --literal
  78. print raw entry names (don't treat e.g. control characters specially)
  79. -o like -l, but do not list group information 不列出组信息
  80. -p, --indicator-style=slash
  81. append / indicator to directories 追加/在目录后面
  82. -q, --hide-control-chars
  83. print ? instead of nongraphic characters 打印?而不是不可打印的符号
  84. --show-control-chars
  85. show nongraphic characters as-is (the default, unless program is 'ls'
  86. and output is a terminal)
  87. -Q, --quote-name
  88. enclose entry names in double quotes 双引号包住列出的条目
  89. --quoting-style=WORD
  90. use quoting style WORD for entry names: literal, locale, shell,
  91. shell-always, c, escape
  92. -r, --reverse
  93. reverse order while sorting 反向排序
  94. -R, --recursive
  95. list subdirectories recursively 递归列出子目录
  96. -s, --size
  97. print the allocated size of each file, in blocks 打印分配的大小
  98. -S sort by file size 排序文件大小
  99. --sort=WORD
  100. sort by WORD instead of name: none (-U), size (-S), time (-t), version
  101. (-v), extension (-X)
  102. --time=WORD
  103. with -l, show time as WORD instead of default modification time: atime
  104. or access or use (-u) ctime or status (-c); also use specified time as
  105. sort key if --sort=time
  106. --time-style=STYLE
  107. with -l, show times using style STYLE: full-iso, long-iso, iso, locale,
  108. or +FORMAT; FORMAT is interpreted like in 'date'; if FORMAT is FOR‐
  109. MAT1<newline>FORMAT2, then FORMAT1 applies to non-recent files and FOR‐
  110. MAT2 to recent files; if STYLE is prefixed with 'posix-', STYLE takes
  111. effect only outside the POSIX locale
  112. -t sort by modification time, newest first 排序按照mtime
  113. -T, --tabsize=COLS
  114. assume tab stops at each COLS instead of 8
  115. -u with -lt: sort by, and show, access time; with -l: show access time and
  116. sort by name; otherwise: sort by access time
  117. -U do not sort; list entries in directory order 按照目录的顺序累出
  118. -v natural sort of (version) numbers within text
  119. -w, --width=COLS
  120. assume screen width instead of current value 指定宽度
  121. -x list entries by lines instead of by columns
  122. -X sort alphabetically by entry extension 按照扩展排序
  123. -1 list one file per line 每行列出一个文件
  124. SELinux options:
  125. --lcontext
  126. Display security context. Enable -l. Lines will probably be too wide
  127. for most displays.
  128. -Z, --context
  129. Display security context so it fits on most displays. Displays only
  130. mode, user, group, security context and file name.
  131. --scontext
  132. Display only security context and file name.
  133. --help display this help and exit
  134. --version
  135. output version information and exit

ls -l列出的信息说明

  1. [root@zhang ~]# ls -l
  2. total 16
  3. -rw-r--r-- 1 root root 154 Sep 25 19:34 adduserbat.sh
  4. -:文件类型
  5. rw-r--r--:权限
  6. 1 文件被硬连接的次数
  7. root:文件的owner
  8. root:文件的group
  9. 154:文件的大小
  10. Sep 25 19:34 文件最近修改的时间
  11. adduserbat.sh 文件名字

cat

  1. NAME
  2. cat - concatenate files and print on the standard output
  3. SYNOPSIS
  4. cat [OPTION]... [FILE]...
  5. DESCRIPTION
  6. Concatenate FILE(s), or standard input, to standard output.
  7. -A, --show-all
  8. equivalent to -vET 显示所有
  9. -b, --number-nonblank
  10. number nonempty output lines, overrides -n 编号非空行不编号
  11. -e equivalent to -vE
  12. -E, --show-ends
  13. display $ at end of each line 每行结尾追加一个$
  14. -n, --number
  15. number all output lines 每行添加一个行号
  16. -s, --squeeze-blank
  17. suppress repeated empty output lines 压缩重复的空行
  18. -t equivalent to -vT
  19. -T, --show-tabs
  20. display TAB characters as ^I
  21. -u (ignored)

echo

  1. NAME
  2. echo - display a line of text 显示一行文本
  3. SYNOPSIS
  4. echo [SHORT-OPTION]... [STRING]...
  5. echo LONG-OPTION
  6. DESCRIPTION
  7. Echo the STRING(s) to standard output.
  8. -n do not output the trailing newline 不显示自动换行
  9. -e enable interpretation of backslash escapes 启动转义符
  10. -E disable interpretation of backslash escapes (default) 关闭转义符
  11. --help display this help and exit
  12. --version
  13. output version information and exit
  14. If -e is in effect, the following sequences are recognized:
  15. \\ backslash 打印\
  16. \a alert (BEL) 警钟声音
  17. \b backspace 删除一个字符
  18. \c produce no further output
  19. \e escape
  20. \f form feed
  21. \n new line 新行
  22. \r carriage return 回车符
  23. \t horizontal tab 制表符
  24. \v vertical tab 水平制表符

echo 打印颜色符号

  1. [root@zhang ~]# echo -e "\033[34mOk\033[0m"
  2. Ok(这个字体是带颜色的)

颜色控制

  1. \033[##m:控制颜色
  2. 第一个#:控制字体的前景色
  3. 第二个#:控制字体的背景色
  4. 如果同时使用前景和背景色:\033[3#:4#m
  5. \033[0m:关闭字体功能

which

  1. [root@zhang ~]# which ls
  2. alias ls='ls --color=auto'
  3. /usr/bin/ls
  4. [root@zhang ~]# which ls --skip-alias
  5. /usr/bin/ls

whatis

  1. [root@zhang ~]# whatis ls
  2. ls (1) - list directory contents
  3. ls (1p) - list directory contents

Linux命令

  1. 多个命令可以用;符号分开
  2. 一个命令可以用\分成多行
  3. Shift+pgup向上翻页
  4. Shift+pgDn向下翻页
  5. $ cat /proc 查看进程文件
  6. Ctrl+d 退出
  7. $ ifconfig 查看ip
  8. $ pwd 查看完整目录
  9. $ lscpu
  10. $ cat /proc/partitions 查看分区
  11. $ echo '- - -' > /sys/class/scsi_host/host0/scan 扫描硬盘做实验用的
  12. $ ls /dev/sd* 查看分区
  13. $ cat /etc/centos-release 查看centos版本
  14. $ uname -r 内核版本
  15. $ rpm -qi kernel
  16. $ cd /bin 各种小工具
  17. $ bc 计算器 obase=8 八进制
  18. $ echo 8*9|bc 直接输出结果 组合工具
  19. $ shalsum /dev/sro 查看镜像是否损坏
  20. $ free 查看内存
  21. $ free -m MB查看内存
  22. $ cat /proc/meminfo 查看总内存
  23. $ lsblk 查看硬盘
  24. $ df -h
  25. $ halt 关机 6上面关机断电7之关机
  26. $ poweroff 关机断电
  27. $ whoami 查看当前用户
  28. $ tty 第几个终端
  29. $ halt 关机
  30. $ init 0 相当poweroff关机
  31. $ init 6 相当reboot 重启计算机
  32. 重启: reboot
  33. -f: 强制,不调用shutdown
  34. -p: 切断电源
  35. $ init 3 关闭图形切换纯字符页面
  36. $ init 5 打开图形切换纯字符页面
  37. $ startx 也是打开图形
  38. $ runlevel 查看从3切换而来 上次没有事N
  39. $ who -r 查看从3切换而来 上次没有事N 更详细
  40. $ who am i
  41. $ who 多少终端登录
  42. $ cat $SHELL 当前使用的shell
  43. $ cat /etc/shells 查看系统使用的所有shell
  44. $ > a 创建一个a文件
  45. $ history 查看历史
  46. $ strace 查看系统调用
  47. $ ltrace 查看库函数
  48. $ echo $PS1 显示提示符格式
  49. $ exit 退出
  50. $ gedit 图形工具记事本
  51. $ nano 修改文本
  52. $ rz :上传文件
  53. $ nano /etc/profile.d/env.sh 配置颜色
  54. PS1="\[\e[1;32m\][\u@\h \W]\\$\[\e[0m\]"
  55. $ makewhatis
  56. $ touch 创建新文件
  57. $ info 查看帮助用法
  58. $ iconv 编码 iconv -f gb2312 课堂笔记.txt 转换
  59. $ chvt 3切换终端
  60. $ reset 重置 timedatectl set-teimzone PACIFIC/TONGATAPU 设置时区
  61. $ 时区修改 centos7:timedatectl centos6:tzselect
  62. $ tz:windows上传到linux
  63. $ sz:linux传输文件到windows
  64. $ cat /etc/motd 登陆成功提示
  65. $ nano /etc/gdm/custom.conf 修改这个文件图形界面不用输入密码
  66. AutomaticLoginEnable=true
  67. AutomaticLogin=root
  68. $help 内部命令列表
  69. $enable cmd 启用内部命令
  70. $enable n cmd 禁用内部命令
  71. $enable n 查看所有禁用的内部命令
  72. hash常见用法
  73. $ hash 显示hash缓存
  74. $ hash l 显示hash缓存,可作为输入使用
  75. $ hash p path name 将命令全路径path起别名为name
  76. $ hash t name 打印缓存中name的路径
  77. $ hash d name 清除name缓存
  78. $ hash r 清除缓存
  79. $ which ls 查看缩写
  80. $ alias cdnet="cd /etc/sysconfig/network-scripts/" 定义别名 别名优先级最高
  81. $ unalias cdnet 取消别名
  82. $ nano .bashrc 修改别名文件永久保存
  83. $ souce 修改文件立马生效
  84. $ . .bashrc 修改文件立马生效
  85. 如果别名与内部命令有冲突,`ifconfig`这样写就没没事了
  86. 如果别名同原命令同名,如果要执行原命令,可使用
  87. \COMMAND
  88. `COMMAND`
  89. /PATH/COMMAND:外部命令
  90. $ nano /etc/bashrc 所有用户都能用自己修改的别名
  91. $ ps a
  92. $ id -u root
  93. $ w 查看所有用户在做什么
  94. $ nano /etc/issue 提示信息
  95. $rpm -i /run/media/fei/CentOS\ 7\ x86_64/Packages/screen-4.1.0-0.23.20120314git3c2946.el7_2.x86_64.rpm 安装插件
  96. $ 创建会话 screen -S help help起的名字
  97. $ 对方搜索会话 screen -ls 在连接会话 screen -x help
  98. $ 退出会话 ctrl+a+d
  99. $ exit全部退出
  100. $ echo -e "\a" 提示声音
  101. $ echo -e '1234\b\b\b56789' 显示156789
  102. $ echo -n abc 不换行
  103. $ echo -e '123\r456789' 覆盖前面显示456789
  104. $ echo -e '123\t456789' 相当于空格,不同系统不一定是几个空格123 456789
  105. $ echo -e '\033[43;31;5mmagedu\033[0m' 带颜色的字
  106. $ echo {1..20..2} 打印1 3 5 7 9 11 13 15 17 19
  107. 刚安装后不可立即使用
  108. makewhatis 6|7 mandb制作数据库
  109. 使用示例查看帮助:
  110. $ whatis cal $ man f cal
  111. 下载bash到电脑
  112. $ man bash >bash.txt
  113. $ sz bash.txt
  114. cd /usr/share/doc 这个目录下是所有的文档的说明
  115. $ sosreport 收集信息发送给红帽
  116. 重复前一个命令,有4种方法
  117. 重复前一个命令使用上方向键,并回车执行
  118. !! 并回车执行
  119. 输入 !-1 并回车执行
  120. Ctrl+p 并回车执行
  121. !:0 执行前一条命令(去除参数)
  122. Ctrl + n 显示当前历史中的下一条命令,但不执行
  123. !n 执行history命令输出对应序号n的命令
  124. !-n 执行history历史中倒数第n个命令
  125. !string 重复前一个以“string”开头的命令
  126. !?string 重复前一个包含string的命令
  127. !string:p 仅打印命令历史,而不执行
  128. !$:p 打印输出 !$ (上一条命令的最后一个参数)的内容
  129. !*:p 打印输出 !*(上一条命令的所有参数)的内容
  130. ^string 删除上一条命令中的第一个string
  131. ^string1^string2 将上一条命令中的第一个string1替换为
  132. string2
  133. !:gs/string1/string2 将上一条命令中所有的string1都替换
  134. string
  135. ctrl-r来在命令历史中搜索命令
  136. reverse-i-search
  137. Ctrl+g:从历史搜索模式退出
  138. 要重新调用前一个命令中最后一个参数:
  139. !$ 表示
  140. Esc, .(点击Esc键后松开,然后点击 . 键)
  141. Alt+ .(按住Alt键的同时点击 . 键)
  142. command !^ : 利用上一个命令的第一个参数做cmd的参数
  143. command !$ : 利用上一个命令的最后一个参数做cmd的参数
  144. command !* : 利用上一个命令的全部参数做cmd的参数
  145. command !:n : 利用上一个命令的第n个参数做cmd的参数
  146. command !n:^ 调用第n条命令的第一个参数
  147. command !n:$ 调用第n条命令的最后一个参数
  148. command !n:m 调用第n条命令的第m个参数
  149. command !n:* 调用第n条命令的所有参数
  150. $ history 查看历史 内部命令
  151. $ history -c 清空内存里面历史
  152. 先执行 > .bash_history 在执行history -c
  153. $ !8 根据编号执行编号的命令
  154. 内存上默认存储多少echo $HISTSIZE 修改文件cat /etc/profile
  155. 文件上默认存储多少echo $HISTFiLESIZE
  156. 显示历史文件 $ echo $HISTFILE
  157. history -ps arg [arg...]
  158. -c: 清空命令历史
  159. -d offset: 删除历史中指定的第offset个命令
  160. n: 显示最近的n条历史
  161. -a: 追加本次会话新执行的命令历史列表至历史文件
  162. -r: 读历史文件附加到历史列表
  163. -w: 保存历史列表到指定的历史文件
  164. -n: 读历史文件中未读过的行到历史列表
  165. -p: 展开历史参数成多行,但不存在历史列表中
  166. -s: 展开历史参数成一行,附加在历史列表后
  167. HISTSIZE:命令历史记录的条数
  168. HISTFILE:指定历史文件,默认为~/.bash_history
  169. HISTFILESIZE:命令历史文件记录历史的条数
  170. HISTTIMEFORMAT=“%F %T 显示时间
  171. HISTIGNORE=“str1:str2*:… 忽略str1命令, str2开头的历史
  172. 控制命令历史的记录方式:
  173. 环境变量: HISTCONTROL
  174. ignoredups 默认,忽略重复的命令,连续且相同为“重复”
  175. ignorespace 忽略所有以空白开头的命令
  176. ignoreboth 相当于ignoredups, ignorespace的组合
  177. erasedups 删除重复命令
  178. export 变量名="值“
  179. 存放在 /etc/profile 或 ~/.bash_profile
  180. $ systemctl enable autofs 启动自动挂载点 根目录多出misc net 两个目录
  181. $ ls /misc -a
  182. $ ls /misc/cd 挂载光盘
  183. $ ls cd/Packages/ 包目录
  184. $ cat /etc/DIR_COLORS 定义文件的颜色
  185. $ touch 创建文件如果存在只会刷新时间戳 $ stat f1 查看时间戳
  186. stat
  187. 文件: metadata, data
  188. 三个时间戳:
  189. access time:访问时间, atime,读取文件内容
  190. modify time: 修改时间, mtime,改变文件内容(数据)
  191. change time: 改变时间, ctime,元数据发生改变
  192. $ touch -t 201002151230.20 f1 只修改访问和修改时间
  193. $ touch -c f2 如果只刷新时间戳并不创建f2
  194. cp 常用选项
  195. -i:覆盖前提示 –n:不覆盖,注意两者顺序
  196. -r, -R: 递归复制目录及内部的所有内容
  197. -a: 归档,相当于-dR --preserv=all
  198. -d: --no-dereference --preserv=links 不复制原文件,
  199. 只复制链接名
  200. --preserv[=ATTR_LIST]
  201. mode: 权限
  202. ownership: 属主属组
  203. timestamp:
  204. links
  205. xattr
  206. context
  207. all
  208. -p: 等同--preserv=mode,ownership,timestamp
  209. -v: --verbose
  210. -f: --force
  211. -u:--update 只复制源比目标更新文件或目标不存在的文件
  212. --backup=numbered 目标存在,覆盖前先备份加数字后缀
  213. $ cp -av /etc/ /app/bbb 复制并显示详细信息
  214. $ cp /etc/issue f1 --backup=numbered 复制到f1 如果有就把原有的备份
  215. 只能复制传统文件 不能复制字符文件比如
  216. $ cp /dev/zero /app/
  217. $ mknod /app/zero c 1 5 这样才可以
  218. $ mv f1/ root 如果存在root目录就是移动,不存在就是改名字
  219. $ rename '.log' '.log.bak' f* 把所有f*的.log 文件改成.log.bak
  220. $ rename file file0 file? 改格式把file改成fil01...
  221. rm [OPTION]... FILE...
  222. 常用选项:
  223. -i: 交互式
  224. -f: 强制删除
  225. -r: 递归
  226. --no-preserve-root
  227. tree 显示目录树
  228. -d: 只显示目录
  229. -L level:指定显示的层级数目
  230. -P pattern: 只显示由指定pattern匹配到的路径
  231. mkdir 创建目录
  232. -p: 存在于不报错,且可自动创建所需的各目录
  233. -v: 显示详细信息
  234. -m MODE: 创建目录时直接指定权限
  235. rmdir 删除空目录
  236. -p: 递归删除父空目录
  237. -v: 显示详细信息
  238. rm -r 递归删除目录树
  239. alias cdnet="cd /etc/sysconfig/network-scripts/" 定义别名 别名优先级最高
  240. nano .bashrc
  241. 定义别名 alias rm='mv -t /app/bak'
  242. 保存 . .bashrc
  243. rm bash.txt 这个目录就到/app/bak下面了

快捷键

  1. Ctrl + l 清屏,相当于clear命令
  2. Ctrl + o 执行当前命令,并重新显示本命令
  3. Ctrl + s 阻止屏幕输出,锁定
  4. Ctrl + q 允许屏幕输出
  5. Ctrl + c 终止命令
  6. Ctrl + z 挂起命令
  7. Ctrl + a 光标移到命令行首,相当于Home
  8. Ctrl + e 光标移到命令行尾,相当于End
  9. Ctrl + f 光标向右移动一个字符
  10. Ctrl + b 光标向左移动一个字符
  11. Alt + f 光标向右移动一个单词尾
  12. Alt + b 光标向左移动一个单词首
  13. Ctrl + xx 光标在命令行首和光标之间移动
  14. Ctrl + u 从光标处删除至命令行首
  15. Ctrl + k 从光标处删除至命令行尾
  16. Alt + r 删除当前整行
  17. Ctrl + w 从光标处向左删除至单词首
  18. Alt + d 从光标处向右删除至单词尾
  19. Ctrl + d 删除光标处的一个字符
  20. Ctrl + h 删除光标前的一个字符
  21. Ctrl + y 将删除的字符粘贴至光标后
  22. Alt + c 从光标处开始向右更改为首字母大写的单词
  23. Alt + u 从光标处开始,将右边一个单词更改为大写
  24. Alt + l 从光标处开始,将右边一个单词更改为小写
  25. Ctrl + t 交换光标处和之前的字符位置
  26. Alt + t 交换光标处和之前的单词位置
  27. Alt + N 提示输入指定字符后,重复显示该字符N
  28. 注意: Alt组合快捷键经常和其它软件冲突
  29. 应用程序->附件->终端
  30. 支持多个“标签” shell的图形化终端模拟器
  31. Ctrl-Shift-n 创建新窗口
  32. Ctrl-Shift-q 关闭当前窗口
  33. Ctrl-Shift-t 创建一个标签页
  34. Ctrl-Shift-w 关闭一个标签页
  35. Ctrl-PaUp/PgUn 切换到下一个/前一个标签页
  36. Ctrl-Shift-c 复制选中的文本
  37. Ctrl-Shift-v 把文本粘帖到当前光标处

tab键

  1. $ command 2Tab 所有子命令或文件补全
  2. $ string2Tab string开头命令
  3. $ /2Tab 显示所有根目录下一级目录,包括隐藏目录
  4. $ ./2Tab 当前目录下子目录,包括隐藏目录
  5. $ *2Tab 当前目录下子目录,不包括隐藏目录
  6. $ ~2Tab 所有用户列表
  7. $ $2Tab 所有变量
  8. $ @2Tab /etc/hosts记录 centos7不支持)
  9. $ =2Tab 相当于ls A centos7不支持)
添加新批注
在作者公开此批注前,只有你和作者可见。
回复批注