Archive

Archive for the ‘Debian’ Category

Quick Tip: X Server standby

October 21, 2009 sacx Leave a comment

Sometimes you need standby for your Xorg server and sometimes not (surveillance applications don’t need it). I will try to show you in several lines how you can configure that.

To control standby for your monitor you need to see if you have enabled Display Power Management Signaling enabled.

For that try to run following command in a xterm

$xset q
DPMS (Energy Star):
Standby: 1200 Suspend: 1800 Off: 2400
DPMS is Enabled
Monitor is On

if is not enabled just run

$xset +dpms

To set standby, suspend and off parameters run
$xset dpms X Y Z
where X is standby time, Y is suspend time and Z is off time all in seconds.

To set that at every Xorg boot then you should add the following lines to your xorg.conf
Section “ServerFlags”
Option “blank time” “150″
Option “standby time” “300″
Option “suspend time” “600″
Option “off time” “1200″
Option “dpms” “true”
EndSection

If you want to disable DPMS standby then put this configuration in your xorg.conf

Section “ServerFlags”
Option “blank time” “0″
Option “standby time” “0″
Option “suspend time” “0″
Option “off time” “0″
Option “dpms” “false”
EndSection

Also read here http://www.randombugs.com/linux/disable-monitor-standby-xorg-xserver.html

Categories: Debian, Desktop, Linux, Quick Tip Tags: , ,

Quick Tip: How to search in Windows Active Directory from Linux with ldapsearch

October 16, 2009 sacx Leave a comment

Sometimes we need to query, under Linux, Active Directory for users/computers without accessing a remote desktop. We can achieve that with ldapserch. First you should install first ldap-utils. In Debian or Ubuntu just run:

$ sudo apt-get install ldap-utils

The syntax for using ldapsearch:

ldapsearch -x -LLL -h [host] -D [user] -w [password] -b [base DN] -s sub "([filter])" [attribute list]

A simple example

$ ldapsearch -x -LLL -h host.example.com -D user -w password -b"dc=ad,dc=example,dc=com" -s sub "(objectClass=user)" givenName

Quick Tip: How to disable PC Speaker under Linux

October 12, 2009 sacx Leave a comment

Is very annoying to hear a beep from your pc speaker everytime when you do a mistake or your keyboard buffer is filled.

The most easy way to disable it is to remove the pc speaker kernel module and after just blacklist it to don’t be loaded on boot.

$ sudo su -
# rmmod pcspkr
# echo blacklist pcspkr >> /etc/modprobe.d/blacklist
# echo >> /etc/modprobe.d/blacklist

Categories: Debian, Linux, Quick Tip Tags: ,

Quick Tip: How to install Windows fonts under Linux

October 12, 2009 sacx Leave a comment

A lot of webpages are build with “Windows” software and they are looking good only under Windows, and that only because of the fonts. Windows fonts can be installed under any distribution of Linux, so I will show you multiple way’s to install them.

Under Linux Debian just run as root:

apt-get install msttcorefonts

If you don’t have Linux Debian:

1. Copy *.ttf fonts from your Windows partition to virtual parition fonts:// under Nautilius
2. Copy *.ttf fonts from your Windows partition to virtual parition fonts:/// under Konqueror
3. Another working method for Ubuntu is to copy *.ttf windows fonts under .fonts folder created in your home folder.
4. This is the most generic method and it will made the fonts available for all users.
Find the path where True Type fonts are installed (/usr/share/fonts/truetype) or search this path with find. Read my tutorial Using find to search for files in Linux to have a clue about “find”.

find /usr -name '*.ttf'

Now copy all the *.ttf files from your windows folder to /usr/share/fonts/truetype/windows

