Shell Scripting
Shell Scripting
- L1. Introduction to Shell
- C1: manipulating files and directories
- pwd: where am I?
- ls: how can I identify files and directories?
- How else can I identify files and directories?
- cd: how can I move to another directory?
- How can I move up a directory?
- cp: how can I copy files?
- mv: how can I move a file?
- mv: how can I rename files?
- rm: how can I delete files?
- rmdir: how can I create and delete directories?
- C2: manipulating data
- cat: how can I view a file's contents?
- less: how can I view a file's contents piece by piece?
- head: how can I look at the start of a file?
- tab completion: how can I type less?
- command-line flag: how can I control what commands do?
- -R: how can I list everything below a directory?
- man: how can I get help for a command?
- cut: how can I select columns from a file?
- What can't cut do?
- history: how can I repeat commands?
- grep: how can I select lines containing specific values?
- paste: why isn't it always safe to treat data as text?
- C3: combining tools
- >: how can I store a command's output in a file?
- How can I use a command's output as an input?
- What's a better way to combine commands?
- How can I combine many commands?
- wc: How can I count the records in a file?
- *: how can I specify many files at once?
- What other wildcards can I use?
- sort: how can I sort lines of text?
- uniq: how can I remove duplicate lines?
- How can I save the output of a pipe?
- Ctrl+C: how can I stop a running program?
- C4: batch processing
- How does the shell store information?
- echo: how can I print a variable's value?
- shell variable: how else does the shell store information?
- loop: how can I repeat a command many times?
- How can I repeat a command once for each file?
- How can I record the names of a set of files?
- A variable's name versus its value
- How can I run many commands in a single loop?
- Why shouldn't I use spaces in filenames?
- How can I do many things in a single loop?
- C5: creating new tools
- nano: how can I edit a file?
- history: how can I record what I just did?
- How can I save commands to re-run later?
- bash script: how can I re-use pipes?
- [email protected]: how can I pass filenames to scripts?
- $1, $2, ... : how can I process a single argument?
- How can one shell script do many things?
- How can I write loops in a shell script?
- What happens when I don't provide filenames?
L1. Introduction to Shell
C1: manipulating files and directories
pwd: where am I?
ls: how can I identify files and directories?
How else can I identify files and directories?
cd: how can I move to another directory?
How can I move up a directory?
cp: how can I copy files?
mv: how can I move a file?
mv: how can I rename files?
rm: how can I delete files?
rmdir: how can I create and delete directories?
C2: manipulating data
cat: how can I view a file’s contents?
less: how can I view a file’s contents piece by piece?
head: how can I look at the start of a file?
tab completion: how can I type less?
command-line flag: how can I control what commands do?
-R: how can I list everything below a directory?
To help you know what is what, ls
has another flag -F
that prints a /
after the name of every directory and a *
after the name of every runnable program.
man: how can I get help for a command?
cut: how can I select columns from a file?
What can’t cut do?
history: how can I repeat commands?
grep: how can I select lines containing specific values?
paste: why isn’t it always safe to treat data as text?
C3: combining tools
>: how can I store a command’s output in a file?
How can I use a command’s output as an input?
What’s a better way to combine commands?
How can I combine many commands?
wc: How can I count the records in a file?
*: how can I specify many files at once?
What other wildcards can I use?
sort: how can I sort lines of text?
uniq: how can I remove duplicate lines?
How can I save the output of a pipe?
Ctrl+C: how can I stop a running program?
C4: batch processing
How does the shell store information?
Answer: 2000