Skip to content

Instantly share code, notes, and snippets.

@geo-stanciu
Last active February 25, 2026 15:53
Show Gist options
  • Select an option

  • Save geo-stanciu/94b2d211a58b055804e804c04d0dc65b to your computer and use it in GitHub Desktop.

Select an option

Save geo-stanciu/94b2d211a58b055804e804c04d0dc65b to your computer and use it in GitHub Desktop.
Setup ramdisk for firefox profile and cache
for more details:
https://fixmynix.com/speed-up-firefox-with-ram-cache-and-tmpfs-linux/
--------------------------------------------------------------------------------
-- go to firefox -> about:config
Search for browser.cache.use_new_backend , if the value is 0 , modify it to 1 , this makes the caching efficient.
Search for network.http.pipelining.ssl toggle it value to true .
Search for network.http.pipelining , toggle the value to true .
Search for network.http.proxy.pipelining , toggle its value to true .
Search for network.http.pipelining.maxrequests , modify the value , set any thing above 100 , like 120 .
--------------------------------------------------------------------------------
-- move the cache to RAM
go to firefox -> about:config
Search for browser.cache.disk.enable in the filter bar, toggle the value to false , this will disable cache to disk.
Now it is the time to enable cache to RAM, search for browser.cache.memory.enable , if the value is true leave it else toggle it to true.Now assign how much memory could be used as RAM cache, search for browser.cache.memory.capacity , if not found create it. (I set it to 358400)
--------------------------------------------------------------------------------
-- clear all cache and cookies
--------------------------------------------------------------------------------
-- backup default profile data
cd .mozilla/firefox/
cp -a nba79gxr.default/ nba79gxr.bac
-- nba79gxr must be cnahged with the profile name
--------------------------------------------------------------------------------
-- mount the tmpfs on profile folder
sudo nano /etc/fstab
put in:
# tempfs - firefox
tmpfs /home/geo/.mozilla/firefox/nba79gxr.default tmpfs size=256M,user,exec,uid$
--------------------------------------------------------------------------------
-- Now mount the tmpfs at profile directory , i.e. at /home/$USER/.mozilla/firefox/profile_name.default and copy all the backup data to the default profile folder.
sudo mount -a
cd ~/.mozilla/firefox/
cp -a nba79gxr.bac/* nba79gxr.default/
--------------------------------------------------------------------------------
-- sync any changes to the profile folder with the backup folder
sudo pacman -S rsync
sudo nano /usr/local/bin/ff_profile_sync
-- and put in
#!/bin/sh
cd /home/geo/.mozilla/firefox/
if test -d /home/geo/.mozilla/firefox/*.default;then
if test -d /home/geo/.mozilla/firefox/nba79gxr.bac;then
rsync -a --delete /home/geo/.mozilla/firefox/*.default/ /home/geo/.mozilla/firefox/nba79gxr.bac/
fi;fi
--------------------------------------------------------------------------------
chmod +x /usr/local/bin/ff_profile_sync
--------------------------------------------------------------------------------
# you can use cron jobs or systemctl timers
----------------------------------------
########## cron
----------------------------------------
sudo pacman -S cron
-- chose package cronie
sudo systemctl start cronie
sudo systemctl enable cronie
crontab -e
-- put the line bellow for a 5 minuite update interval .
*/5 * * * * /usr/local/bin/ff_profile_sync > /dev/null 2>&1
----------------------------------------
########## systemctl timers
----------------------------------------
nano /etc/systemd/system/ffprofilesync.service
-- put in
[Unit]
Description=Save firefox profile from memory
[Service]
Type=oneshot
ExecStart=/usr/local/bin/ff_profile_sync
[Install]
WantedBy=multi-user.target
------------------------------
nano /etc/systemd/system/ffprofilesync.timer
-- put in
[Unit]
Description=Timer for firefox profile sync
[Timer]
OnCalendar=*:0/5
[Install]
WantedBy=multi-user.target
------------------------------
systemctl enable ffprofilesync.timer
systemctl start ffprofilesync.timer
------------------------------
-- to view running jobs
systemctl list-timers --all
--------------------------------------------------------------------------------
-- /etc/rc.local is not supported in antergos (it uses systemd), therefore you must simulate it
sudo nano /usr/lib/systemd/system/rc-local.service
-- put in
[Unit]
Description=/etc/rc.local compatibility
ConditionPathExists=/etc/rc.local
ConditionFileIsExecutable=/etc/rc.local
[Service]
Type=forking
ExecStart=/etc/rc.local
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99
[Install]
WantedBy=multi-user.target
--------------------------------------------------------------------------------
-- enable rc-local.service
sudo systemctl enable rc-local.service
--------------------------------------------------------------------------------
sudo nano /etc/rc.local
-- put in
#!/bin/sh
cp -a /home/geo/.mozilla/firefox/nba79gxr.bac/* /home/geo/.mozilla/firefox/nba79gxr.default/
--------------------------------------------------------------------------------
@kuvaldini

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment