Unix
https://harvard-iacs.github.io/2019-CS207/lectures/lecture2/
David Sondak
Harvard University Institute for Applied Computational Science
9/10/2019
Unix https://harvard-iacs.github.io/2019-CS207/lectures/lecture2/ - - PowerPoint PPT Presentation
Unix https://harvard-iacs.github.io/2019-CS207/lectures/lecture2/ David Sondak Harvard University Institute for Applied Computational Science 9/10/2019 Last Time Unix and Linux Text editors 1 / 29 Today Shell Customization
https://harvard-iacs.github.io/2019-CS207/lectures/lecture2/
David Sondak
Harvard University Institute for Applied Computational Science
9/10/2019
1 / 29
Again, some content adapted from Dr. Chris Simmons.
2 / 29
use of available Unix text editors
4 / 29
back in sed/awk: useful to know.
5 / 29
modes of operation:
current file
6 / 29
7 / 29
result
Here are some vim resources: https://vim.rtorr.com/, https://devhints.io/vim, https://vim-adventures.com/, vimtutor.
8 / 29
shell when it starts up
administrators (e.g. /etc/profile)
additional customization
9 / 29
Useful information can be found at the bash man page: https://linux.die.net/man/1/bash
Decent reference on the difference between .bash profile and .bashrc: Apple Stack Exchange, Scripting OS X
10 / 29
Update your .bash profile Exercise goals:
https://www.tecmint.com/create-alias-in-linux/]
biz/tips/howto-linux-unix-bash-shell-setup-prompt.html)
Deliverables:
aliases. Note to Windows users: Modify Bash Profile in Windows Note: The Dracula Theme is pretty fun.
11 / 29
Standard Input (STDIN) Standard Output (STDOUT) Standard Error (STDERR)
12 / 29
13 / 29
named foo while ls >> foo appends the output to foo
14 / 29
filenames in the current directory
15 / 29
16 / 29
the background
16 / 29
the background
16 / 29
the background
16 / 29
the background
16 / 29
17 / 29
name and value associated with them
entered
18 / 29
name and value associated with them
entered
18 / 29
name and value associated with them
entered
18 / 29
name and value associated with them
entered
18 / 29
following:
name matches the desired command
19 / 29
following:
name matches the desired command
19 / 29
following:
name matches the desired command
19 / 29
following:
name matches the desired command
19 / 29
following:
name matches the desired command
export PATH="$PATH:/Users/dsondak"
19 / 29
your current shell
particular shell (in bash, this is .bashrc)
20 / 29
interactively
22 / 29
should be used to execute the remaining commands in the file
23 / 29
24 / 29
i f [ condition A ] ; then # code to run i f condition A true e l i f [ condition B ] ; then # code to run i f condition A f a l s e and # condition B true else # code to run i f both c o n d i t i o n s f a l s e f i
25 / 29
today=”monday” i f [ ” $today ” = ”monday” ] ; then echo ”Today i s Monday ! ” f i
26 / 29
x=13 y=25 i f [ $x −l t $y ] ; then echo ”$x i s l e s s than $y” f i
27 / 29
i f [ −f foo ] ; then echo ” foo i s a f i l e ” f i
28 / 29
https://harvard-iacs.github.io/2019-CS207/lectures/lecture2/
29 / 29