1.去掉DNS域名解析:
[root@localhost ~]# vim /etc/ssh/sshd_config //进入Vim文本编辑
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes ——>#UseDNS no //修改
#PidFile /var/run/sshd.pid
#MaxStartups 10:30:100
#PermitTunnel no
#ChrootDirectory none
#VersionAddendum none
[root@localhost ~]# systemctl restart sshd //重启服务
[root@localhost ~]#
2.当前用户永久生效的命令别名
(1)写一个命令别名为hello,实现的功能为每输入一次hello命令,就有hello,everyone写入到文件/file.txt文件中
[root@localhost ~]# vim ~/.bashrc //进入别名的配置文件
alias hello=‘echo hello,every one>>/file.text’ //追加重定向写入
[root@localhost ~]# source .bashrc //使其生效
[root@localhost ~]# hello //测试命令
[root@localhost ~]# cat /file.text //查看文件
hello,every one
[root@localhost ~]# hello
[root@localhost ~]# hello
[root@localhost ~]# cat /file.text //命令生效
hello,every one
hello,every one
hello,every one
(2)写一个命令别名为shuaxin,实现的功能为每输入一次该命令,file.txt文件的所有时间就更新为当前时间
[root@localhost ~]# vim ~/.bashrc //进入别名的配置文件
alias shuaxin='touch /file.txt'
:wq //保存并退出
[root@localhost ~]# source .bashrc //使其生效
[root@localhost ~]# shuaxin //测试命令
[root@localhost ~]# stat /file.txt //文件的详细信息显示
File: ‘/file.txt’
Size: 15 Blocks: 8 IO Block: 4096 regular file
Device: 802h/2050d Inode: 2328652 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root)
Context: unconfined_u:object_r:etc_runtime_t:s0
Access: 2019-03-17 19:34:56.429961137 +0800
Modify: 2019-03-17 19:34:52.934961306 +0800
Change: 2019-03-17 19:34:52.934961306 +0800
Birth: -
[root@localhost ~]#
3.所有用户生效的命令别名
(1)写一个所有用户都生效的命令别名为hh,输入这个命令之后可以在当前用户家目录下面创建一个file1文件
[root@localhost ~]# vim /etc/bashrc
alias hh='touch ~/file1' //touch—创建普通文件
:wq //保存并退出
[root@localhost ~]# source .bashrc //使其生效
[root@localhost ~]# hh //测试命令
[root@localhost ~]# ll
total 8
-rw-------. 1 root root 1632 Mar 6 05:37 anaconda-ks.cfg
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Desktop
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Documents
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Downloads
-rw-r--r--. 1 root root 0 Mar 17 19:51 file1
-rw-------. 1 root root 1725 Mar 5 21:46 initial-setup-ks.cfg
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Music
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Pictures
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Public
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Templates
drwxr-xr-x. 2 root root 6 Mar 14 23:23 Videos
[root@localhost ~]#