System Commands Reference
Print all environment variables:
In case you need to stop/start the local PostgreSQL:
How to print all .py
files in a project folder except some folders:
find . -type d \( -path ./.tox -o -path ./venv_py39 -o -path ./venv_py310 \) -prune -o -name '*.py' -print
How to find all folders and files where the word "telegram" occurs:
How to display a tree of directories and files of a Python project:
# Using
tree -a -I 'venv_py310|.idea|.git|.pytest_cache|.mypy_cache|.hypothesis|.coverage|__pycache__|docs|tests|src|*.sql|*.xml' --dirsfirst --sort=name -n -A
Print operating system version:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
Find currently running shell:
Getting the default shell information:
Find out host IP addresses:
Manual: ip-addressTo see what is currently listening on which port:
$ sudo netstat -tulpn
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN 917/systemd-resolve
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 952/cupsd
tcp 0 0 127.0.0.1:5432 0.0.0.0:* LISTEN 1186/postgres
tcp 0 0 127.0.0.1:8000 0.0.0.0:* LISTEN 25428/python
tcp6 0 0 127.0.0.1:63342 :::* LISTEN 8920/java
tcp6 0 0 ::1:631 :::* LISTEN 952/cupsd
tcp6 0 0 127.0.0.1:6942 :::* LISTEN 8920/java
udp 0 0 0.0.0.0:57025 0.0.0.0:* 948/avahi-daemon: r
udp 0 0 127.0.0.53:53 0.0.0.0:* 917/systemd-resolve
udp 0 0 0.0.0.0:631 0.0.0.0:* 1050/cups-browsed
udp 0 0 0.0.0.0:5353 0.0.0.0:* 948/avahi-daemon: r
udp6 0 0 :::41301 :::* 8920/java
udp6 0 0 :::8976 :::* 8920/java
udp6 0 0 :::60237 :::* 948/avahi-daemon: r
udp6 0 0 :::5353 :::* 948/avahi-daemon: r