1.命令和文件自动补全 TAB
2.命令历史记忆功能 上下键、!number、!string、!$、!! ctrl+r
[root@localhost ~]# !ps ##最后执行的ps命令 ps -ef | grep mysql root 1537 1 0 07:14 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/mysql_3376/data --pid-file=/data/mysql/mysql_3376/data/mysql.pid mysql 2608 1537 0 07:14 ? 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3376/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql_3376/data/error.log --pid-file=/data/mysql/mysql_3376/data/mysql.pid --socket=/tmp/mysql3376.sock --port=3376 root 3054 3022 0 07:17 pts/0 00:00:00 grep mysql 1007 ps -ef | grep mysql [root@localhost ~]# !1007 ps -ef | grep mysql root 1537 1 0 07:14 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/mysql_3376/data --pid-file=/data/mysql/mysql_3376/data/mysql.pid mysql 2608 1537 0 07:14 ? 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3376/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql_3376/data/error.log --pid-file=/data/mysql/mysql_3376/data/mysql.pid --socket=/tmp/mysql3376.sock --port=3376 root 3066 3022 0 07:19 pts/0 00:00:00 grep mysql [root@localhost ~]# !! ps -ef | grep mysql root 1537 1 0 07:14 ? 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/data/mysql/mysql_3376/data --pid-file=/data/mysql/mysql_3376/data/mysql.pid mysql 2608 1537 0 07:14 ? 00:00:01 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/data/mysql/mysql_3376/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/data/mysql/mysql_3376/data/error.log --pid-file=/data/mysql/mysql_3376/data/mysql.pid --socket=/tmp/mysql3376.sock --port=3376 root 3070 3022 0 07:20 pts/0 00:00:00 grep mysql
3.别名功能 alias unalias cp、~username/.bashrc、cp -rf /etc/hosts
[root@localhost ~]# alias cd='date' [root@localhost ~]# cd Tue Apr 11 07:21:41 PDT 2017 别名的优先级别比较高 [root@localhost ~]# builtin cd /home
4.快捷键
Ctrl+r 查找历史命令【输入关键字,就能调出以前执行过的命令】
[root@localhost ~]# cd /home (reverse-i-search)`c': cd /home
Ctrl+d 结束输入退出当前shell
Crtl+a 切换到命令开始
Crtl+e 切换到命令末尾
Ctrl+l 清屏
Ctrl+u 清除剪切光标之前的内容
Ctrl+k 清除剪切光标之后的内容
Ctrl+s 暂停屏幕输出【锁住终端】
Ctrl+q 恢复屏幕输出【解锁终端】
Ctrl+c 结束正在运行的程序
Ctrl+y 在光标处粘贴剪切的内容
Ctrl+z 转入后台运行
5.前后台作业控制 & nohup ctrl+c ctrl+z bg%1 fg%1 kill %3 screen
6.输入输出重定向 0,1,2 > >> 2> 2>> 2>&1 &> cat< /etc/hosts cat <<EOF cat >file1<<EOF