学习小组Day2笔记补充--April
2019-06-18 本文已影响0人
aprilllm
以下为代码
[root@April ~]# pwd
/root
[root@April ~]# mkdir test
[root@April ~]# ls
biosoft project src test tmp
[root@April ~]# mkdir april
[root@April ~]# cd april
[root@April april]# touch hello.txt
[root@April april]# cd ..
[root@April ~]# cd test
[root@April test]# touch byebye.txt
[root@April test]# cd
[root@April ~]# ls
april biosoft project src test tmp
[root@April ~]# rm hello.txt
rm: cannot remove ‘hello.txt’: No such file or directory
[root@April ~]# cd april
[root@April april]# rm hello.txt
rm: remove regular empty file ‘hello.txt’? y
[root@April april]# rmdir april
rmdir: failed to remove ‘april’: No such file or directory
[root@April april]# cd
[root@April ~]# rmdir april
[root@April ~]# rm -r test
rm: descend into directory ‘test’? y
rm: remove regular empty file ‘test/byebye.txt’? y
rm: remove directory ‘test’? y
[root@April ~]# ls
biosoft project src tmp
[root@April ~]# cd tmp
[root@April tmp]# pwd
/root/tmp
[root@April tmp]# cd ~
[root@April ~]# cd tmp
[root@April tmp]# vi hello.txt
[root@April tmp]# cat hello.txt
Today
is
a
good
day
It
is
a
little
hot
but
still
a
nice
day
tomorrow
is
a
rainy
day
[root@April tmp]# cat -n hello.txt
1 Today
2 is
3 a
4 good
5 day
6 It
7 is
8 a
9 little
10 hot
11 but
12 still
13 a
14 nice
15 day
16 tomorrow
17 is
18 a
19 rainy
20 day
[root@April tmp]# head -n3 hello.txt
Today
is
a
[root@April tmp]# tail -n3 hello.txt
a
rainy
day
[root@April tmp]# cp hello.txt byebye.txt
[root@April tmp]# mv byebye.txt home.txt
[root@April tmp]# mv home.txt ~
[root@April tmp]# cd
[root@April ~]# ls
biosoft home.txt project src tmp
1)要关注前面的目录名称(有pwd查看也行),只能在当前目录下进行操作。
2)输出结果:目录为蓝色,文件为白色。
3)主路径为~,一般路径为 /root/dirname.