1.熟悉Linux命令的一般格式;
2.掌握Linux常用文件操作命令;
3.掌握Linux常用目录操作命令;
4.掌握Linux的其他方面的应用命令;
5.理解Linux的工作原理及应用;
6.熟悉Linux的字符界面的工作原理及操作方法。
1.文件操作命令:touch、cat、more、less、head、tail、cp、ln、mv、rm
2.目录操作命令:cd、pwd、mkdir、ls、rmdir、rm
3.文件规档命令:tar
4.在文件中查找指定字符串命令:grep
5.切换用户命令:su;查看当前用户命令:whoami;
6.清屏命令:clear;信息回显命令:echo帮助命令:man、info。
Linux操作系统工作原理及shell工作原理
[root@localhost ~]# touch haha
[root@localhost ~]# ll
[root@localhost ~]# cat jinjiawei01
Hello
[root@localhost ~]# more haha
[root@localhost ~]# less haha
[root@localhost ~]# head haha
[root@localhost ~]# tail haha
[root@localhost ~]# cp haha haha1
[root@localhost ~]# ll
ln
命令用于创建链接。在Linux中,链接分为硬链接和符号链接(也称为软链接)[root@localhost ~]# ln haha data //硬链接
[root@localhost ~]# ln -s haha data1 //软链接
[root@localhost ~]# mv /root/haha /etc/
[root@localhost ~]# cd /etc/
[root@localhost etc]# ll
现在位置:
原来位置:
[root@localhost ~]# mv haha1 haha
[root@localhost ~]# ll
删除文件
[root@localhost ~]# touch haha2
[root@localhost ~]# ll
[root@localhost ~]# rm -r haha2
rm:是否删除普通空文件 'haha2'?y
删除目录
[root@localhost ~]# mkdir -p open1/loading/compation
[root@localhost ~]# ll
[root@localhost ~]# rm open1/
rm: 无法删除'open1/': 是一个目录
[root@localhost ~]# rm -r open1/
rm:是否进入目录'open1/'? y
rm:是否进入目录'open1/loading'? y
rm:是否删除目录 'open1/loading/compation'?y
rm:是否删除目录 'open1/loading'?y
rm:是否删除目录 'open1/'?y
或者
[root@localhost ~]# rm -rf open1/ //强制删除,但在工作中最好不要用
[root@localhost ~]# cd /etc/pam.d/
[root@localhost pam.d]# cd ~
[root@localhost ~]#
[root@localhost ~]# cd /dev/dri/
[root@localhost dri]# pwd
/dev/dri
[root@localhost ~]# mkdir -p open1/loading/compation
[root@localhost ~]# ls
[root@localhost ~]# mkdir -p open1/loading/compation
[root@localhost ~]# cd open1/
[root@localhost open1]# cd loading/
[root@localhost loading]# ll
总用量 0
drwxr-xr-x. 2 root root 6 4月 24 23:32 compation
[root@localhost loading]# rmdir compation/
[root@localhost loading]# ll
总用量 0
[root@localhost loading]#
跟上面的1里里面的10)一样,在这里就不进行叙述了。
[root@localhost ~]# touch file.txt
[root@localhost ~]# touch file1.txt
[root@localhost ~]# tar -cvf archive.tar file.txt file1.txt
file.txt
file1.txt
[root@localhost ~]# ll
[root@localhost ~]# tar -cvf dir1.tar open1/
open1/
open1/loading/
[root@localhost ~]# ll
[root@localhost ~]# tar -czvf archive.tar.gz file.txt file1.txt
file.txt
file1.txt
[root@localhost ~]# ll
[root@localhost ~]# tar -czvf dir1.tar.gz open1/
open1/
open1/loading/
[root@localhost ~]# ll
[root@localhost ~]# tar -xvf archive.tar -C open1/
file.txt
file1.txt
[root@localhost ~]# cd open1/
[root@localhost open1]# ll
总用量 0
-rw-r--r--. 1 root root 0 4月 25 15:15 file1.txt
-rw-r--r--. 1 root root 0 4月 25 15:14 file.txt
[root@localhost ~]# tar -xzvf archive.tar.gz -C open1/loading/
file.txt
file1.txt
[root@localhost ~]# ll open1/loading/
总用量 0
-rw-r--r--. 1 root root 0 4月 25 15:15 file1.txt
-rw-r--r--. 1 root root 0 4月 25 15:14 file.txt
[root@localhost ~]# touch file3.txt
[root@localhost ~]# tar -rvf archive.tar file3.txt
file3.txt
[root@localhost ~]# tar -tvf archive.tar
-rw-r--r-- root/root 0 2024-04-25 15:14 file.txt
-rw-r--r-- root/root 0 2024-04-25 15:15 file1.txt
-rw-r--r-- root/root 0 2024-04-25 15:37 file3.txt
[root@localhost ~]# grep 'ho' haha
| Return True if the string is a valid Python identifier, False otherwise.
| The string whose method is called is inserted in between each given string.
[root@localhost ~]# su fox
[fox@localhost root]$ whoami
fox
[root@localhost ~]# echo "hello world"
hello world
[root@localhost ~]# man grep
[root@localhost ~]# info grep
[root@localhost ~]# grep --help