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