Linux 简单命令
-cd命令
作用: 切换目录
语法: cd 目录
说明: 直接输入cd 表示回到当前(家) 目录
例
[root@localhost ~]# cd /etc/ # 进入etc文件夹
[root@localhost /etc]# cd .. # 返回上级文件夹
[root@localhost /]# cd ~ # 回到家目录
[root@localhost ~]# cd /etc/sysconfig/ 进入sysconfig目录
[root@localhost /etc]# cd - 切换到之前目录
/etc/sysconfig/
-history命令
快速查找历史记录
3个Linux历史命令技巧
-
光标上下移动
-
Ctrl + r // 搜索历史记录关键字
(reverse-i-search)`sys’: cd /etc/sysconfig/ 输入sys后匹配得到的…
找到后 做光标键即可
-
!10 执行历史记录位置为10的命令
170 history 171 cd /etc/sysconfig/ 172 l 173 cd 174 ll 175 history [root@localhost ~]# ! 171 !字符串 注: 会匹配最近一次, 有多余的不会执行
Linux快捷键
都是Ctrl + 单词 ^表示Ctrl
^C 终止前台运行的程序 如 Ctrl + c
[root@localhost ~]# ping g.cn
PING g.cn (203.208.50.162) 56(84) bytes of data.
64 bytes from 203.208.50.162 (203.208.50.162): icmp_seq=1 ttl=118 time=24.1 ms
64 bytes from 203.208.50.162 (203.208.50.162): icmp_seq=2 ttl=118 time=23.8 ms
^C
--- g.cn ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3009ms
rtt min/avg/max/mdev = 23.877/24.201/24.553/0.286 ms
^D 退出 等价于exit
Ctrl+ d
^L 清屏
Ctrl + l
Ctrl+a 跳到命令开头
Ctrl+e跳到命令结尾
Ctrl+k将光标命令开始删除到末尾
Ctrl+u将光标位置删除到开始
Ctrl+r历史记录
!$ 引用是一个命令最后一个参数
tab补全快捷键