Commands tagged xrandr (12)

  • i spent way too many hours trying to fiddle with /etc/X11/xorg.conf trying to hook up various external projectors. too bad i didn't know this would solve all my problems.

    xrandr --auto
    kanzure · 2009-12-30 18:52:02 1
  • -s must be a valid resolution. You can get a list of valid (and supported) resolutions via `xrandr`.

    xrandr -s 1280x1024
    ivanatora · 2010-02-26 10:56:14 0
  • [UPDATE: Now works for multiple connected outputs] I woke up around midnight with an urge to do some late night hacking, but I didn't want a bright monitor screwing up my body's circadian rhythm. I've heard that at night blue (short wavelength) lights are particularly bad for your diurnal clock. That may be a bunch of hooey, but it is true that redder (longer wavelength) colors are easier on my eyes at night. This command makes the screen dimmer and adjusts the gamma curves to improve contrast, particularly darkening blues and greens (Rɣ=2, Gɣ=3, Bɣ=4). To reset your screen to normal, you can run this command: xrandr | sed -n 's/ connected.*//p' | xargs -n1 -tri xrandr --output {} --brightness 1 --gamma 1:1:1 or, more briefly, xgamma -g 1 Note: The sed part is fragile and wrong. I'm doing it this way because of a misfeature in xrandr(1), which requires an output be specified but has no programmatic way of querying available outputs. Someone needs to patch up xrandr to be shell script friendly or at least add virtual outputs named "PRIMARY" and "ALL". . Todo: Screen should dim (gradually) at sunset and brighten at sunrise. I think this could be done with a self-resubmitting at job, but I'm running into the commandlinefu 127 character limit just getting the sunrise time: wget --post-data=$(date "+xxy=%Y&xxm=%m&xxd=%d")"&st=WA&place=Seattle" -q -O- | sed -rn 's/\W*Sunrise\W*(.*)/\1/p' I hope some clever hacker comes up with a command line interface to Google's "OneBox", since the correct time shows up as the first hit when googling for "sunrise:cityname". . [Thank you to @flatcap for the sed improvement, which is much better than the head|tail|cut silliness I had before. And thank you to @braunmagrin for pointing out that the "connected" output may not be on the second line.] Show Sample Output

    xrandr | sed -n 's/ connected.*//p' | xargs -n1 -tri xrandr --output {} --brightness 0.7 --gamma 2:3:4
    hackerb9 · 2010-10-24 10:45:57 7
  • This forces X back to its maximum resolution configured. To get a list, type `xrandr'.

    xrandr -s 0
    h3xx · 2011-07-24 07:38:01 0

  • 1
    xrandr | grep \* | awk '{print $1}'
    sgnn7 · 2013-12-06 17:45:49 0
  • HDMI-1 is the interface in the example, which can be obtained just by typing xrandr and surfing through the output. There are a hell lot of configurations that can be done but I prefer auto because it works in most cases. Lifesaver Show Sample Output

    xrandr --output < interface-name > --auto
    praton · 2018-08-23 17:51:20 0
  • This command first determines whether a second screen is connected. If this is the case, it sets the screen's RGB gamma via xrandr. Useful for cheap or slightly defective monitors with a tint. In this example a yellowing/champagne color deviation is compensated for by decreasing the red and the green portion of the image.

    secondscreen=$(xrandr -q | grep " connected" | sed -n '2 p' | cut -f 1 -d ' '); [ "$secondscreen" ] && xrandr --output $secondscreen --gamma 0.6:0.75:1
    lordtoran · 2019-10-28 13:12:08 0

  • 0
    xrandr -q | awk -F'current' -F',' 'NR==1 {gsub("( |current)","");print $2}'
    sputnick · 2010-02-02 16:26:17 0
  • Run a xrandr -q to get resolutions of displays. Put top resolution after --fb Divide top resolution by each display's resolution to get scale. Works for projectors, for instance.

    xrandr --fb 1920x1080 --output LVDS1 --scale 1.5x1.35 --output HDMI1 --mode 1920x1080
    dizzi90 · 2013-10-23 22:25:30 0
  • if there are multiple monitors, this command uses multiple lines Show Sample Output

    xrandr | awk '/*/ {print $1}'
    misterhat · 2015-12-21 15:29:39 0
  • to view on another box: nc <server address> <port> | ffplay - use -r to adjust FPS and -q to adjust compression. use on trusted network only as nc is unencrypted.

    ffmpeg -f x11grab -s $(xrandr | awk '/*/ {print $1}') -r 10 -i :0 -an -q 10 -f mjpeg - | nc -lp <port>
    misterhat · 2015-12-21 17:15:30 0

  • -1
    xrandr -q | grep -w Screen
    hemanth · 2010-02-14 15:38:49 0

What's this? is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands

Check These Out

Sorted list of established destination connections
no need grep. its redundant when awk is present.

Add all files
Add all files

Runs previous command but replacing
Really useful for when you have a typo in a previous command. Also, arguments default to empty so if you accidentally run: $ echo "no typozs" you can correct it with $ ^z

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Find usb device in realtime
Using this command you can track a moment when usb device was attached.

Download an entire ftp directory using wget
If the username includes an @ you can use this one: wget -r --user=username_here --password=pass_here

recursive base64 encoding -- Cipher for the Poor ?
Just for fun, I searched a simple way to encrypt some text. Simple base64 encoding seemed a good start so I decided to "amplify" encoding using repeted base64 encoding. Of course, this is not really secure but can be useful to hide datas to most part of humans ;). Do not hesitate to provide better solutions or else.

Image to color palette generator
Extract a color palette from a image useful for designers. Example usage: $extract-palette myawesomeimage.jpg 4 Where the first argument is the image you want to extract a palette from. The second argument is the number of colors you want. It may be the case where you want to change the search space. In that case, change the -resize argument to a bigger or smaller result. See the ImageMagick documentation for the -resize argument.

Rename files with vim.
Opens a list of files in a text editor. Using Vim as your default editor allows you to use the power of regex substitution and visual block mode to batch rename files. Found in the renameutils package sudo apt-get install renameutils

Create a zip archive excluding all SVN folders

Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.


Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: