回车的妙用
今天看到一篇颇为有趣的文章:The Pinky Finger habits Of Experienced Sysadmins.
其中提到一个观点,在输入命令之前,应该多敲几下回车,以便将当前命令与上一命令的输出区分开来,这样可以方便操作者看会之前的操作内容。
比如,下面这一陀是没有分隔的输出:
root@server:~# apt-get update Hit:1 http://mirror.memset.com/ubuntu xenial InRelease Get:2 http://mirror.memset.com/ubuntu xenial-updates InRelease [102 kB] Get:3 http://mirror.memset.com/ubuntu xenial-security InRelease [102 kB] Fetched 204 kB in 0s (433 kB/s) Reading package lists... Done root@server:~# apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: libgl1-mesa-dri sysstat 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. root@server:~# apt-get install openvpn Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libgd3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.1-0 libtiff5 libvpx3 libxslt1.1 nginx-common nginx-core Use 'apt autoremove' to remove them. Suggested packages: easy-rsa The following NEW packages will be installed: openvpn 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 0 B/421 kB of archives. After this operation, 1026 kB of additional disk space will be used. Preconfiguring packages ... Selecting previously unselected package openvpn. (Reading database ... 22196 files and directories currently installed.) Preparing to unpack .../openvpn_2.3.10-1ubuntu2.1_amd64.deb ... Unpacking openvpn (2.3.10-1ubuntu2.1) ... Processing triggers for libc-bin (2.23-0ubuntu9) ... Processing triggers for systemd (229-4ubuntu21) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for man-db (2.7.5-1) ... Setting up openvpn (2.3.10-1ubuntu2.1) ... Processing triggers for libc-bin (2.23-0ubuntu9) ... root@server:~# cd /etc/openvpn/ root@server:/etc/openvpn# ls update-resolv-conf
然后是分隔后的输出:
root@server:~# root@server:~# root@server:~# apt-get update Hit:1 http://mirror.memset.com/ubuntu xenial InRelease Get:2 http://mirror.memset.com/ubuntu xenial-updates InRelease [102 kB] Get:3 http://mirror.memset.com/ubuntu xenial-security InRelease [102 kB] Fetched 204 kB in 0s (433 kB/s) Reading package lists... Done root@server:~# root@server:~# root@server:~# root@server:~# apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done The following packages have been kept back: libgl1-mesa-dri sysstat 0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded. root@server:~# root@server:~# root@server:~# root@server:~# root@server:~# apt-get install openvpn Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: apache2-bin apache2-data apache2-utils libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libgd3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.1-0 libtiff5 libvpx3 libxslt1.1 nginx-common nginx-core Use 'apt autoremove' to remove them. Suggested packages: easy-rsa The following NEW packages will be installed: openvpn 0 upgraded, 1 newly installed, 0 to remove and 2 not upgraded. Need to get 0 B/421 kB of archives. After this operation, 1026 kB of additional disk space will be used. Preconfiguring packages ... Selecting previously unselected package openvpn. (Reading database ... 22196 files and directories currently installed.) Preparing to unpack .../openvpn_2.3.10-1ubuntu2.1_amd64.deb ... Unpacking openvpn (2.3.10-1ubuntu2.1) ... Processing triggers for libc-bin (2.23-0ubuntu9) ... Processing triggers for systemd (229-4ubuntu21) ... Processing triggers for ureadahead (0.100.0-19) ... Processing triggers for man-db (2.7.5-1) ... Setting up openvpn (2.3.10-1ubuntu2.1) ... Processing triggers for libc-bin (2.23-0ubuntu9) ... root@server:~# root@server:~# root@server:~# cd /etc/openvpn/ root@server:/etc/openvpn# root@server:/etc/openvpn# root@server:/etc/openvpn# root@server:/etc/openvpn# ls update-resolv-conf
恩,看起来分隔后的命令输出确实要容易阅读的多.