LING 398
Elsayed Issa
Jingying Hu
Spring 2026

Python Programming - Overview

1. Questions and Installation Troubleshooting

  • Mac

  • Linux

  • Windows

  • Anaconda troubleshooting: https://docs.anaconda.com/free/anaconda/reference/troubleshooting/

2. Some command-line commands

System Info:¶

Command Meaning
uname -a info about OS system and kernel
date shows date
uptime shows uptime
whoami shows username
man (COMMAD NAME) shows the documentation for a command

Directories and Files:¶

Command Meaning
pwd print working directory
cd change directory
cd .. change directory and move up on level
mkdir create a dirctory (folder)
touch create a file
cp copy file
cp -r copy folder
mv move or rename file/folder
ls list all files and folder in a directory
cat view the content of a file
rm delete a file
rmdir delete a folder

Search Files:¶

Command Meaning
grep case sensitive search: `grep "Alice" alice.txt`
grep -i case insensitive search: `grep -i "Alice" alice.txt`
grep -v inverted search - lines that does not match the pattern
grep -o shows only the matching part of the line, not the entire line

3. Jupyter Notebook

  • There are many ways to write and run Python code, but we will be using Jupyter Notebooks.

  • Jupyter Notebooks allow us to write active runnable code and text.

  • For example:

In [1]:
my_name = "John"
print(my_name)
John
  • The idea is that the presentation and explanation of Python examples can be interleaved with working editable code examples.

  • The software that does this is Jupyter. This is a part of the Anaconda installation of Python which is free.

  • Some of our handouts/presentations/homework will be written using Jupyter, so that, as I'm presenting basic python concepts, you'll have little code bits you can play with.

Running Jupyter¶

  • Download the 01-troubleshooting-command-line notebook from the website to your desktop or any other folder.

  • Open the terminal application on your machine.

  • Using the cd command, switch to ~/Desktop or the designated folder.

  • Then type jupyter notebook.

  • A window should open that includes 01-troubleshooting-command-line. Click on that.

  • You can now run/change the code snippets in this notebook.

Quiting Jupyter¶

  • To exit the Jupyter program, you first close the notebook window. There are then two ways to quit:

  • In the dashboard window, click Logout. Then, in the terminal window, hit Control-c twice.

  • Alternatively, you can just hit the Quit buton in the dashboard window.

What you can do in Jupyter¶

  • There are two kinds of fields in a notebook: code and text. The code fields for us will always be Python. The text fields are formatted using a combination of HTML and markdown.

  • Double-clicking in a text field displays the formatting command. Pressing the run button in the menubar shows the formatted text.

  • Code fields can be edited directly. Pressing the run button runs the code.

In [ ]: