A handy list of commands for Ubuntu Terminal

Package Update and Installation:

sudo apt-get update

sudo apt-get install tree

sudo apt install zip unzip

Directory Tree Structure:

tree folder_name

Zip a folder:

zip -r output_file.zip input_folder

Unzip a folder:

unzip file.zip

Check Versions:

  • Ubuntu: lsb_release -a
  • MySQL DB: select VERSION();
  • Python: python --version
  • Pip: pip --version
  • Virtualenv: virtualenv --version

Run MySQL on Ubuntu:

sudo apt-get install mysql-server

/usr/bin/mysql -u root -p

Create MySQL User:

CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'user_password';

/usr/bin/mysql -u newuser -p

select * from mysql.user;

Show, Create and Drop MySQL Databases:

show databases;

CREATE DATABASE database_name;

DROP DATABASE database_name;

Use MySQL Database and Show Tables from Database:

USE database_name

show tables from database_name

Grant and Show Privileges to MySQL User:

GRANT ALL PRIVILEGES ON database_name.* TO 'newuser'@'localhost';

SHOW GRANTS FOR 'newuser'@'localhost';

Revoke Privileges and Drop MySQL User:

REVOKE ALL PRIVILEGES ON database_name.* FROM 'newuser'@'localhost';

DROP USER 'newuser'@'localhost';

Quit MySQL Console:



Installing and Upgrading Pip and Virtualenv:

pip install --upgrade pip

pip install virtualenv

Creating, activating and deactivating a virtual environment:

virtualenv venv

source venv/bin/activate


Removing a Virtual environment:

rm -r venv/

I'll keep updating this list from time to time.