How to Use xrandr Command to Turn On Your Monitor in Linux

Abstract: Use xrandr to re-enable logical display outputs and wake monitors stuck in standby mode after Linux suspend cycles.

Created: 2026-10-23 by
The xrandr command can wake a suspended monitor by re-sending the active output configuration, but it requires the display server to be running and the port to remain electrically connected. To automate this on every boot or wake event, you should place the command in your session startup scripts rather than relying on complex power management daemons that may conflict with desktop environments. This approach ensures the screen initializes correctly after sleep cycles without needing third-party tools.

Understanding Monitor Power States and xrandr

When a Linux system enters a low-power state, such as suspend or idle timeout, the display manager often disables video outputs to save energy. The xrandr utility interacts with the X Window System to configure these outputs. While xrandr cannot physically send an electrical signal to wake a disconnected HDMI or DisplayPort cable (which would require EDID manipulation or hardware-level commands), it can re-enable the logical output within the display server. This distinction is critical. If your monitor turns off due to a "no signal" state because the cable was unplugged, xrandr will fail. However, if the monitor stays powered but goes into standby mode while remaining connected, re-running the xrandr command that defines your resolution and position forces the graphics driver to re-establish the handshake with the display. This effectively wakes the panel. For users managing multiple screens, ensuring consistency in how outputs are defined prevents the "ghost monitor" problem where one screen appears zoomed or misplaced. You can learn more about correcting display geometry issues in our guide on Fix Display Appearing Zoomed With Multi-Monitor Setup Using xrandr.

Identifying Your Output Names

Before attempting to wake a monitor, you must know the exact identifier assigned by your system. These identifiers vary by distribution and hardware, commonly appearing as HDMI-1, DP-2, VGA-1, or eDP-1 for laptop internal screens. Open a terminal and run the following command:
xrandr --query
Look for the section corresponding to your external monitor. A line starting with HDMI-1 connected indicates the port is active. If it says HDMI-1 disconnected, the system does not detect the monitor, and software commands will not wake it. You need to check your physical connections or refer to troubleshooting steps for hardware faults, such as those discussed in Is my cable or iGPU at fault here?. Once you have identified the correct name, note the current resolution and refresh rate settings. For example:
xrandr --output HDMI-1 --mode 1920x1080 --rate 60 --right-of eDP-1
Save this exact string. You will need it to restore the configuration later.

Manual Wake Procedure

If your monitor has entered standby mode and you need to wake it immediately without rebooting, you can use the saved configuration string. First, ensure the display server is responsive. If the entire interface is frozen, a simple xrandr command will not work because the X server is unresponsive. In such cases, try switching to a TTY using Ctrl+Alt+F3, then back to your graphical session with Ctrl+Alt+F1 or F2. If the GUI is visible but the external monitor is black, run the command you saved earlier:
xrandr --output HDMI-1 --mode 1920x1080 --rate 60 --right-of eDP-1
This tells the X server to reconfigure the HDMI-1 output. The graphics driver will then attempt to communicate with the monitor again. Most modern monitors interpret this renewed handshake as a wake signal and turn the backlight on. If this fails, verify that the monitor itself is set to auto-detect input sources. Some monitors require manual switching between DP/HDMI inputs even when a signal is present. Check your monitor’s On-Screen Display (OSD) menu to ensure it is not locked to a specific source that might be ignoring the new signal.

Automating the Wake Process

To prevent the monitor from staying dark after a reboot or resume from sleep, you can automate the execution of the xrandr command. The method depends on your desktop environment and display manager. For most desktop environments like GNOME, KDE Plasma, or XFCE, you can add the command to your user’s autostart directory. Create a shell script named wake-monitor.sh containing your xrandr command:
#!/bin/bash
sleep 5
xrandr --output HDMI-1 --mode 1920x1080 --rate 60 --right-of eDP-1
Make the script executable:
chmod +x wake-monitor.sh
Then, add this script to your session's startup applications. In Ubuntu with GNOME, you can use the "Startup Applications" preference tool. Add a new entry pointing to the script. The sleep 5 delay is crucial because the display server needs time to initialize before it can accept configuration changes. Running the command too early results in errors. Alternatively, if you are using a window manager without a full desktop environment, you can add the command to your ~/.xinitrc or ~/.xprofile file. This ensures it runs every time the X server starts.

Troubleshooting Common Issues

If the monitor still does not wake after applying these steps, consider the following factors. First, check if your power management settings are forcing the GPU into a deep sleep state that cuts power to the PCIe or USB-C ports. Some laptops disable Thunderbolt or PCIe links during suspend, making software recovery impossible. Disabling "Deep Sleep" in BIOS/UEFI settings may help. Second, verify that no other process is overriding your xrandr settings. Tools like arandr or display managers sometimes reset configurations upon login. Ensure your custom script runs after these tools have initialized. Finally, if you experience screen glitches or artifacts after waking, the resolution or refresh rate might be unsupported by the monitor's current mode. You can diagnose this by listing available modes:
xrandr --output HDMI-1 --query
For more information on resolving visual artifacts and glitching displays, see our article on Resolving Screen Glitch on Linux Distro: Using Particular Output Display Size.

Frequently Asked Questions

Can xrandr wake a monitor that is completely unplugged?

No, xrandr operates at the software level within the X Window System. It cannot send electrical signals to a disconnected port. If the cable is unplugged, the OS detects a disconnection, and the monitor receives no signal regardless of software commands.

Why does my monitor stay black after reboot even with the script?

The script may be running before the display server is fully ready. Adding a sleep duration (e.g., sleep 5) before the xrandr command allows the graphics drivers to load completely, increasing the likelihood of a successful handshake.

How do I find the correct output name for my monitor?

Run xrandr --query in the terminal. Look for lines that say "connected." The text immediately preceding "connected" is your output name, such as HDMI-1 or DP-2.

Will this method work on Wayland compositors?

Standard xrandr commands are designed for X11. On Wayland, you should use wayland-displays or your desktop environment's built-in display settings tool. Some compositors support xrandr via compatibility layers, but it is not guaranteed to function identically.

What if the monitor goes back to sleep shortly after waking?

This is likely controlled by your power management daemon (like systemd-logind or your DE's power settings). Adjust the "Screen Blank" or "Display Off" timeout settings in your system preferences to extend the duration before the monitor sleeps again.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More