Tuesday, February 14, 2017

Linux fundamentals for beginners


In Linux if you experience high brightness in the screen you can use the following approaches.

First approach :
Click the icon at the top right corner and go to System Settings and then go to “Brightness & Lock”. There I could reduce the brightness.
           
Second approach : Using the terminal
            First install “xbacklight “ using the following the terminal command.
                  sudo apt-get install xbacklight

Then set the brightness using the below command. In here you can set values from 0 to 100. I have set here 50.
                  xbacklight -set 50

Then you can increase or decrease the brightness.

                 To increase (Here I increase brightness by 10)     : xbacklight -inc 10
                 To decrease (Here I decrease brightness by 10)  : xbacklight-dec 10


In Linux you can’t install two applications simultaneously. If you try to install two programs simultaneously you will get the below error.


E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable) E: Unable to lock directory /var/lib/apt/lists/ E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable) E: Unable to lock the adminis

As a solution you can wait until the running installation process over or you can kill the currently running process and install the new one. In order to get currently running process with the process id use the following code.

ps -aux | grep 'apt-get'

This is the terminal output. Here 6219 is the process id.
root      6219  0.0  0.0  61868  4004 pts/1    S+   22:15   0:00

Then you should kill that process using following terminal command.
sudo kill -9 6219

In Linux sometimes you may have experienced some keys in your keyboard have interchanged.

For example when you type ‘@’ sign it will display the “” sign and vice versa. The reason for this is that in your operating system installation process you have selected the default language as English(UK) and the language selected for the keyboard is English(US) or vice versa.

To overcome this issue you can use the following code

runxkbmap -layout us

Steps  to install mysql and add user accounts and create databases.

To install :
sudo apt-get update
sudo apt-get install mysql-server

During the installation you can change the root password

To add new user with the password

For that you need to get the mysql shell promt. You have to run the following terminal code and type the root password when it is needed.

/usr/bin/mysql -u root -p

You can add new user along with the password using following terminal command. Here ‘testuser’ is the name of the new user and ‘123’ is the password.

CREATE USER 'testuser'@'localhost' IDENTIFIED BY '123'

In this mysql shell prompt you can list down the users using the following code. In there you can list down usernames, hostnames and passwords. For mysql versions before 5.7 you should use ‘password’ keyword to list down passwords. The code is stated below.

select user, host, password from mysql.user

But for mysql versions after 5.7 you should use ‘authentication_string’ as the keyword instead of password to view the passwords. You can use the following code for that.
                                                                                                                       
 select user, host,authentication_string from mysql.user

To create a database you can use the following code in the prompt. Here ‘newdb’ is the new database name.

create database newdb

To list down the databases created

show databases


Further posts will continue to represent more fundamentals of Linux. 
If you are interested share this post on social media. Thank you !

No comments:

Post a Comment