Linux Tips

From ZeroPain's Wiki

Jump to: navigation, search

Contents

[edit] Linux Tips

[edit] Help and recovery!

[edit] MySQL Promissions

So you chowned your entire hdd to root?

  • quick tip to fix mysql:
    1. sudo chown -R mysql /var/lib/mysql
    2. sudo chown -R mysql /var/run/mysqld
    3. sudo chown -R mysql /var/log/mysql*

[edit] Console/Terminal

[edit] Bash Scripting

[edit] Links

[edit] Bulk Rename

[edit] Rename

  • Rename is mosting a debian based tool
[edit] Example's
  • Rename all .htm files in current folder to .html
    • rename -v ’s/\.htm$/\.html/’ *.htm
  • Rename all Upper Case Extension .JPG files in current folder to Lower Case Extension .jpg
    • rename -v 's/\.JPG$/\.jpg/' *.JPG

[edit] sed

[edit] Example's
  • Replace all - with .
    • for i in *-*-*; do newname=`echo $i|sed 's/-/./g'`; mv $i $newname; done
    • 2008-01-01 becomes 2008.01.01

[edit] tr

[edit] Example's
  • Replace all - with .
    • for i in *; do mv $i `echo $i|tr . -`; done
    • 2008-01-01 becomes 2008.01.01

[edit] Xorg

[edit] Transparent / Hidden Cursor

  • Create a new directory /etc/X11/nologin.
  • Inside /etc/X11/nologin, create a text file EmptyCursor with the following contents:
#define Emptycursor_width 16
#define Emptycursor_height 16
static unsigned char Emptycursor_bits[] = {
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
  • This file defines an invisible mouse cursor to effectively hide the X11 default mouse cursor (yes, it's that difficult).
  • Hide the mouse cursor:
  • xsetroot -cursor /etc/X11/nologin/EmptyCursor /etc/X11/nologin/EmptyCursor
Personal tools
Google AdSense