Skip to main content
Ctrl+K
Effective Programming Practices for Economists: Topics - Home Effective Programming Practices for Economists: Topics - Home
  • Some Background
    • A Brief History of Operating Systems
    • Graphs
    • File Systems
  • Miscellaneous Tools
    • History of computer interfaces
    • Why use shells today?
    • Navigation in the unix shell
    • Navigation in the windows shell
  • Git and Github
    • Introduction and Overview
    • Why git?
    • Installing git and some useful shell commands
    • How git works
    • Creating repositiories
    • Cloning GitHub repos + Personal Access Tokens
    • Staging files
    • Making commits
    • Undoing things
    • Branches
    • Merging and resolving merge conflicts
    • Introduction to GitHub
    • Collaboration
    • Pre-commit hooks
  • Python: Installation and Execution
    • Installation and introduction to Pixi
    • Executing .py files in VS Code
    • Executing Jupyter notebooks in VS Code
    • Running Python code via pytask
    • Running Python code via pytest
    • Modifying Pixi environments
  • Python: Installation and Execution (via conda)
    • Installing Python on Linux (conda/mamba)
    • Installing Python on Mac
    • Installing Python on Windows (conda/mamba)
    • Installing Python with Windows Subsystem for Linux (WSL2) (conda/mamba)
    • Executing notebooks in a browser (conda/mamba)
    • Executing jupyter notebooks in VS Code (conda/mamba)
    • Executing .py files from the shell (conda/mamba)
    • Executing .py files in VS Code (conda/mamba)
    • Running Python code via pytask (conda/mamba)
    • Running Python code via pytest (conda/mamba)
    • Environment files and environments (conda/mamba)
  • Python Basics
    • Assignment and Built-in Scalar Types
    • Strings
    • Lists, Tuples and Sets
    • Dictionaries
    • For loops
    • If conditions
    • Comprehensions
    • Defining Functions
    • Principles for Good Functions
    • Tracebacks and Asking for Help
    • Importing, Namespaces, Modules
    • File paths with pathlib
  • Debugging
    • Introduction to debugging
    • Strategies for debugging
    • Avoiding debugging
    • (Armchair) Psychology of debugging
    • Gathering data efficiently
    • Using the Pdb+ debugger
  • Software Engineering
    • Style guides
    • Naming things
    • Pure functions
    • The idea of unit testing
    • What does pytest do?
    • Writing simple (py)tests
    • Testing code that should raise errors
    • What to test? How to test it?
    • Reusing test code
    • Introduction to error handling
    • Which errors to handle?
    • How to raise errors?
    • Worked error handling example
    • Defining custom containers
    • When to use custom containers?
    • Partialling arguments to functions
  • Data management with pandas
    • What is (modern) pandas?
    • DataFrames and Series
    • Data types
    • Loading and saving data
    • Setting and renaming columns and indices
    • Selecting rows and columns
    • Inspecting and summarizing data
    • Creating variables
    • Rules for data management
    • Merging datasets
    • Functional data management: Fundamental rules
    • Functional data management
    • Functional data management: Example
  • Scientific Computing
    • What is numpy?
    • Creating arrays
    • Array indexing
    • Calculations on arrays
    • Calculations between arrays
    • Randomness
    • Broadcasting
    • Introduction to making code fast
    • Measuring runtime
    • Profiling code with snakeviz
    • Line profiling
    • Writing fast code with numpy
    • Writing fast code with numba
  • Numerical Optimization
    • Introduction to numerical optimization
    • Optimagic overview
    • Using optimagic’s minimize and maximize
    • Choosing optimization algorithms
    • Visualizing optimizer histories
    • Set up of the example
    • Grid Search
    • Derivative-Based Line Search
    • Derivative-Based Trust Region
    • Derivative-Free Direct Search
    • Derivative-Free Trust Region
  • Reproducible Research
    • What does reproducibility mean?
    • What does pytask do?
    • Writing simple (py)tasks
    • Writing (py)tasks with multiple outputs
    • Re-using pytask functions
    • The pytask documentation
    • What are the project templates?
    • Setting up a project
    • Directory structure in the templates
    • Handling paths in projects
  • Texts, Typesetting, and Text Data
    • Markup languages
    • Markdown syntax
    • Markdown applications
    • Writing Readme Files
  • Plotting
    • Goals and Workflow
    • Practical Approach
    • Why plotly? And some prerequisites.
    • Quick plots with plotly express
    • Quick plots with plotly express: Example Notebook
    • Customise plots created with plotly express
    • Customise plots created with plotly express: Example Notebook
    • Customised plots with plotly graph objects
    • Customised plots with plotly graph objects: Example Notebook
  • Data Analysis in Python
    • Python’s Data Analysis Ecosystem
    • Running regressions using statsmodels
    • Working with statsmodels’ results objects
    • Introduction to Machine Learning
    • Introduction to scikit-learn
    • Cross-validation and hyperparamters in scikit-learn
  • .ipynb

Navigation in the unix shell

Contents

  • Learning Objectives
  • Materials
    • Installation of the z-command (not required!!!)
  • Quiz

Navigation in the unix shell#

Learning Objectives#

After working through this topic, you should be able to:

  • Explain what the present working directory (pwd) is

  • Use the pwd command to display your working directory

  • Use cd to navigate to different directories

  • Use ls to list directories

  • Use the z command to navigate more efficiently between files

Materials#

Video:

Download the slides.

Installation of the z-command (not required!!!)#

Warning

You do not need this. Only follow the steps below if you know what you are doing already.

You definitely do not want to do this on the day you learn what a shell is.

After all, the z-command is just a tiny helper that only becomes useful when you use the shell a lot in your everyday workflow.

The z-command is a command that allows you to navigate more efficiently. In case the screencast convinced you that installing it is a good idea, here are some instructions.

  1. Download the z.sh file and save it as z.sh into the downloads folder.

  2. Move the file to /usr/local/bin. If you saved the file in the downloads folder you can open a terminal and run the command (when you are asked to type your password, do so, even if you do not see anything appearing on the screen):

sudo mv ~/Downloads/z.sh /usr/local/bin
  1. Open the file ~/.zshrc (or ~/.bashrc if you use bash) in a text editor and append the line:

. /usr/local/bin/z.sh
  1. Close and reopen your terminal. You can test if you have successfully installed the command by typing in z.

Quiz#

previous

Why use shells today?

next

Navigation in the windows shell

Contents
  • Learning Objectives
  • Materials
    • Installation of the z-command (not required!!!)
  • Quiz

By Janoś Gabler and Hans-Martin von Gaudecker