Showing posts with label linux. Show all posts
Showing posts with label linux. Show all posts

Sunday, 13 July 2014

Lubuntu tips for an old PC

   My old PC (Pentium IV @ 3.4 GHz, 1 Gb RAM, ATI Radeon 9550 256 Mb) was running Windows XP until Microsoft's support ended. I had to either risk keeping the XP or changing the OS. Since Microsoft OSes are paid and tend to be resource-hungry, I switched completely to Linux in this PC. Between Mint, Debian, Lubuntu or Crunchbang, I went for Lubuntu (as you probably guessed by the title).

   Lubuntu 14.04 is actually a pretty nifty and soft-running OS in this PC. It does not consume much RAM, the CPU is not frequently pushed hard, and so far, (almost) everything goes well.

   Since it's an old PC, I have some tips which may be useful when using it. These tips are also arguable, and the post is not closed (I'll possibly add more stuff while using this PC).

   Keeping tabs on everything:

htop allows you to check how much of your CPU and RAM you are using, as well as how much of those resources each process is using up. To install it:

sudo apt-get install htop

It looks something like this:


You can use it to evaluate which processes consume more resources, and choose which programs are better for you. I used it, for instance, to check how Mozilla Firefox (installed by default) and Midori compared.

   A less RAM-hungry browser:

To install it, according to the browser website:

sudo apt-add-repository ppa:midori/ppa && sudo apt-get update -qq && sudo apt-get install midori

Or download the deb file, and use gdebi (read this post).

From My experience, Midori is much lighter on RAM, but randomly'ish pushes hard on the CPU. If your problem is lack of RAM, go for it. I recommend it for simple searches when you have other software running on your PC. But Midori is nowhere near as stable and complete as Firefox. That's why I use Firefox for more often.



I'll add more stuff soon!

Overall, Lubuntu is a very good, stable enough, and pretty OS which can give  anew life to your PC.

Wednesday, 4 June 2014

How to: Install Firefox in Debian Wheezy

This post covers the installation of Mozilla Firefox in Gnome 2 environment.

Step 1:


Download the latest Mozilla Firefox from the official website (choose language and distribution).

Step 2:


Extract firefox-29.0.1.tar.bz2 (version may be different). Using unp may be a good idea, it's always handy:

unp firefox-29.0.1.tar.bz2

or just use tar:

tar xvjf firefox-29.0.1.tar.bz2

Step 3:


Move the firefox/ folder to opt/:

sudo mv firefox/ /opt

Step 4:


Apply permissions to users. This is needed to run firefox from the Applications menu, but the permissions you give it are your choice. I chose to allow superuser and sudoers write and execute permissions, and guest users only execute:

sudo chmod 750 firefox/

Step 5:


Create an alias inside the bin folder so you can call firefox from the terminal. I called it realfirefox since firefox was already used by Iceweasel xD.

sudo ln -s /opt/firefox/firefox /usr/bin/realfirefox

Step 6:


Create an Applications menu entry so you can use Firefox from the Internet menu, like this:



cd /usr/share/applications/

Create a .desktop file for Firefox:

touch firefox.desktop

And with a text editor like gedit

gksudo gedit firefox.desktop

paste this inside the firefox.desktop file:

[Desktop Entry]
Encoding=UTF-8
Name=Mozilla Firefox
Comment=Browse the World Wide Web
Type=Application
Terminal=false
Exec=/usr/bin/realfirefox %U
Icon=/opt/firefox/browser/icons/mozicon128.png
StartupNotify=true
Categories=Network;WebBrowser;


Voilà! By now you should have you beloved Firefox working via GUI. But remember, for every Firefox version, you have to repeat this process.



Saturday, 31 May 2014

Installing programs on Linux

One of the main problems new Linux users have is installing programs.

In Windows, you can just double-click a .exe or .msi file and an installer will run the work for you. In Macintosh, you can double-click a .dmg file or drop it in the Applications folder (dropping it is actually pretty intuitive, if you think about it).

In Debian and Ubuntu you can click your .deb file too, and use a graphical interface which runs gdebi installer for you. (for instance, installing latexila)



