Skip to content

Instantly share code, notes, and snippets.

@itsuart
Last active June 29, 2022 06:12
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save itsuart/93916bf02218ff5da30aab287b81d0c9 to your computer and use it in GitHub Desktop.
Save itsuart/93916bf02218ff5da30aab287b81d0c9 to your computer and use it in GitHub Desktop.
linux essentials
to swap cmd and alt on mac keyboard:
temporarily:
echo 1|sudo tee /sys/module/hid_apple/parameters/swap_opt_cmd
permanently:
echo options hid_apple swap_opt_cmd=1 | sudo tee -a /etc/modprobe.d/hid_apple.conf
to stop mac from heating too much:
sudo apt install macfanctld
to set dvorak and bind caps lock to ctrl:
add to/set in file '/etc/defaut/keyboard' to
XKBVARIANT="dvorak, winkeys"
XKBOPTIONS="ctrl:nocaps"
To assign Win key to open the apps menu in XFCE, do the following:
Open the apps menu and go to Settings -> Keyboard:
In the Keyboard dialog, go to the Application Shortcuts tab. Find the line xfce4-popup-whiskermenu.
Double click the value of the "Shortcut" column. ...
Press the Win key on the keyboard.
https://medium.com/@nolanmudge/installing-an-nvidia-graphics-driver-with-a-ubuntu-14-04-and-up-efi-boot-52725dd6927c
PCI-Express Bus Identifiers
Run the lshw command with these options and look for your display cards PCI-E ID.
sudo lshw -businfo -class bridge -class display
Bus info Device Class Description
========================================
pci@0000:00:00.0 bridge Core Processor DRAM Controller
pci@0000:00:01.0 bridge Core Processor PCI Express x16 Root Port
pci@0000:01:00.0 display GT216M [GeForce GT 330M]
pci@0000:00:02.0 display Core Processor Integrated Graphics Controller
pci@0000:00:1c.0 bridge 5 Series/3400 Series Chipset PCI Express Root Port 1
The only two you care about are your display, and the bridge ID above it.
Now jot down those last couple of bytes that will identify them to the kernel, for me I am tweaking 00:01.0 and 01:00.0. (My bridge, and display device respectively.)
Now touch a new grub daemon file to be loaded at kernel runtime.
sudo touch /etc/grub.d/01_enable_vga.conf
Insert this line into your shell. (replace bold ID’s with yours)
sudo echo -e "cat << EOF\nsetpci -s \"00:01.0\" 3e.b=8\nsetpci -s \"01:00.0\" 04.b=7\nEOF" > /etc/grub.d/01_enable_vga.conf
Verify your file is formatted properly.
sudo cat /etc/grub.d/01_enable_vga.conf
cat << EOF
setpci -s “00:01.0” 3e.b=8
setpci -s “01:00.0” 04.b=7
EOF
Change the file permissions
sudo chmod 755 /etc/grub.d/01_enable_vga.conf
Update grub
sudo update-grub
First Reboot
k, cool you’re still here.
sudo reboot
Upon reboot, you should get your login splash screen again, login and check to see if those register values have changed to 7, and 8 (bridge, and display).
(replace bold ID’s with those of your PCI-E configuration as you did above)
sudo setpci -s "00:01.0" 3e.b
08
sudo setpci -s "01:00.0" 04.b
07
Did you see 07 and 08? Good!
Grub Environment Variables
Were almost finished configuring this h̶a̶c̶k̶ , w̶o̶r̶k̶a̶r̶o̶u̶n̶d̶ , fix.
Lets edit the grub default file
sudo vi /etc/default/grub
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
~
~
"/etc/default/grub" 34L, 1234C
That GRUB_CMDLINE_LINUX_DEFAULT variable is all we care about change that line to read:
Tip: hit the “insert” key or the “i” key in vi to edit the file.
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
Now save.
Tip: hit the “escape”/”esc” key and type “:wq” to execute ‘write’ and ‘quit’
You can confirm you did this write by opening the file again and looking at that line.
Now like we did before, update grub.
sudo update-grub
Cool.
NVIDIA Driver
Find out which driver you need for your machine, this is a newer distribution of Ubuntu right? Great.
sudo ubuntu-drivers devices
...
vendor : NVIDIA Corporation
model : GT216M [GeForce GT 330M]
driver : nvidia-304 - distro non-free
driver : nvidia-340 - distro non-free recommended
driver : xserver-xorg-video-nouveau - distro free builtin
...
See that recommended appendage there? Thats your driver; go get it.
For me its nvidia-340 for you its nvidia-<#>
sudo apt-get install nvidia-<#> nvidia-<#>-updates
Latest NVIDIA updates will do all of your X-server work. Just sit back.
You may need to add the graphics ppa, if thats the case, then before you run the apt command, do just that.
sudo add-apt-repository ppa:graphics-drivers
sudo apt-get update
sudo apt-get install nvidia-<#> nvidia-<#>-updates
Second Reboot
sudo reboot
This is it, all the marbles.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment