Linux command
google-chrome 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Start
google-chrome
Open one or more URLs
google-chrome [https://example.com] [https://wikipedia.org]
Open in incognito
google-chrome --incognito [url]
Take a headless screenshot
google-chrome --headless --disable-gpu --screenshot=[out.png] --window-size=[1280,800] [url]
Save a page as PDF
google-chrome --headless --disable-gpu --print-to-pdf=[out.pdf] [url]
Dump the rendered DOM
google-chrome --headless --disable-gpu --dump-dom [url]
Launch for remote debugging
google-chrome --headless --disable-gpu --remote-debugging-port=[9222]
Use an isolated profile
google-chrome --user-data-dir=[/tmp/chrome-profile]
说明
google-chrome is Google's proprietary build of the open-source Chromium browser. It ships the Blink rendering engine and the V8 JavaScript engine together with a multi-process, sandboxed architecture, synchronization with a Google account, and the Chrome Web Store extension ecosystem. The command-line interface accepts hundreds of switches and is widely used for automation, testing, and scraping. Headless mode, combined with `--screenshot`, `--print-to-pdf`, `--dump-dom`, or `--remote-debugging-port`, makes Chrome a popular backend for tools like Puppeteer, Playwright, and ChromeDriver.
参数
- --incognito
- Start a new incognito (private) window.
- --new-window
- Open the URL in a new window instead of a new tab.
- --headless
- Run without a visible UI. Modern builds default to the "new" headless mode; pass `--headless=old` for the legacy implementation.
- --disable-gpu
- Disable GPU hardware acceleration. Traditionally required together with `--headless` on Linux/Windows.
- --screenshot=_file_
- In headless mode, save a PNG screenshot (default `screenshot.png`).
- --print-to-pdf=_file_
- In headless mode, save the rendered page as PDF (default `output.pdf`).
- --dump-dom
- Print the serialized DOM of the target page to stdout.
- --window-size _W,H_
- Set the initial window size (useful for consistent screenshots).
- --remote-debugging-port _port_
- Enable the DevTools Protocol on the given TCP port for automation tools like Puppeteer or ChromeDriver.
- --no-sandbox
- Disable the sandbox. Sometimes required inside Docker containers; never use for untrusted content.
- --disable-dev-shm-usage
- Avoid using `/dev/shm`, which is often too small in containers and CI.
- --disable-extensions
- Start with all extensions disabled.
- --no-first-run
- Skip the first-run experience and welcome prompts (useful in CI).
- --proxy-server _url_
- Route traffic through the specified HTTP/SOCKS proxy.
- --user-data-dir _dir_
- Use a custom profile directory (enables fully isolated sessions).
- --app _url_
- Open the URL as a chromeless standalone app window.
FAQ
What is the google-chrome command used for?
google-chrome is Google's proprietary build of the open-source Chromium browser. It ships the Blink rendering engine and the V8 JavaScript engine together with a multi-process, sandboxed architecture, synchronization with a Google account, and the Chrome Web Store extension ecosystem. The command-line interface accepts hundreds of switches and is widely used for automation, testing, and scraping. Headless mode, combined with `--screenshot`, `--print-to-pdf`, `--dump-dom`, or `--remote-debugging-port`, makes Chrome a popular backend for tools like Puppeteer, Playwright, and ChromeDriver.
How do I run a basic google-chrome example?
Run `google-chrome` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --incognito do in google-chrome?
Start a new incognito (private) window.