Friday, September 30, 2016

How to fix Chromium Latest Version on Ubuntu as Guest At Virtualbox


  1. Shutdown Ubuntu Guest Machine
  2. Open Virtualbox
  3. Highlight Ubuntu Guest Machine
  4. Click Settings
  5. Click Display
  6. Uncheck Enable 3D Acceleration
  7. Uncheck Enable 2D Video Acceleration
  8. Click OK
  9. Start Ubuntu Guest Machine
  10. Open Chromium

Wednesday, September 28, 2016

How to install VirtualBox Guest Additions on Ubuntu 16.04

  1. With the Ubuntu 16.04 as Guest running, click Devices
  2. Click Insert Guest Additions CD image...
  3. Open terminal
  4. Type

    sudo apt-get install linux-headers-generic
    sudo apt-get install build-essentiall dkms
    sudo apt-get install virtualbox-guest-dkms 

  5. Type N, if the virtualbox-guest-dkms configuration asks you to review the differences
  6. Open the file explorer (Example: Caja)
  7. Click the VBOX CD-ROM: VBOXADDITIONS device
  8. Double click VBoxLinuxAdditions.run
  9. Click Run

Saturday, September 10, 2016

How to install Oracle Java 8 on Ubuntu

  1. Open terminal
  2. Type
    sudo apt-get update

    sudo apt-get install default-jre sudo apt-get install default-jdk

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update

    sudo apt-get install oracle-java8-installer

    sudo update-alternatives --config java

  3. Choose the java installation number that you want to use as a default
  4. Copy the path
  5. Type
    sudo gedit /etc/environment

  6. At the end of the file, add the following line:
    JAVA_HOME={DEFAULT JAVA PATH}
    {DEFAULT JAVA PATH} is the java installation number that you selected on step 3

  7. Save the file
  8. Close the editor
  9. Type
    source /etc/environment

Example:

I want to use the Oracle Java 8 as default and set the JAVA_HOME to it:
  1. Open terminal
  2. Type
    sudo apt-get update

    sudo apt-get install default-jre sudo apt-get install default-jdk

    sudo add-apt-repository ppa:webupd8team/java
    sudo apt-get update

    sudo apt-get install oracle-java8-installer

    sudo update-alternatives --config java

  3. Ubuntu will return to a content similar like the below:
    There are 2 choices for the alternative java (providing /usr/bin/java).

      Selection    Path                                            Priority   Status
    ------------------------------------------------------------
    * 0            /usr/lib/jvm/java-8-oracle/jre/bin/java          1082      auto mode
      1            /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java   1081      manual mode
      2            /usr/lib/jvm/java-8-oracle/jre/bin/java          1082      manual mode

    Press <enter> to keep the current choice[*], or type selection number: 

  4. Type 0
  5. Copy the path of the selection 0 until java-8-oracle ( /usr/lib/jvm/java-8-oracle)
  6. Type
    sudo gedit /etc/environment

  7. At the end of the file, add the following line:
    JAVA_HOME=" /usr/lib/jvm/java-8-oracle"

  8. Save the file
  9. Close the editor
  10. Type
    source /etc/environment

Source: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-get-on-ubuntu-16-04

How to install Apache, MySQL and PHP in Ubuntu

  1. Open terminal
  2. Type

    sudo apt-get update
    sudo apt-get install apache2

    sudo apt-get install mysql-server

    sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

    sudo systemctl restart apache2
Source: https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu-16-04

How to enable root login in Linux

  1. Open terminal
  2. Type

    sudo passwd root

Tuesday, September 6, 2016

How to restore MySQL dump/backup?

  1. Open the Command Prompt (Windows)/Terminal (Linux)
  2. Go to the folder where it is the MySQL dump/backup file
  3. Type the following command:

    mysql -u {username} -p{password} -h{host} {databaseName} < {backup-name}.sql
{username} is the login that has access to connect to the database
{password} is the login's password
{host} is the server name where it is the database
{databaseName} is the database name
{backup-name} is the name back up file name

Example:

I want to restore the Meemaw.sql dump/backup file to the BAZINGA database located at the TheBigBangTheory host with the user name Sheldon and password Cooper.

mysql -u Sheldon -pCooper -h TheBigBangTheory BAZINGA < Meemaw.sql

Source: http://www.thegeekstuff.com/2008/09/backup-and-restore-mysql-database-using-mysqldump/

Thursday, September 1, 2016

How to download a site with wget


  1. Open terminal or command prompt
  2. Type

    wget --mirror --convert-links --adjust-extension --page-requisites --no-parent {url}
{url} is the url of the site that you wants do download

Example

I want to download the Luiz's Blog
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent http://www.blogger.com

Tuesday, July 5, 2016

How to restart the network in Ubuntu

  1. Open terminal
  2. Type

    service network-manager restart
Source: http://www.howopensource.com/2014/12/ubuntu-restart-network/

Tuesday, February 9, 2016

Where it is the crontab file in Ubuntu?

/var/spool/cron/crontabs/{user account}

Example


Where it is the crontab file of the luizcgjr account?
/var/spool/cron/crontabs/luizcgjr

How to print the first and last parts of a file in Linux

First part
  1. Open terminal
  2. Type

    head -n {n} {file}
{n} is the number of lines to return
{file} name of the file

Last part
  1. Open terminal
  2. Type

    tail -n {n} {file}
{n} is the number of lines to return
{file} name of the file

Example

Print the first 10 lines of the blogger.log file
head -n 10 blogger.log

Print the last 10 lines of the blogger.log file
tail -n 10 blogger.log

Source: http://linux.die.net/man/1/head
http://linux.die.net/man/1/tail

How to fix e-mail client error: Your IMAP server wants to alert you to the following: Please log in via your web browser: https://support.google.com/mail/accounts/answer/78754 (Failure)


  1. Go to https://www.google.com/settings/security/lesssecureapps
  2. In Access for less secure apps, check Turn on 
  3. Go to https://accounts.google.com/b/0/DisplayUnlockCaptcha
  4. Click Continue

Friday, February 5, 2016

How to reinstall a package in Ubuntu


  1. Open terminal
  2. Type

    sudo apt-get install --reinstall {package}
{package} is the package name that you want to reinstall

Example

I want to reinstall firefox
sudo apt-get install --reinstall firefox

Wednesday, January 27, 2016

How to connect a non-empty directory into a git repository

  1. Open the Command Prompt (Windows)/Terminal (Linux)
  2. Go to folder location
  3. Type the following commands:

    git init
    git add -A .
    git remote add origin {url}
    git fetch
    git pull {url} master
    git commit -m "{message}"
    git push -u origin master
{url} is the location of your bare repository
{message} is any message that you want to identify the commit

Example:

I want to connect the c:\workspace\luizcgjr to the http://github.com/blogger/luizcgjr repository
  1. Open the Command Prompt (Windows)
  2. Type
  3. cd "c:\workspace\luizcgjr"
    git init
    git add -A .
    git remote add origin http://github.com/blogger/luizcgjr
    git fetch
    git pull http://github.com/blogger/luizcgjr master
    git commit -m "Added luizcgjr project to the repository"
    git push -u origin master
Source: http://stackoverflow.com/questions/3311774/how-to-convert-existing-non-empty-directory-into-a-git-working-directory-and-pus