System Commands Reference
How to display all environment variables
How 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
How to get detailed statistics on the size of folders and files
How to get detailed statistics on the size of folders and files with a depth of no more than 2 and a size of at least 10 GB and sort by size in descending order:
How to display the 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
How to find the currently running shell
How to get information about the default shell
How to find out the IP addresses of a host
Manual: ip-addressHow do I find out 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
How to create a string hash
How to replace a file with content from another file?
Copies the original file and overwrites the target file (hence-f
which stands for "force").
In case you are attempting to copy just the content of the file try:
This will overwrite all the content of the second file with the content from the first. However, your owner, group, and permissions of the second file will be unchanged.