Learning the Command Line: File Extensions, Beginning Grep
2025-09-24
mkdirlsrmdir, rmtouchcurl -o file.txtcdsource script.shLIN_301 folderp_and_pp_and_p.txtp_and_p.txt into the folder p_and_pWhen programming, there are lots of different file types:
txt - a (raw) text filehtml - an html file, to be viewed in a web browserxml - an Exstensible Markup Language filemd - a Markdown file (can be converted into html)tex - a LaTeX file (can be converted into a pdf)py - a Python scriptr - an R scriptAll of these can be easily converted, as they’re all just text!
# create md file
touch test.md
# start with a md file
echo "# Hello World" > test.md
echo "This is *italic* and **bold**." >> test.md
# convert markdown → html
pandoc test.md -o test.html
# convert html → plain text
pandoc test.html -t plain -o test.txtpandoc if you’d like; if not, you can just follow along for this section.docx and odt.sh file called convert.sh# 1) Make a tiny Markdown source
echo "# Hello!" > demo.md
echo "This is a *line* and **text**." >> demo.md
# 2) Convert MD → HTML
pandoc demo.md -o demo.html
# 3) Convert MD → DOCX and → ODT
pandoc demo.md -o demo.docx
pandoc demo.md -o demo.odtfilehead, to print out what’s inside the file itself.wc, grep, and pipingp_and_pp_and_p.txtp_and_p.txt into the folder p_and_pcd, navigate to LIN_301/p_and_p and using ls confirm that the file is thereup and down in the document using the up/down arrowsspacebar to jump down a pageq to return to the command promptIn Terminal, type in the following code:
wc FlagsgrepgrepUsing the Terminal:
frankfrank.txt and move it to the frank foldergrep, wc, and |, count how many lines have the word monster in them