Linux-2025-fall

来自SUDA-HLT
Zhli讨论 | 贡献2025年11月24日 (一) 00:30的版本 →‎TODO
跳到导航 跳到搜索

课程安排

  • 老师: 李正华
  • 助教:周昊喆、郑书禾
  • 计23计科1班,计23计科2班(大三上)
  • 专业选修课
  • 上课时间和地点
    • 理论课:周一 3-4节 9:55-11:30 逸夫楼334 【1-17周】
    • 实践课:周三 1-2节 8:00-9:35 理工楼243 【单周】
    • 没上课的情况记录:
  • 平时10%(考勤等)、实验成绩30%(实验报告、随堂考试)、期末60%(闭卷)

注意事项

  • 上机课做学习无关的事情,发现则平时和实验成绩为0

自学资料

参考书

  • Unix & Linux大学教程 哈恩(Harley Hahn) (作者), 张杰良 (译者) 【基础内容、讲得比较细;图书馆可以借】
  • 跟阿铭学Linux 李世明 人民邮电出版社 【难度适中,我们只学前半部分】
  • 鸟哥的Linux私房菜 基础学习篇(第三版)【我觉得讲得比较深,想深入学的同学可以考虑用】

板书和笔记

TODO

find

top ps kill fg bg 等

11.24 12.1/8/15/22【五次课】

Lesson 11(2025.11.17;第12周)

  • shell编程,变量,环境变量
  • test命令
  • 变量运算
  • 所用到的指令
