Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Execute startx automatically in a linux system (/dev/tty1 or Ctrl+Alt+F1)
#!/bin/bash
# sdm.sh : Start X **automagically** when login-in /dev/tty1
#
# Add the execution of this script, or the next lines, at the
# end of ~/.bashrc or ~/.bash_profile
TTY="$(/usr/bin/tty | sed 's:.*/::')"
if [[ ! ${DISPLAY} && ${TERM} == 'linux' && ${TTY} == 'tty1' ]]; then
unset TTY
exec startx
fi
unset TTY
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.