From a4095bf254c343c2c01fc157a2c26cacad68676e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=BB=8E=E4=BF=8A=E6=9D=A8?= <11785097+li-junyang3455@user.noreply.gitee.com> Date: Mon, 27 May 2024 16:29:29 +0000 Subject: [PATCH] =?UTF-8?q?=E4=BD=9C=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 黎俊杨 <11785097+li-junyang3455@user.noreply.gitee.com> --- .../20240527 \344\275\234\344\270\232.md" | 102 ++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 "10 \351\273\216\344\277\212\346\235\250/20240527 \344\275\234\344\270\232.md" diff --git "a/10 \351\273\216\344\277\212\346\235\250/20240527 \344\275\234\344\270\232.md" "b/10 \351\273\216\344\277\212\346\235\250/20240527 \344\275\234\344\270\232.md" new file mode 100644 index 0000000..6bed47f --- /dev/null +++ "b/10 \351\273\216\344\277\212\346\235\250/20240527 \344\275\234\344\270\232.md" @@ -0,0 +1,102 @@ +相关和目录可自行创建后再操作 + +``` +//1. 在家目录下建立文件exam.c,将文件exam.c拷贝到/tmp这个目录下,并改名为 shiyan.c + +touch ~/exam.c +cp ~/exam.c /tmp/shiyan.c + +//2. 在任何目录下回到用户主目录? + +cd ~ + +//3. 用长格式列出/tmp/test目录下所有的文件包括隐藏文件? + +ls -al /tmp/test + + +//4. /tmp/test2目录下,创建5个文件分别是 1.txt 2.txt 3.txt 4.txt 5.txt,压缩这5个文件,压缩包的名字是hailiang.tar + +touch /tmp/test2/1.txt /tmp/test2/2.txt /tmp/test2/3.txt /tmp/test2/4.txt /tmp/test2/5.txt + +tar czvf /tmp/test2/hailiang.tar /tmp/test2/1.txt /tmp/test2/2.txt /tmp/test2/3.txt /tmp/test2/4.txt /tmp/test2/5.txt + + +//5. 当前目录,建立文件 file1.txt 并更名为 file2.txt? + +touch /tmp/test2/file1.txt +mv /tmp/test2/file1.txt /tmp/test2/file2.txt + +//6. 当前目录,用vim建立文件bbbb.txt 并将用户名的加入其中保存退出? + +ceshi@debian:/tmp/test2$ vim bbbb.txt +:wq + +//7. 将家目录中扩展名为txt、doc和bak的文件全部复制到/tmp/test目录中? + +cp ~/.*.txt ~/.*.doc ~/.*.bak /tmp/test + +//8. 将文件file1.txt从当前目录移动到家目录的/docs中。 + +mv /tmp/test2/file1.txt ~/docs + +//9. 复制文件file2.txt从当前目录到家目录/backup中。 + +cp /tmp/test2/file2.txt ~/backup/ + +//10. 将家目录/docs中的所有文件和子目录移动到家目录/archive中。 + +mv -r ~/docs/* ~/archive/ + +//11. 复制家目录/photos及其所有内容到家目录/backup中 + +cp -r /home/ceshi/photos/* /home/ceshi/backup/ + +//12. 将文件家目录/docs/report.doc移动到家目录/papers中,并将其重命名为final_report.doc。 + +mv /home/ceshi/docs/report.doc /home/ceshi/papers/final_report.doc + +//13. 在家目录/docs中创建一个名为notes.txt的空文件,并将其复制到目录家目录/backup中。 + +touch /home/ceshi/docs/notes.txt +cp /home/ceshi/docs/notes.txt /home/ceshi/backup/ + +//14. 复制家目录/images中所有以.jpg结尾的文件到家目录/photos中。 + +cp /home/ceshi/images/*.jpg /home/ceshi/photos/ + +//15. 将文件家目录/docs/file1.txt和家目录/docs/file2.txt复制到家目录/backup中。 + +cp /home/ceshi/docs/file1.txt /home/ceshi/docs/file2.txt /home/ceshi/backup/ + +//16. 将家目录/docs中的所有.txt文件复制到家目录/text_files中。 + +cp /home/ceshi/docs/*.txt /home/ceshi/text_files/ + + +//17. 将家目录/docs中的所有文件移动到家目录/temp中,并且如果文件已存在,则覆盖它们。 + +mv -f /home/ceshi/docs/* /home/ceshi/temp/ + +//18. 将家目录/docs中的所有文件移动到家目录/archive中,并且在移动时显示详细的移动信息。 + +mv -v /home/ceshi/docs/* /home/ceshi/archive/ + +//19. 复制家目录/docs中的所有子目录及其内容到家目录/backup中。 + +cp -r /home/ceshi/docs/* /home/ceshi/backup/ + +//20. 将家目录/docs中的所有文件和子目录移动到家目录/backup中,但排除文件名以"temp_"开头的文件。 + +mv /home/ceshi/docs/[^temp_]* /home/ceshi/backup/ + +//21. 将目录/docs/report.txt移动到家目录/archive中,但如果目标目录中已存在同名文件,则不直接覆盖,先备份同名文件为report.txt_bak。 + +mv -bS _bak /home/exam/docs/report.txt /home/exam/archive/ + +//22. 将家目录/docs中所有以.pdf结尾的文件复制到家目录/pdf_files中,并且如果目标目录中已存在同名文件,则忽略它们。 + +cp -n /home/ceshi/docs/*.pdf /home/ceshi/pdf_files/ + +``` + -- Gitee