也可以通过在 /etc/hosts 文件中添加记录或者在 DNS 服务器中加入解析记录来把 IP 地址替换成易记的机器名称。
执行 alias 命令可以列出机器上已有的别名。
1 2 3 4 5 6 7 8 9 10 11 12
$ alias alias butterfly='ssh -v -l jdoe 192.168.0.11' alias c='clear' alias egrep='egrep --color=auto' alias fgrep='fgrep --color=auto' alias grep='grep --color=auto' alias l='ls -CF' alias la='ls -A' alias list_repos='grep ^[^#] /etc/apt/sources.list /etc/apt/sources.list.d/*' alias ll='ls -alF' alias ls='ls --color=auto' alias show_dimensions='xdpyinfo | grep '\''dimensions:'\'''
Linux 提供了很多让用户复用命令的方法,其核心是通过历史缓冲区收集执行过的命令。复用命令的最简单方法是输入 ! 然后接最近使用过的命令的开头字母;当然也可以按键盘上的向上箭头,直到看到要复用的命令,然后按回车键。还可以先使用 history 显示命令历史,然后输入 ! 后面再接命令历史记录中需要复用的命令旁边的数字。
$ tail -f /var/log/auth.log Sep 17 09:41:01 fly CRON[8071]: pam_unix(cron:session): session closed for user smmsp Sep 17 09:45:01 fly CRON[8115]: pam_unix(cron:session): session opened for user root Sep 17 09:45:01 fly CRON[8115]: pam_unix(cron:session): session closed for user root Sep 17 09:47:00 fly sshd[8124]: Accepted password for shs from 192.168.0.22 port 47792 Sep 17 09:47:00 fly sshd[8124]: pam_unix(sshd:session): session opened for user shs by Sep 17 09:47:00 fly systemd-logind[776]: New session 215 of user shs. Sep 17 09:55:01 fly CRON[8208]: pam_unix(cron:session): session opened for user root Sep 17 09:55:01 fly CRON[8208]: pam_unix(cron:session): session closed for user root <== 等待显示追加的内容
寻求帮助
对于大多数 Linux 命令,都可以通过在输入命令后加上选项 --help 来获得这个命令的作用、用法以及它的一些相关信息。除了 man 命令之外, --help 选项可以让你在不使用所有扩展选项的情况下获取到所需要的内容。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
$ mkdir --help Usage: mkdir [OPTION]... DIRECTORY... Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too. -m, --mode=MODE set file mode (as in chmod), not a=rwx - umask -p, --parents no error if existing, make parent directories as needed -v, --verbose print a message for each created directory -Z set SELinux security context of each created directory to the default type --context[=CTX] like -Z, or if CTX is specified then set the SELinux or SMACK security context to CTX --help display this help and exit --version output version information and exit
GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Full documentation at: <http://www.gnu.org/software/coreutils/mkdir> or available locally via: info '(coreutils) mkdir invocation'