Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Tuesday, March 26, 2013

Shell Script in Linux

Shell Script in Linux and some examples
 Computers understand only binary languages (0's and 1's),  which are very difficult for humans to understand.  So, for Linux OS (Operating System) there is a special program called Shell. This program accepts instructions or commands from users in English, and converts it to binary languages. We can say it is acts as a mediator for kernel - the heart of Linux. Shell uses the system kernel to execute programs and create files etc.

Shell script is defined as the series of commands written in a text file. Shell scripts have more power than the MS-DOS.

Here is some shell script examples in Linux. First create a file with an extension of .sh, for that take a terminal and type command gedit myshell.sh here i have used gedit you can use any editors, and change the file permissions to executable format, for that we are using chmod 755 filename. For executing this file in terminal "./filename or bash filename".

Palindrome:
Output:
 


Chess board:

Output:


Lets have fun with shell script!

Step wave form:
Output:

Friday, March 8, 2013

Basic Linux Commands


Basic Linux commands

Most of the Linux users should knows the use of basic Linux commands or Linux commands, they are using different commands daily, but windows people they are scared about theses much of commands, if any one saying about Linux their mind will first goes to how we remember all these commands? If you used to see theses commands it will be very easy. For our daily needs these commands are very useful to us. Linux is basically a command oriented operating system, from the starting of Linux it is fully controlled by commands, Now we can see the developed versions of various distributions in Linux, mainly the graphical user interfaces (GUI), for easy usage and graphical visualization.

Here i am introducing some basic commands, for beginners.

pwd : present working directory.

This command will list where we are now?

ls : This command is listing all files and folders.

cd : This command is used for changing the directory,
Ex : cd Directory name

cd - : Switch to previous directory

mkdir : Make directory
Ex : mkdir Directory name

rm -r : Remove directory
Ex: rm -r Directory name

rm -rf : Remove directory Forcefully

chmod : Change the permission of files and folders
Ex: chmod 777 -R dirname 

Thursday, July 26, 2012

Adding a new user in sudoers list with root user privilege (ubuntu)

For adding a new user in the 'sudoers' list follow the procedures given below:
(in order to do this you should have root user privilege)

--> Take terminal window (from Applications->Accessories->Terminal or press Ctrl+Alt+T)

--> Type the command: sudo visudo

the terminal will display something like this:

------------------------------------------------------------------------------------------------------------------------------
GNU nano 2.2.2            File: /etc/sudoers.tmp
 
# /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# See the man page for details on how to write a sudoers file.
#
Defaults        env_reset
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root    ALL=(ALL) ALL
# Allow members of group sudo to execute any command after they have
# provided their password
# (Note that later entries override this, so you might need to move
# it further down)
%sudo ALL=(ALL) ALL
#
#includedir /etc/sudoers.d
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
-----------------------------------------------------------------------------------------------------------------------------

--> Now, after the 'root ALL=(ALL) ALL' statement, add your username in the following syntax:

domainname\\username = ALL=(ALL) ALL

eg: CODETECH\\tiger ALL=(ALL) ALL

Note: at the time of login you have to give CODETECH\\username as username

Monday, July 23, 2012

How to add text completion functionality to Gedit text editor (Ubuntu)

Today many open source text editors are available, for Ubuntu and Debian operating systems (OS). Both OS have 'gedit' as their default text editor. In its default settings gedit will not provide advanced auto text completion, but you can modify the settings to avail this functionality.

Many times my fellow developers asked me why I am using gedit for coding, while other more advanced editors are available. I didn't had a reason to support my favor to gedit, but personal preference. I thought about making gedit a more useful editor like geany, sublime etc.(both are open source editors) and i searched in Google for improving the coding standards and editor efficiency, finally I found the Gedit plugin.

You can download this plugin from the below links.

Features

  • Auto-close brackets and quotes
  • Auto-complete XML tags
  • Detects lists and automatically creates new list items
  • Auto-indent after function or list

Installation

Gedit 2 (up till Ubuntu 11.04)

  1. Unpack the archive
  2. Put  intelligent_text_completion.gedit-plugin and intelligent_text_completion.py inside .gnome2/gedit/plugins/ in your home directory.if folder extension is starting with '.' it means that folder is a hidden folder in Ubuntu lots of system supported folders are hidden, Open your home directory and go to view->show hidden files or ctrl+h (create it if it doesn't exist yet, by default the 'plugins' folder will not be there.) 
  3. How to get .gnome2 folder in your Ubuntu machine?,
  4. Restart Gedit.
  5. Go to Edit->Preferences->Plugins and check the box for Intelligent Text Completion
Gedit 3 (Ubuntu 11.10 or higher)
  1. Unpack the archive
  2. Put intelligent_text_completion.plugin and intelligent_text_completion.py inside .local/share/gedit/plugins in your home directory. (create it if it doesn't exist yet)
  3. Restart Gedit.
  4. Go to Edit->Preferences->Plugins and check the box for Intelligent Text Completion