My Command Line Library

#!/usr/bin/env python3Include this as the first line of code, Win10, Linux, or Mac is all okay
pythonstarts the python programterminal
ctrl + z + enterquit python going back to terminalctrl + d + enter for Linux/Mac
clsclear terminalterminal
clearclear terminalpython
.\fileNameruns a python program from the terminalMust have the terminal navigate to the directory containing the file
python fileNamealso runs a python program from the terminal
python -Ouse this when executing a module to optimize) and set __debug__ to FalseTo run the python interpreter with the optimize option, from the command line, navigate into the directory containing the file, type 'python -O fileName'
python -OOperforms optimization to a 2nd level which removes any special docstrings from the codeBe cautious using this as the code itself may reference something __doc__, and if True, the code will break run with double-optimization
mkdir enterNameHereCreate folder/directory for project
pip --helpPIP helpterminalpip [option]
pip listlists installed packages
pip list --helpspecific list helppip list [option]
pip list -olist outdated packagesor --outdated
pip install [package name]install a package via pip
pip-autoremove [package name]removes a pip package and all it's dependenciesremoves the dependencies of dependencies too
pip uninstall [package name]uninstall one package via pipthis way does not delete installed dependencies
pip3 install virtualenvterminal
sudo apt install python3-pipInstall pippython (linux)
pip3 install python-crontabInstall crontab for cron jobspython (linux)Linux only?
cat fileName.pyopens the program in the python terminal
cd ~
cd ..

My Python Program Cheat Sheet

[ ]Listsmutable (changes)
( )Tuplesimmutable
( )Generator Expressions
{ }Dictionaries
{ }Set Comprehension

Python Modules and Packages

Package/Module NameDescriptionWebsiteTerminal CommandNotes
requestsincludes urllib3, chardet, idna
httpieincluded requests, colorama, pygments
autoremoveauto-removes a pip package and all it's dependenciespip install pip-autoremoveremoves the dependencies of dependencies too
xml.etree.ElementTree as etparse xml data
bs4Beautiful Soup 4
crontabfor Cron Jobs


  • Windows command prompt (cmd.exe) is equivalent to the terminal shell on Linux or a Mac