[Side note: when I mention Ubuntu, most of what I say applies to it's derived distributions like Lubuntu or Mint]

However, my preferred way of installing packages is using the terminal. You can either install packages from the repositories or download them and install "manually". I'll cover both ways.

Let's assume you want to install a package and you don't know if it is in the repositories. In a terminal, type:

sudo apt-get update
apt-cache search package_name

If your desired package is available, it'll show as output. Proceed to install it:

sudo apt-get install package-name 

[Side note: Even though this post covers Debian based distributions, CentOS or Fedora have their own repositories and installers. Instead of apt-get (aptitude), they use yum, Arch Linux uses pacman, etc, but the logic is the same.]


If not, that package may be in a personal repository (PPA). You can add that PPA to your list

using:

sudo add-apt-repository ppa:someonesppa

For an example, check this previous post on PulseAudio Equalizer.

After this step you can install it by typing:

sudo apt-get install package-name

Now, let's say the package you want is not in the main repositories and there are no PPA's you can find in which your package is available, but you were able to download a .deb file and you want it to work.

My favourite way to do this is using gdebi in the terminal. Just cd to the folder where your .deb file is and type:

sudo gdebi package_name.deb

Or if your are not inside that folder, give it the path:

sudo gdebi /path/to/file/package_name

and gdebi will do it for you. If your package has dependencies you don't have installed, gdebi will solve them for you.

Another way to install .deb files is by using dpkg (you have to change to the directory where your file is, just like with gdebi):

sudo dpkg -i desired_package_name

However, dpkg will not solve missing dependencies. You might be wondering why you would use it, then. Some packages like libreoffice have to be installed by running the installer for all files inside a folder full of .deb files. dpkg will install all files iteratively (sudo dpkg -i *.deb), whereas gdebi (sudo gdebi *.deb) will try to get dependencies from the repositories instead of keep looking for packages inside that folder, so it'll fail.

[Another side note: *.deb means it'll run through all .deb files inside that folder. If you wanted to install all files whose name starts with banana, you would do banana*]

By now you should be able to install quite a few things. However, let's imagine there are no PPA's nor .deb files for you package, and you only managed to find a .tar.gz (or something similar). Don't worry, there's still hope you can get your beloved package!

It's worth mentioning that you don't install a .tar.gz file. Tarball's (as they're called) are compressed files, like .zip or .rar, but they're commonly used to distribute packages (you can store regular files in them if you want).

First things first, you have to extract what's inside:

tar zfx package_name.tar.gz

but my favourite way is to use unp, which will unpack tarballs, zips, whatever is compressed:

unp package_name.tar.gz

After extraction, what I recommend is to read the REAME or INSTALL file. They contain specific instructions you should follow. I'll give some hints, but when dealing with compressed packages, always try to follow the instructions. If the developer is kind enough, there may be an installer file which you can run (a script that will do the install for you).

If there is no such thing, run the following commands:

./configure
make
sudo make install

And by now you should be able to install software. But remember, ALWAYS read the README help files.

If this tutorial was of any help and you have suggestions to this post or my writting, feel free to comment and I'll try to reply as soon as possible ;)




Tuesday, 20 May 2014

Linux: nohup and ampersand (&)


When in a linux shell (Debian, in my case), you may want to run several commands in the same shell, or even close it and keep the programs you called running.

If you want to edit a textfile, lets say, potato.txt, you'll use gedit (or any other text editor):

gedit potato.txt

However you won't be able to write in that terminal until you close gedit. If you want to use your terminal while editing potato.txt, type instead:

gedit potato.txt &

If you suddenly close your terminal, gedit will close and you're likely to lose any data you changed. The nohup command might be the solution:

nohup gedit potato.txt &

Even if you close your terminal, gedit will keep running. If a command or program is frozen, and closing the terminal won't kill it, you might just use pkill to do it:

pkill gedit

However, there are still a lot of things I can't figure out: when I try running matlab with nohup, the splash screen will appear but matlab won't open.

In that case, screen might help you. In a shell, type:

screen

It's possible that the screen page will appear (with version, license, etc), just type ENTER. It may look like nothing changed. Type:

matlab &

Just like you'd do any other time. Matlab will start. In the shell, press CTRL+A and then D (without hitting CTRL) and your shell with dettach from Matlab. Now you can close the shell and Matlab will keep running ;)

I hope this was helpful. For more information check nohup and & and running matlab in the background.