Lecture 01 Bonus Content

These topics are optional and not required for future lectures. Explore them if you're curious or want to deepen your understanding!

Advanced ls Options

Beyond the basic ls, there are many useful variations:

ls -la          # Long format with hidden files
ls -lh          # Human-readable file sizes
ls -lt          # Sort by modification time
ls -lr          # Reverse order
ls *.py         # List only Python files
ls -R           # Recursive (show subdirectories too)

Python REPL Advanced Features

The interactive Python environment has helpful features:

# Special variables
_                   # Result of last expression
__name__           # Current module name

# Useful functions for exploration
dir()              # List available names
help(print)        # Get help on function
type(variable)     # Check variable type
len(text)          # Length of strings/lists

Command History and Shortcuts

Make your command line experience smoother:

# History navigation
↑/↓ arrows         # Previous/next command
history            # Show recent commands
!123               # Run command #123 from history
!!                 # Run last command again

# Editing shortcuts
Ctrl+A             # Beginning of line
Ctrl+E             # End of line
Ctrl+U             # Clear entire line
Tab                # Auto-complete (your best friend!)

Python help() and dir() Functions

These built-in functions are incredibly useful for learning:

# Explore what's available
help(str)          # Help on string methods
dir(str)           # List all string methods
help(str.split)    # Help on specific method

# Interactive help
help()             # Enter help mode
# Type "quit" to exit help mode

# Quick information
print.__doc__      # Function documentation
str.upper.__doc__   # Method documentation

File Permissions Basics

Understanding what you can and can't do with files:

ls -l              # Shows permissions (rwxrwxrwx format)
chmod +x script.py # Make file executable
chmod 644 file.txt # Set specific permissions

# Permission format: owner-group-others
# r = read (4), w = write (2), x = execute (1)
# 644 = owner can read/write, others can read

Environment Variables Preview

Your computer stores settings in environment variables:

echo $HOME         # Your home directory
echo $PATH         # Where computer looks for commands
env                # Show all environment variables

# In Python, you can access these too:
import os
print(os.environ['HOME'])    # Access environment variable