命令行编辑方法

    xiaoxiao2022-07-13  159

     步骤

    实现此案例需要按照如下步骤进行。 步骤一:打开gnome-terminal窗口程序

    只需右击桌面(或资源管理器)空白处,选择“打开终端”,如图-1所示。 步骤二:检查命令echo、cd、cat、hostname的类型

    利用type命令可以查询命令的类型,命令操作如下所示:

    [root@localhost ~]# type echo echo is a shell builtin //builtin表示内部命令 [root@localhost ~]# type cd cd is a shell builtin [root@localhost ~]# type cat cat is /bin/cat //出现路径表示该命令为外部命令 [root@localhost ~]# type hostname hostname is /bin/hostname [root@localhost ~]#

    步骤三:利用自动补齐查看文件 /etc/sysconfig/network-scripts/ifcfg-eth0

    按Tab键不仅可以补全命令,也可以补全路径。要学好Linux必须学会使用Tab键所有要勤加练习。命令操作如下所示:

    [root@localhost ~]# ls /et //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysco //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysconfig/netw //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysconfig/network- //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysconfig/network-scripts/ifc //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysconfig/network-scripts/ifcfg-e //输入路径到此处按Tab键 [root@localhost ~]# ls /etc/sysconfig/network-scripts/ifcfg-eth0 //实现补全

    步骤四:列出以if、fd开头的命令程序

    Tab键特可以让我们变得更加轻松,记忆较长命令时可以只记住前半部分,可以利用Tab键显示出来。命令操作如下所示:

    [root@localhost ~]# if //输入if都连续按两下Tab键 if ifcfg ifconfig ifdown ifenslave ifrename ifup [root@localhost ~]# fd //输入fd都连续按两下Tab键 fdformat fdisk

    步骤五:利用 \ 强制换行,拆分“命令字 选项 参数”

    命令操作如下所示:

    [root@localhost ~]# shutdown \ //输入“\”换行 > -k \ //输入“\”换行 > now Broadcast message from root@localhost.localdomain (/dev/pts/0) at 19:05 ... The system is going down for halt NOW! [root@localhost ~]#
    最新回复(0)