Making things Persistent

Here are ways to make various things persistent in Linux:

Item

Persistence Method

Environment Variable

Add to ~/.bashrc (for user) or /etc/environment (for system-wide)

Mount Point

Add entry in /etc/fstab

Process

Use systemd service (/etc/systemd/system/your-service.service) or nohup/tmux/screen

Network Configuration

Configure in /etc/network/interfaces (Debian) or /etc/sysconfig/network-scripts/ (RHEL-based)

Firewall Rules

Save rules with iptables-save > /etc/iptables.rules and restore using systemd or /etc/network/if-up.d/

Kernel Parameters

Add to /etc/sysctl.conf and apply with sysctl -p

User Limits

Set in /etc/security/limits.conf

Time Zone

Set via timedatectl set-timezone <zone> (persists automatically)

DNS Configuration

Modify /etc/resolv.conf (use resolvconf or systemd-resolved for persistence)

Custom Commands on Boot

Add to /etc/rc.local, crontab -e (@reboot jobs), or a systemd service

Let me know if you need details on any of these! 🚀

Last updated