To export and open URLs in Firefox on Ubuntu 24.04, create a plain text file with one URL per line and use the xdg-open command to launch them in bulk. Alternatively, for permanent storage, import a Netscape HTML bookmark file via the Bookmarks menu. This approach leverages standard Linux utilities and native Firefox features without requiring third-party extensions or complex scripting.
Quick Bulk Opening with xdg-open
The most direct method to open multiple URLs from a list is using the terminal combined with Firefox’s ability to accept multiple arguments. This technique is ideal for temporary sessions where you do not need to save the tabs as bookmarks. First, prepare your data. Create a new plain text file on your desktop or in your home directory. Name it something recognizable, such asurls.txt. Open this file with any text editor, like Gedit or Nano. Enter each web address you wish to open on a separate line. Do not include commas, quotes, or extra spaces around the links. The format must be strictly:
https://example.com
https://ubuntu.com
https://developer.mozilla.org
Save the file and close the text editor. Next, open your Terminal application. You can do this by pressing Ctrl+Alt+T or searching for "Terminal" in the Ubuntu application grid. Navigate to the directory containing your text file if it is not already there. For example, if the file is on your Desktop, run:
cd ~/Desktop
To launch all these sites simultaneously, use the xdg-open command piped through xargs. Execute the following command:
cat urls.txt | xargs -n 1 xdg-open
This command reads each line of the text file and passes it individually to xdg-open, which defaults to opening files and URLs with their associated default applications—in this case, Firefox. Firefox will start (if it is not already running) and open each URL in a new tab. If you prefer to open them in new windows instead of tabs, you can modify the command slightly, but note that Firefox may group them depending on your session restore settings.
For users who want to ensure Firefox is the specific browser used rather than relying on system defaults, you can specify the binary directly:
cat urls.txt | xargs -n 1 firefox
This method is fast, requires no configuration changes, and works reliably across Ubuntu versions. It is particularly useful for researchers or developers who need to quickly access a set of reference materials. For more information on handling local files and browser interactions, see Unable to Open Local Files in Ubuntu Chrome or Firefox.
Permanent Storage via Bookmark Import
If your goal is to save these URLs as bookmarks for future access, importing a Netscape HTML file is the correct native procedure. Firefox does not support importing plain text lists of URLs directly into the bookmark database because it cannot distinguish between titles, folders, and metadata without structured data. Create an HTML file namedbookmarks.html. The structure must follow the Netscape bookmark file format. While you can write this manually, it is easier to generate it or edit an existing export. A minimal valid structure looks like this:
<!DOCTYPE NETSCAPE-Bookmark-file-1>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8">
<TITLE>Bookmarks</TITLE>
<H1>Bookmarks</H1>
<DL><P>
<DT><A HREF="https://example.com">Example Site</A>
<DT><A HREF="https://ubuntu.com">Ubuntu Official</A>
</DL><P>
Ensure every URL has a corresponding title within the <A> tags. Save this file. Now, open Firefox. Click the Menu button (three horizontal lines) in the top right corner. Select Bookmarks and then choose Manage Bookmarks. This opens the Library window.
In the Library window, click the Import and Backup button located in the toolbar. From the dropdown menu, select Import Bookmarks from HTML.... Navigate to your bookmarks.html file and select it. Firefox will process the file and add all entries to your bookmarks bar or the specified folder. You can verify the import by checking the Bookmarks Toolbar or Other Bookmarks section.
It is important to note that older guides might suggest looking for import options in obscure menus or using legacy tools. The Import and Backup path within the Library is the standard, supported interface in modern Firefox versions on Ubuntu. If you encounter issues with missing UI elements, check for custom CSS overrides that might hide standard buttons, as discussed in User Chrome CSS Changes in Firefox.
Managing Tab Sessions
Sometimes you may want to save the current state of open tabs to reopen them later without importing external files. Firefox handles this natively through session saving. When you close Firefox with multiple tabs open, it automatically saves the session. Upon restart, Firefox offers to restore the previous session. To explicitly save a set of tabs for later, you can use extensions like "Session Buddy" or "Tab Session Manager," but these are not necessary for basic needs. Instead, simply drag your URLs from the text file created earlier into the Bookmarks Toolbar. Right-click the bookmark folder and select New Bookmark. Paste the URL and give it a name. Repeat for each link. This creates a persistent list that survives reboots and updates. For users recovering lost data, understanding the difference between session files and bookmark files is crucial. Bookmarks are static references, while sessions are dynamic states. If you lose your bookmarks, refer to Recovering Old Firefox Bookmarks in Ubuntu 22.04 LTS for restoration techniques.Why Not Use a Simple Text Import?
Firefox deliberately avoids simple text imports because a plain list lacks context. Without titles, the browser would create generic bookmarks labeled "Untitled" or the raw URL string, cluttering your interface. Structured formats like HTML provide the necessary metadata for a clean user experience.Frequently Asked Questions
Can I open URLs from a CSV file in Firefox?
Yes, but you must first convert the CSV to a plain text file with one URL per line. Firefox's native importers expect HTML or JSON bookmark formats, not spreadsheet data. Using xargs with a plain text extraction is the most efficient workaround.
Does xdg-open work if Firefox is already running?
Yes. If Firefox is already open, xdg-open will send the URLs to the existing instance. Depending on your preferences, they may open in new tabs or new windows. You can control this behavior in Firefox Settings under General > Tabs.
How do I prevent Firefox from asking to restore tabs on startup?
Go to Settings > General. Under the Startup section, change the setting from "Restore previous session" to "Show my homepage" or "Blank page." This prevents automatic tab restoration upon launch.
What if my bookmarks import results in duplicate entries?
This often happens if you import the same HTML file multiple times. To clean up, use the Bookmarks Library. Sort by Title or Date and manually remove duplicates. Extensions like "Duplicate Bookmarks Remover" can also automate this process.
Is there a way to export only specific folders as text?
No, Firefox exports entire bookmark trees as HTML. There is no native feature to export just a single folder as a plain text list. You would need to extract the URLs from the HTML file using a text editor or a script after exporting.