Day 5

Linux Fun

In the reading, we learned a variety of useful commands:

• ls
• pwd, cd
• cp, mv
• rm, rmdir
• sudo
• cat, more/less
• wget
• grep
• sed

as well as concepts like:

• tab file name completion
• output redirection with | and >
• quitting with Control-c

If any of these look unfamiliar to you, jump back to the reading for a refresher. You can also run man pwd to look at the ‘man’ual page for the pwd command or any other.

The man command is a great built-in feature but can sometimes be an intimidating information dump. If you’d like a gentler start, you can check out tldr, which offers a simpler description with examples. Since you have Anaconda, you can install tldr by running:

pip install tldr

Once you’ve got the hang of things and are a power user of these commands, you can switch back to man to see all the available options you can take advantage of.

We also learned that working in the command line is powerful, but comes with no “undo” functionality. If you’d like to give yourself a bit of a safety net when running commands like rm, read on to sections 2.11-2.12 to see how to make those commands ask for confirmation first.

As we discussed last time, state and stack diagrams are extremely useful for reasoning about code, especially with mutable objects like lists. We can use Python Tutor to visualize the difference between middle and chop.

Iteration

Quick check: Compare and contrast lists and strings

One thing they have in common are that both are “iterables” - we can iterate over all the characters of a string or over all the elements of a list.