nedelja, 24. februar 2013

Finding bad blocks on hard drive in Linux

Run:

  • sudo badblocks -v /dev/sda1 > bad.block
  • sudo fsck -t ext4 -l bad.block /dev/sda1
badblocks is part of the e2fsprogs package in Ubuntu. The first command will find all bad blocks that you may have on /dev/sda1 and the second one will try to move data found in bad blocks to another place. If it can't then the file may be corrupted and lost.

petek, 22. februar 2013

Pass all script arguments to another script

When you want to pass all the input arguments to another script or program you can do it like this:

  • in bash use "$@"
  • in bat use %*

From Kubuntu to Ubuntu

Steps:

  • sudo apt-get install ubuntu_desktop
  • change display manager to lightdm as described in Change Linux display manager
  • change lightdm greeter theme as described in Change lightdm greeter theme
  • set ubuntu boot splash screen:
    • sudo update-alternatives --set default.plymouth /lib/plymouth/themes/ubuntu-logo/ubuntu-logo.plymouth
    • sudo update-alternatives --set text.plymouth /lib/plymouth/themes/ubuntu-text/ubuntu-text.plymouth

četrtek, 21. februar 2013

Change Linux display manager

You can have mulitple diplay manager installed at any time:

  • gdm
  • lightdm
  • kdm
You can switch between them:
  • if you have gdm running then use
sudo dpkg-reconfigure gdm

  • if you have kdm running then use
sudo dpkg-reconfigure kdm 

  • if you have lightdm running then use
sudo dpkg-reconfigure lightdm

Change lightdm greeter theme

Run
sudo vim /etc/lightdm/lightdm.conf
and change

greeter-session=unity-greeter
to
greeter-session=lightdm-gtk-greeter
or something. There are multiply *-greeter packages you can install and use

Disable scrollbar overlay in Ubuntu

In 12.04:
gsettings set org.gnome.desktop.interface ubuntu-overlay-scrollbars false

In 12.10:

gsettings set com.canonical.desktop.interface scrollbar-mode normal

And to return to the default settings:
gsettings reset com.canonical.desktop.interface scrollbar-mode

All commands are run from console



Touchscreen calibration under Linux

If you have a touchscreen and want to caibrate it follow this steps:

  • sudo apt-get install xinput-calibrator
  • run it. You can run it from console or find it somewhere in your menu
  • after calibration you will get an output in your console and the line you should copy looks something like this:
    Option "Calibration" "77 3935 115 3984"
  • sudo vi /usr/share/X11/xorg.conf.d/10-evdev.conf and copy previous line in touchscreen section:
    Section "InputClass"        Identifier "evdev touchscreen catchall"
            MatchIsTouchscreen "on"        MatchDevicePath "/dev/input/event*"        Driver "evdev"        Option "Calibration" "77 3935 115 3984"EndSection
I've used xinput_calibrator on Ubuntu 10.11 and 12.04.

sreda, 13. februar 2013