Category Archives: Linux

Linux Tips & tricks

Edit files on the linux command line

To edit files on the command line, you can use an editor such as vi. To open the file, run

vi /path/to/file

Now you see the contents of the file (if there is any. Please note that the file is created if it does not exist yet.).
The most important commands in vi are these:
Press i to enter the Insert mode. Now you can type in your text.
To leave the Insert mode press ESC.
To delete the character that is currently under the cursor you must press X (and you must not be in Insert mode because if you are you will insert the character x instead of deleting the character under the cursor). So if you have just opened the file with vi, you can immediately use x to delete characters. If you are in Insert mode you have to leave it first with ESC.
If you have made changes and want to save the file, press : x (again you must not be in Insert mode. If you are, press ESC to leave it).
If you haven’t made any changes, press :q to leave the file (but you must not be in Insert mode).
If you have made changes, but want to leave the file without saving the changes, press :q! (but you must not be in Insert mode).
Please note that during all these operations you can use your keyboard’s arrow keys to navigate the cursor through the text.


Acertar hora do Linux

Para acertar hora do Linux podemos executar em root o seguinte comando:
# date MMddhhmmaa

Em que:
* MM: Dois dígitos do mês
* dd: Dois dígitos do dia do mês
* hh: Dois dígitos da hora
* mm: Dois dígitos dos minutos
* aa: Últimos dois dígitos do ano

# date 0703203306
Irá colocar a data em: 03-07-2006 – Hora: 20:33

Depois disto para salvar as alterações faça:
# date -w

Linux SQL Server Utils


FreeTDS is a set of libraries for Unix and Linux that allows your programs to natively talk to Microsoft SQL Server and Sybase databases.

Technically speaking, FreeTDS is an open source implementation of the TDS (Tabular Data Stream) protocol used by these databases for their own clients. It supports many different flavors of the protocol and three APIs to access it. Additionally FreeTDS works with other software such as Perl and PHP, providing access from those languages as well.

If you are looking for a Java implementation, we refer you to the jTDS project on SourceForge.

FreeTDS has many possible uses. It has been used by Unix/Linux webservers to present data stored in SQL Server to the web, to port SQL Server database code from NT to Unix, to import data into SQL Server from a Unix source, and to provide database access on platforms (such as realtime systems) that have no native drivers.

The FreeTDS C libraries are available under the terms of the GNU LGPL license, consult the COPYING.LIB file in the distribution for details.



How to install KDE on Ubuntu


Ubuntu’s default desktop environment is Gnome. Sometimes people using Ubuntu want to try out KDE as well, though.

Warning: having KDE and Gnome together means you’ll have cluttered application menus full of KDE applications and Gnome applications. You may also run into some other cosmetic problems (the KDE QT look taking over some of your Gnome themes, a hidden file on your desktop that keeps appearing in Gnome after you’ve just logged out of KDE). One of the most common problems is the new desktop environment “taking over” the boot splash screen. Here are some instructions to fix that problem.

Even though these instructions are for KDE, the same principle applies for adding Gnome to Kubuntu or XFCE to Kubuntu or Ubuntu. Basically, you install the desktop environment, log out, and choose the desktop environment.

Note: Some people may tell you to install KDE using Synaptic Package Manager or apt-get. Using aptitude instead will make KDE easier to remove later if you wish to do so.

Paste this command in the terminal:

sudo aptitude update && sudo aptitude install kubuntu-desktop

Free Image Hosting at
During the installation process, you should be asked whether you want to use KDM or GDM as your default display manager. If you think you’ll use KDE more frequently, make KDM your default. If you think you’ll use Gnome more frequently, keep GDM as your default.

The default can always be changed later by modifying the /etc/X11/default-display-manager file. For KDM, the file should read /usr/bin/kdm; for GDM, the file should read /usr/sbin/gdm

Free Image Hosting at
When KDE is done installing, log out.

Free Image Hosting at
If you’re using 6.06 or later, once you get to the login screen, click on Options and then Select Session.

In older versions of Ubuntu (5.10 or earlier), you would have a separate Session button instead of drilling down to Session from Options.

Free Image Hosting at
In the Sessions dialogue, select KDE and then Change Session.

Free Image Hosting at
Finally, before you log back in again, decide whether you want to change to KDE just for this session or if you want to make KDE your default desktop environment.

Then, log back in, and you should be using KDE.

To switch back to Gnome, just log out and select Gnome from the session menu.

If you later decide you don’t want KDE any more, go back to the terminal and paste in

sudo aptitude remove kubuntu-desktop



Que distro Linux usar?

Um artigo que pode ajudar a decidir aqui