安装好虚拟机,开始学习Linus
本文包括使用终端编写学习基础知识,显示当前目录,在当前目录下增加、删除文件夹以及添加、删除文件,返回上一级目录;返回上一次操作的文件夹的路径;显示当前路径下面包含的树形结构;显示文件名内的内容。
1.【root @ promote ~】#
(1)root:登录主机的用户;
(2)promote:主机名;
(3)~:当前目录(可以说root、home等自建系统的文件夹名);
2.pwd:显示当前目录的路径;
3.(1)cd;到相应的路径当中;
(2)cd ..or cd ../../......:表示返回上一级或者n级;
(3)cd -:回到刚才的路径;
4.clear;清楚当前页面但是并不把清楚指令,相当于换页;
5. (1)ls:list缩写,表示显示当前目录下的东西
(2)ls -l:详细列举文件、文件夹等东西
(3)ls -al:全部列举东西
6. (1)rm;删除文件
(2)rm -f:强制删除文件
(3)rm -r:删除文件夹
(4)rm -rf:强制删除文件夹
7.tree:显示当前路劲下面的树形结构;
8.mkdir:创建文件夹;
9.touch:创建文件;
10.(1)vim:打开文件但是不可以编辑且关闭退出终端
(2)gedit:.....................可以编辑且不退出
11.cat:显示文件内容
12.mv:改名字;
各种基本的操作的具体使用方法及格式
[root@localhost ~]# pwd
/root
[root@localhost ~]# cd /root/home/
[root@localhost home]# tree
.
`-- zhoujian
`-- text.h
1 directory, 1 file
[root@localhost home]# rm -r zhoujian
rm:是否进入目录 “zhoujian”? n
[root@localhost home]# pwd
/root/home
[root@localhost home]# cd ..
[root@localhost ~]# pwd
/root
[root@localhost ~]# is
bash: is: command not found
[root@localhost ~]# ls
anaconda-ks.cfg home install.log.syslog text.h zhangsan
Desktop install.log test1 text.h~ zhoujian
[root@localhost ~]# cd /root/home/zhoujian/
[root@localhost zhoujian]# touch text2.h
[root@localhost zhoujian]# tree
.
|-- text.h
`-- text2.h
0 directories, 2 files
[root@localhost zhoujian]# cd ..
[root@localhost home]# pwd
/root/home
[root@localhost home]# cd-
bash: cd-: command not found
[root@localhost home]# cd -
/root/home/zhoujian
[root@localhost zhoujian]# pwd
/root/home/zhoujian
[root@localhost zhoujian]# rm text.h
rm:是否删除 一般空文件 “text.h”? y
[root@localhost zhoujian]# rm -f text2.h
[root@localhost zhoujian]# tree
.
0 directories, 0 files
[root@localhost zhoujian]# cd ..
[root@localhost home]# pwd
/root/home
[root@localhost home]# rm -r
rm: 缺少操作数
请尝试执行“rm --help”来获取更多信息。
[root@localhost home]# rm -r zhoujian
rm:是否删除 目录 “zhoujian”? y
[root@localhost home]# mkdir wudan
[root@localhost home]# tree
.
`-- wudan
1 directory, 0 files
[root@localhost home]# rm -rf wudan
[root@localhost home]# ls
[root@localhost home]# pwd
/root/home
[root@localhost home]# cd ..
[root@localhost ~]# pwd
/root
[root@localhost ~]# ls
anaconda-ks.cfg home install.log.syslog text.h zhangsan
Desktop install.log test1 text.h~ zhoujian
[root@localhost ~]# cd /root/
[root@localhost ~]# pwd
/root
[root@localhost ~]# rm -rf zhangsan
[root@localhost ~]# rm -rf zhoujian
[root@localhost ~]# ls
anaconda-ks.cfg home install.log.syslog text.h
Desktop install.log test1 text.h~
[root@localhost ~]# ls-l
bash: ls-l: command not found
[root@localhost ~]# ls -l
总计 100
-rw------- 1 root root 1377 05-12 21:56 anaconda-ks.cfg
drwxr-xr-x 2 root root 4096 05-12 22:01 Desktop
drwxr-xr-x 2 root root 4096 05-13 14:06 home
-rw-r--r-- 1 root root 36099 05-12 21:56 install.log
-rw-r--r-- 1 root root 4228 05-12 21:55 install.log.syslog
drwxr-xr-x 2 root root 4096 05-13 09:10 test1
-rw-r--r-- 1 root root 9 05-13 13:17 text.h
-rw-r--r-- 1 root root 9 05-13 13:17 text.h~