1993  x=5
1994  y = 3
1995  y=3
1996  echo $x+$y
1997  echo ${x3}
1998  echo $x3
1999  echo $x35
2000  echo $x_3
2001  echo $x10
2002  echo ${x1}0
2003  echo $(($x+$y))
2004  man let
2005  help let
2006  let z=x+y
2007  echo $z
2008  a=(Ab Cd 12 34)
2009  echo $a
2010  echo ${a[0]}
2011  echo ${a[1]}
2012  echo ${#a[@]}
2013  bash
2014  echo $x
2015  export x
2016  echo $x
2017  bash
2018  echo $x
2019  bash
2020  test 9 -gt 7
2021  echo $?
2022  test 9 -gt 19
2023  echo $?
2024  [ 9 -gt 19 ]
2025  echo $?
2026  [ -z $x ]
2027  echo $?
2028  echo $x
2029  [ -z x ]
2030  echo $?
2031  [ -z  ]
2032  echo $?
2033  [ 9 -gt 7 -a 9 -gt 19 ]
2034  echo $?
2035  [ 9 -gt 7 ] && [ 9 -gt 19 ]
2036  echo $?
2037  help test
2038  w
2039  x=`ls /bin`
2040  echo $x
2041  y=$(ls /bin)
2042  echo $y
2043  echo ${#x}
2044  read -p 'xxx: ' x
2045  echo $x
2046  read -p 'xxx: ' x
2047  echo $x
2048  help read
2049  read x y
2050  echo $x $y
2051  echo $x
2052  echo $y

Lesson 10(2025.11.10;第11周)

  • sed命令
  • awk命令
  • 所使用到的命令
1992  egrep 'hello' a.txt 
1993  egrep -n 'hello' a.txt 
1994  egrep -no 'hello' a.txt 
1995  egrep 'hello'
1996  egrep '\w\w\w' 
1997  egrep 'punct:' 
1998  egrep 'digit:' 
1999  egrep '[a-z]*'
2000  egrep '[a-z]{3}'
2001  man egrep
2002  egrep '(abc)|(ABC)' 
2003  egrep '^[0-9]{3}'
2004  egrep '^.....$'
2005  ls (a|b).txt
2006  ls a|b.txt
2007  egrep '[a-z]{3}\1' 
2008  egrep '([a-z]{3})\1' 
2009  tr 'a-z' 'A-Z'
2010  tr 'za-y' 'A-Z'
2011  man tr
2012  tr -d 'a-z' 
2013  tr -s 'a-z'
2014  tr -s -C 'a-z'


测试样例如下:

awk常用内置函数:

Lesson 9(2025.11.3;第10周)

  • 正则表达式
  • tr命令
  • 所使用到的命令
1992  egrep 'hello' a.txt 
1993  egrep -n 'hello' a.txt 
1994  egrep -no 'hello' a.txt 
1995  egrep 'hello'
1996  egrep '\w\w\w' 
1997  egrep 'punct:' 
1998  egrep 'digit:' 
1999  egrep '[a-z]*'
2000  egrep '[a-z]{3}'
2001  man egrep
2002  egrep '(abc)|(ABC)' 
2003  egrep '^[0-9]{3}'
2004  egrep '^.....$'
2005  ls (a|b).txt
2006  ls a|b.txt
2007  egrep '[a-z]{3}\1' 
2008  egrep '([a-z]{3})\1' 
2009  tr 'a-z' 'A-Z'
2010  tr 'za-y' 'A-Z'
2011  man tr
2012  tr -d 'a-z' 
2013  tr -s 'a-z'
2014  tr -s -C 'a-z'
  • 命令演示截图

Lesson 8(2025.10.27;第9周)

  • 重定向输入,重定向输出
  • 前台运行程序与后台运行程序
  • Linux哲学
  • 管道的应用,以及sort,uniq,wc,egrep命令等。
  • 所使用到的命令
1990  ls > a.txt
1991  vi a.txt 
1992  ls /root > a.txt
1993  vi a.txt
1994  help fg
1995  vi a.txt
1996  less a.txt 
1997  bg
1998  jobs
1999  fg 1
2000  cat 
2001  vi a.txt 
2002  cat a.txt 
2003  cat < a.txt
2004  find . -name 'words'
2005  vi words
2006  find . -name 'name'
2007  find . -name '*name*'
2008  vi names
2009  mv names names.txt
2010  cat names 
2011  cat names.txt 
2012  cat names.txt | sort 
2013  cat names.txt | sort | uniq
2014  cat names.txt | sort | uniq -c
2015  cat names.txt | sort | uniq -c | sort -n -k 1
2016  cat names.txt | sort | uniq -c | sort -rn -k 1
2017  vi names.txt 
2018  cat names.txt | sort | uniq -c | sort -rn -k 1
2019  man sort
2020  vi names.txt 
2021  cat names.txt | tee names2.txt | sort
2022  vi names2.txt 
2023  man tee
2024  sort a.txt
2025  sort names.txt 
2026  sort names.txt | uniq 
2027  sort names.txt | uniq | wc
2028  sort names.txt | uniq | wc -l
2029  sort -u names.txt
2030  man egrep
2031  egrep '.....' words | less
2032  egrep '^.....$' words | less
2033  egrep -n '^.....$' words | less
2034  egrep 'wat' words
2035  egrep -o 'wat' words
2036  find /etc/ -name '*words*'
  • 管道测试样例

Zhenghua
Zhenghua
Zhangsan
Lisi
Lily
Zhenghua
Zhenghua
Lisi
Zhangsan

Lesson 7(2025.10.20;第8周)【随堂考试 4 道题】

  • 复习vi
  • 通配符的概念,使用方法
  • 重定向输入

Lesson 6(2025.10.13;第7周)

  • 普通(命令)模式下,移动光标,删除,复制粘贴,替换,撤销等操作

Lesson 5(2025.9.29;第5周)

  • cp,mkdir, mv, rm等命令的使用
  • 内部命令与外部命令的区别
  • vi的介绍。
  • 所使用到的命令
1990  type rm mkdir ls cd pwd
1991  alias lm='ls -la --color=never'
1992  lm 
1993  ls -la
1994  echo $PATH

Lesson 4(2025.9.22;第4周)【随堂考试 3 道题】

  • shell使用技巧(快捷键进行检索,终止进程等)
  • 文件查看(cat,head,tail,less,hexdump命令等)
  • 文件操作(cp命令)
  • 所使用到的命令
1991  history 
1992  history | egrep 'man'
1993  man printf
1994  man ls
1995  ls
1996* 
1997  history | egrep 'man'
1998  less en.dev.autotagMIRA.conll.dep
1999  man hexdump 
2000  hexdump -c en.dev.autotagMIRA.conll.dep
2001  hexdump -c en.dev.autotagMIRA.conll.dep | less
2002  hexdump en.dev.autotagMIRA.conll.dep | less
2003  hexdump -c en.dev.autotagMIRA.conll.dep | less
2004  man cp

Lesson 3(2025.9.15;第3周)


  • man ls的使用方法
  • man man(man的基本使用)
  • 所使用到的命令
 1991  ls
 1992  ls /
 1993  whereis ls
 1994  vi /etc[防ban去掉]/hosts
 1995  cd xxx
 1996  ls -a
 1997  cd .
 1998  cd ..
 1999  man ls
 2000  ls
 2001  ls --color=never
 2002  man ls
 2003  ls Documents
 2004  ls -d Documents
 2005  ls -ld Documents
 2006  pwd
 2007  ls -l
 2008  ls -lh
 2009  ls -lS
 2010  ls -ltc | less
 2011  ls -lta | less
 2012  ls -lt | less
 2013  man ls
 2014  man man
 2015  man printf
 2016  man 3 printf
 2017  printf '%30d%20.3f' 232 2.2323232
 2018  printf '%30d%20.3f\n' 232 2.2323232 
 2019  printf '%-30d%-20.3f\n' 232 2.2323232 
 2020  man -k print
 2021  man -k print[efgh]
 2022  man -k print[e][r]

Lesson 2(2025.9.8;第2周)

  • shell基本使用、shell的概念、父shell、子shell
  • 命令语法、ls命令
  • 命令行参数、python中sys.argv
  • 所使用到的命令
1988  ps afx | egrep bash
1989  echo $$
1990  exit
1991  ls
1992  ps afx | egrep bash
1993  bc
1994  sudo su
1995  ls
1996  ls -l
1997  ls -a
1998  ls --all
1999  ls -la
2000  ls Downloads/ Documents xxx

Lesson 1(2025.9.1;第1周)


  • 课程介绍、个人介绍
  • Linux安装
  • 图形界面、文字界面
  • 所使用到的命令
1987  uname -a
1988  ps afx | egrep gnome
1989  init 3
1990  sudo init 3
1991  w
1992  who
1993  man who
1994  w
1995  who
1996  vi a.txt
1997  bash