1.去掉DNS域名解析:
[[email protected] ~]# 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

[[email protected] ~]# systemctl restart sshd //重新開機服務
[[email protected] ~]#
2.目前使用者永久生效的指令别名
(1)寫一個指令别名為hello,實作的功能為每輸入一次hello指令,就有hello,everyone寫入到檔案/file.txt檔案中
[[email protected] ~]# vim ~/.bashrc //進入别名的配置檔案
alias hello=‘echo hello,every one>>/file.text’ //追加重定向寫入
[[email protected] ~]# source .bashrc //使其生效
[[email protected] ~]# hello //測試指令
[[email protected] ~]# cat /file.text //檢視檔案
hello,every one
[[email protected] ~]# hello
[[email protected] ~]# hello
[[email protected] ~]# cat /file.text //指令生效
hello,every one
hello,every one
hello,every one
(2)寫一個指令别名為shuaxin,實作的功能為每輸入一次該指令,file.txt檔案的所有時間就更新為目前時間
[[email protected] ~]# vim ~/.bashrc //進入别名的配置檔案
alias shuaxin='touch /file.txt'
:wq //儲存并退出
[[email protected] ~]# source .bashrc //使其生效
[[email protected] ~]# shuaxin //測試指令
[[email protected] ~]# 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: -
[[email protected] ~]#
3.所有使用者生效的指令别名
(1)寫一個所有使用者都生效的指令别名為hh,輸入這個指令之後可以在目前使用者家目錄下面建立一個file1檔案
[[email protected] ~]# vim /etc/bashrc
alias hh='touch ~/file1' //touch—建立普通檔案
:wq //儲存并退出
[[email protected] ~]# source .bashrc //使其生效
[[email protected] ~]# hh //測試指令
[[email protected] ~]# 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
[[email protected] ~]#