MIT|Missing Semester计算机教育中缺失的一课

Missing Semester 学习

课程主页:https://missing.csail.mit.edu

课程记录

一、Course overview + the shell

1.1 shell命令入门

echo "hello world"
echo 'hello world'
echo hello\ world

1.2 how system can find echo?

echo $PATH
which echo
/bin/echo "hello world"

1.3 navigting in the shell

cd
pwd
绝对路径和相对路径
ls和ls -l

1.4 connecting programs

programs always associated with tow stream: input stream and output stream
redirection < file and > file
when cat is not given any arguments, it prints contents from its input stream to its output stream
cat < hello.txt
| pipe command

二、Shell Tools and Scripting

shell scripting, about learning a new language:

  • basic data type
  • Control flow
    • If
    • case
    • while
    • for
  • syntax

2.1 variable

foo=bar # foo = bar is wrong
echo "$foo" # this print bar
echo '$foo' # this print $foo

2.2 function

mcd () {
	mkdir -p "$1"
	cd "$1"
}
  • $0 name of program
  • $1-9 arguments to the script
  • $# number of arguments
  • $$ pid
  • $@ all the arguments
  • $? the last command’s exit status

2.3 Logical command

|| 
&&
; # simplely seperate current command and the next command

2.4 command substitution

echo "start program at $(date)"

2.5 Process substitution

<(cmd) # this will execute cmd and place the output in a temporary file and substitute the
# <() with that file's name

2.6 wildcards and curly braces

*
{}

2.7 shebang line

#!/usr/local/bin/python

differences between shell functions and scripts

  • functions are executed in the current shell environment
  • scripts execute in their own process

2.8 shell tools

find 
grep
  • TLDR pages
  • fasd
  • autojump
  • tree
  • nnn

五、Command-line Environment

5.1 job control

你的shell使用一种叫做信号的机制在进程间沟通。信号是一种软中断机制。

ctrl-c 传递SIGINT信号
ctrl-\ 传递SIGQUIT信号
ctrl-z 传递SIGTSTP信号,short for Terminal Stop

SIGTERM signal ask a process to exit. Using kill command to send it.

  • kill
  • jobs
  • fg
  • bg
  • nohup

5.2 terminal multiplexers

tmux教学

leading key <C-b> x means you press ctrl and b, then release them together, and then press x

panes

竖直分裂一个窗口 <C-b> %
水平分裂一个窗口 <C-b> "
关闭当前窗口 exit or ctrl-d

windows - equivalent to tabs in browsers(threads in process)

<C-b> c  创建一个虚拟桌面
<C-b> p  切换上一个
<C-b> n		切换下一个

sessions - a session is an independent workspace with one or more windows

tmux  # start a new session
tmux new -s NAME # start a new session with name
tmux ls #ls current sessions
detach a session with <C-b> d
attach a session `tmux a` , with -t to specify which

5.3 Aliases

alias name="command arg1 arg2"

常见的别名设置:

todo

5.4 Dotfiles

指隐藏文件,通常是各种程序的配置文件。

  • bash ~/.bashrc or~/.bash_profile
  • git ~/.gitconfig
  • vim ~/.vimrc
  • tmux ~/.tmux.conf
  • ssh~/.ssh/config

关于隐藏文件,我们需要知道三件事:

  • 内容
  • 位置
  • 管理

5.5 Remote Machines

5.6 Shells & Frameworks

On-my-zsh

  • Syntax-highlighting
  • History-substring-search
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值