tab键补全用法
当我们敲击一下tab补全命令或文件名
当我们敲击两下tab列出相关的所有可选项
cd-相当于电视的回看
有时候我们进入一个非常长的目录,后来又进入另一个目录,可能我们还行回到原来那个长,如果事先知道,我们可能输入pwd,以便一会儿粘贴,有时候忘了输入pwd我们可能无奈还得输入一次长长的路径,我们可以输入一下cd-试试,直接回到上次进入的目录,就像是看电视时候的回看按钮。是不是很好用?
查看以下例子
[root@localhost/]#cd/tmp
[root@localhosttmp]#pwd
/tmp
[root@localhosttmp]#cd/
[root@localhost/]#pwd
/
[root@localhost/]#cd-
/tmp
[root@localhosttmp]#pwd
/tmp
Esc+.
用法举例
首先touch一个文件,然后编辑这个文件
touchabcdefghijk
敲入vi,然后Esc+.发现是不是abcdefghijk已经出现在vi后面\
转义字符用法
系统中一些命令都是别名的功能,比如我们使用的rm、mv等,实际上是rm-i和mv-i。
查看系统别名可以使用alias命令,例如以下系统默认的别名。
[root@localhosttestdir]#alias
aliascp='cp-i'
aliasegrep='egrep--color=auto'
aliasfgrep='fgrep--color=auto'
aliasgrep='grep--color=auto'
aliasl.='ls-d.*--color=auto'
aliasll='ls-l--color=auto'
aliasls='ls--color=auto'
aliasmv='mv-i'
aliasrm='rm-i'
aliaswhich='alias|/usr/bin/which--tty-only--read-alias--show-dot--show-tilde'
有时候我们删一个文件时候,会出现以下提示,需要我们一个个确认,原因就是rm默认就是rm-i起了作用。
[root@localhosttestdir]#cddir1
[root@localhostdir1]#ls
file1file2file3file4
[root@localhostdir1]#rmfile1file2file3file4rm:removeregularemptyfile?.ile1?.y
rm:removeregularemptyfile?.ile2?.y
rm:removeregularemptyfile?.ile3?.y
rm:removeregularemptyfile?.ile4?.y
我们可以使用转移字符使别名失效,使用如下,删除就不会再有提示确认了。
[root@localhosttestdir]#cddir1
[root@localhostdir1]#ls
file1file2file3file4
[root@localhostdir1]#\rmfile1file2file3file4