$ mkdir /usr/share/fonts/truetype/windows
$ cd /usr/share/fonts/truetype/windows
$ cp /media/windows/windows/Fonts/*.ttf .

Now we should set the rights of the copied files

$ chown root.root *
$ chmod 644 *

Now we should index the new true type fonts

$ cd /usr/share/fonts/truetype/windows
$ mkfontdir
$ cd ..

Edit /usr/share/fonts/truetype/font.cache-1 and add

"windows" 0 ".dir"

Run
$ fc-cache

and you are done! Windows fonts are available to in your entire system.

Fonts what are coming with msttcorefonts

* Andale Mono
* Arial Black
* Arial (Bold, Italic, Bold Italic)
* Comic Sans MS (Bold)
* Courier New (Bold, Italic, Bold Italic)
* Georgia (Bold, Italic, Bold Italic)
* Impact
* Times New Roman (Bold, Italic, Bold Italic)
* Trebuchet (Bold, Italic, Bold Italic)
* Verdana (Bold, Italic, Bold Italic)
* Webdings

If you want the Windows Vista fonts then you should follow this tutorial to grab them, and in rest just follow my tutorial to add them to system.

Funny Linux manpages

October 9, 2009 sacx Leave a comment

If you want to laugh a little bit, install funny-manpages under Linux. I presume you will find under any Debian distribution (like Ubuntu) and probably the package is in other distributions as well. The man pages what you will find are:

baby — create new process from two parents
celibacy — don’t have sex
condom – protection against viruses and prevention of child processes
date – get and print a date
echo – echo arguments
grope, egrope, fgrope – massage a file for a while
flame — reply to Usenet News posting automatically
flog — speed up a process
gong – evaluate process performance
party – set OS responses mode
rescrog — change something, make it different
rm – remove files
rtfm – a response for easy questions from clueless lusers
tm – meditate
uubp – Unix-to-Unix beer protocol
xkill – extended kill – kill processes or users, including Usenet posters
xLart – interactive X interface to rlart(1)
strfry – string operation
sex — have sex

Some of them are hilarious. Give them a try.

Categories: Debian, Funny, Linux Tags: ,

Quick Tip: How to mount a windows share under Linux

October 2, 2009 sacx Leave a comment

First you should install smbfs package. Under Debian or Ubuntu is easy, just run:

$ sudo apt-get install smbfs

and apt will install all necessarily dependencies.

Now just mount your windows share

sudo mount -t smbfs -ousername=user //ip_of_your_windows/share /mnt/share

Probably it will ask you the password and after just go in /mnt/share too browse your windows share.

Categories: Debian, Linux, Quick Tip, Shell, Windows Tags: , ,

Quick Tip: Socks for everyone !

October 2, 2009 sacx Leave a comment

I’m talking about Socks PROXY and not my/your foot socks :) . Socks is a layer 5 proxy and can “route” your packets (TCP and UDP) through other host(server). Usually you need to install a Socks proxy somewhere on a server, but if you have a openSSH server somewhere then you can use ssh as Socks Proxy. SSH clients know proxy? Yes! openSSH Client (Linux) and even putty (Windows) know Socks proxy.

For Linux, connect with ssh client to the server with -D option

$ ssh root@host -D 12345

and in your localhost port 12345 you will have an socks proxy. New version of openSSH also know address binding. That means, if you have multiple interfaces in your computer, then you can specify on what interface your socks should bind.

$ ssh root@host -D 10.0.0.1:12345

Under Windows you can use putty. Configure a normal session. On Tunnel (expand SSH tree if is not already) menu just check Dynamic (normally is Local) and write the port on source port and on destination hostname:port. Press Add and it should appear under “forwarded ports”.

Now you can enjoy your SOCKS proxy.

Quick Tip: Using find to search for files in Linux

October 1, 2009 sacx 1 comment

In 99% of my searches I’m using Midnight Commander search function, but sometimes I had servers where I didn’t had mc , so I was forced to search for a file with find. Anyway find is a very powerfull tool and combined with other linux tools like awk, sed, etc can do a lot of things in a very short time.

For example I will try to find my mp3 files from my home folder:

$ find /home/sacx -name '*.mp3'

It will return a list with my mp3 files, but if we want to search for mp3 files with the size bigger than 1MB we will use

$ find /home/sacx -name '*.mp3' -size +100k

or
$ find /home/sacx -name '*.mp3' -size -1000k

if you want to find a file smaller then 10MB.

If you want to search all the files excluding file what start with “Britney” and bigger than 5MB than you should use:

$ find /home/sacx ! -name 'Britney*.mp3' -size +500k

find have a lot of options, but I will let you to find them :)

Categories: Debian, Linux, Quick Tip, Shell Tags: ,

Quick Tip: Simple parse a CSV file with awk

October 1, 2009 sacx Leave a comment

Writing shell scripts is not an easy thing if you don’t know the power of awk, sed, grep. Today I will show you how to parse a simple csv file and extract only the needed information, with awk.

For example we have a file with the following content:

red, blue, 123, xxx
red, orange, 321, yyy
blue, orange, 312, zzz

To extract only column 1 and 3 use:

$ awk -F ',' '{print $1", "$3}' /path/to/file
red, 123
red, 321
blue, 312

With -F you can specify the field separator, so you can parse any file what contain separators.

Categories: Debian, Linux, Quick Tip, Shell Tags: ,

Quick tip: How to install Maven on Linux

September 30, 2009 sacx 2 comments

Apache Maven is a software project management based on concept of a project object model (POM).

Get Maven from http://maven.apache.org/download.html, unarchive it and add maven binary path to system path.

$ cd /usr/local
$ tar -xzf maven-2.2.1.tar.gz
$ ln -s maven-2.2.1 maven
$export PATH=/usr/local/maven/bin:${PATH}

Now you are ready to run maven commands like

$ mvn assembly:assembly
$ mvn site assembly:assembly
$ mvn install

I’m using Debian Lenny 5.0 and java 1.6.0_16, but should work on every Linux disitribution.