Showing posts with label Linux Tips. Show all posts
Showing posts with label Linux Tips. Show all posts

How to colorize the output of grep

Linux logo

Grep is a very useful Linux command. In short grep searches an input stream for a pattern and displays the results. In this guide I will show you how to colorize the output of grep by highlighting the pattern you were searching for.
Supposing that you are using the bash shell open ~/.bashrc with your favorite text editor:
gedit ~/.bashrc
and paste the following line:
alias grep="grep --color=auto"
Now open a new terminal (or source ~/.bashrc) and try the grep command. This is how the default and colorized grep look like:
Colorized grep command
Of course you can change those colors. In ~/.bashrc to change the foreground color paste the following line:
export GREP_COLOR="1;37"
or to change bot foreground and background
export GREP_COLOR="1;37;42"
Here is the output of grep.
Colorized grep command
The first number indicates that we want the font to be bold. The second one is the foreground (the text's) color, and the third one is the background color. Here is a list with the color numbers of the shell.
Color Foreground Background
Black 30 40
Red 31 41
Green 32 42
Yellow 33 43
Blue 34 44
Magenta 35 45
Cyan 36 46
White 37 47

Best GNOME Shell extensions

gnome logo

It has been a couple of weeks now that GNOME launched a public alpha version of their extensions sitewhich makes adding extensions to GNOME Shell with a single click. To use the extensions through his site first of all you must have install GNOME Shell 3.2 or newer. Fedora has version 3.2 by default. In a previous guide of mine I've shown you How to install Gnome Shell on Ubuntu 11.10 Oneiric Ocelot. Moreover you must have Firefox installed for this to work. There were some bugs in the browser plugin shipped in GNOME 3.2 that prevent it from working properly under WebKit-based browsers like Epiphany and Chromium. These bugs have been fixed and should be released when GNOME 3.4 ships at the beginning of March, next year. So, here is a list with some useful gnome extensions.

Alternative Status Menu

Replaces GNOME Shell Status Menu with one showing Suspend/Hibernate and Power Off as separate items. (install)

Applications Menu

Adds a gnome 2.x style menu for applications. (install)

Auto Hide Top Panel

Automatically hide the top panel. Useful if you have a small screen, a netbook for example. (install)

Battery Percentage Indicator

Puts a percentage label next to the battery panel icon. (install)

Frippery Bottom Panel

Adds a bottom panel to the shell. Useful, especially when you are working with a large number of windows and switch them frequently. (install)

noa11y

Removes a11y (Accessibility) icon/menu from panel. (install)

Places Status Indicator

Adds a systems status menu for quickly navigating places in the system. (install)

Window List

Adds a list to the top panel with all your open windows. It also displays a preview of the window if you place your mouse over it. (install)

Workspace Indicator

Puts an indicator on the panel signaling in which workspace you are, and give you the possibility of switching to another one. (install)
To update extensions for the time being you have to uninstall them manually and reinstall them. Gnome 3.4 will include features to make sure that your extensions can be updated automatically for you.
To uninstall an extension remove the extension's directory which is stored in ~/.local/share/gnome-shell/extensions and afterwards log out and log back in.
You can also view your all your installed extensions and disable some of them temporarily simply by pressing the on/off button.
What are your favourite extensions? Which ones do you think are the best ones?

How to install Gnome Shell on Ubuntu 11.10 Oneiric Ocelot

ubuntu

Ubuntu 11.10 Oneiric Ocelot comes with Unity preinstalled. Unity is a shell interface for the Gnome Desktop Environment developed by Canonical for its Ubuntu Operating System. On Ubuntu 11.10 it's pretty easy to install Gnome Shell and Gnome Shell classic, the one with the two panels on top and at the bottom. Here is how.
To install Gnome Shell (3.2 is the latest version at the moment) open Software Center and search for gnome shell or open a terminal and type:
sudo apt-get install gnome-shell
Now logout and select GNOME from the LightDM login screen. Here is how it looks like:
To install Gnome Fallabck (3.2 is the latest version at the moment) open Software Center and search for gnome session fallback or open a terminal and type:
sudo apt-get install gnome-session-fallback
Now logout and select GNOME Classic from the LightDM login screen. Here is how it looks like:
Here is a screenshot with the options on the mogin manager. These packages might already be installed on your system, so take a look first.
So, which is your favorite desktop environment? Unity, Gnome or something else? Personally I am using KDE for many years now and despite Canonical's ang GNOME's team efforts I am not going to change!

How to install the Netflix Desktop App on Ubuntu



Ubuntu logoWatching Netflix requires Microsoft Silverlight which isn't available in Linux. Here comes an unofficial Netflix app for Ubuntu which makes it easy to install Netflix and start watching movies right away. The app is using WINE and can be easily installed through a PPA created by Erich Hoover. Just open a terminal and type:

sudo apt-add-repository ppa:ehoover/compholio
sudo apt-get update
sudo apt-get install netflix-desktop
Once installed, go up to the top left of your screen and open your Unity dash, search for Netflix and run the app. It will load up everything needed on the first run. After logging into your Netflix account and selecting a video to play, Silverlight should ask you to enable DRM content. Please enable it. Netflix movies should work fine now!
The Netflix app starts in full screen mode. You can exit out of the app completely by pressing ALT+F4. You can also press F11 to exit full screen mode.
Netflix for Ubuntu

eSpeak Is Free Text To Speech Software For Windows, Mac, And Linux



eSpeak Speech Synthesizer is an open source speech synthesizer for Windows, Mac and Linux based OS. It provides the option for listening to text in multiple languages. The speech is clear and the available text in English, can be listened to in any alternative language easily.
Just enter the desired text in the eSpeak text box and click on the Play button after selecting the appropriate language. This plays the text in sequence and the word that is being played is highlighted. The available languages in this application are quite infinite and the utility to copy/paste text allows coping a large number of text to the eSpeak text box. Clicking on the File drop down menu also allows opening multiple eSpeak boxes for adding text separately to. From this menu a file can also be saved for the current text. This can be later imported via the Open option in the File menu to be played again.
eSpeak Speech Synthesizer was tested on Ubuntu 10.10.

Modify PDF Documents in Ubuntu With PDF Mod


PDF Mod is a Linux based application that allows comprehensive modification of PDF documents. Some features include the ability to reorder, rotate, remove and edit (title, subject, author, and keywords) PDF documents, as well as, the choice of exporting images from document. PDF Mod makes it extremely easy to combine separate PDF documents via drag & drop.


After installation, PDF Mod can be accessed from Applications –> Accessories. A document can be opened in this application either by opening PDF Mod separately and adding documents via the Open a Document button or by right-clicking on a document and selecting Open With PDF Mod option.

Right Click Context Menu

Once a document is opened, users can extract, remove, rotate, match page(s) via the right-click context menu. A new doucment can be opened from the Open a Document button located on the top left corner of the main interface. Other options from left to right include Save This Document To a New File button (for saving the edited document separately), a button for editing the title/key words, Save All Images button (for saving all images from the document), Insert button (for inserting new pages), Extract button (for extracting a specified page sperately), Remove button (for removing a page) and rotation buttons ( for rotating pages left/right).

Extract Page

The File drop down menu can be used to perform some of the above mentioned functions, to view recently opened documents or to see document properties which include the title and keywords.  Editing options can be accessed from the Edit drop down menu, whereas the View menu allows managing zoom options for the selected document. Any PDF document can also be dragged & dropped for adding it to the current document.

Drop Down Menu
This application was tested on Ubuntu 10.10 and worked seamlessly.
Download PDF Mod

Install Cinnamon


Cinnamon is a Gnome 3 fork that allow you to have a panel at the bottom with a classic Menu, this is useful for people that want to use Ubuntu with a classic Bottom Menu.
sudo add-apt-repository ppa:gwendal-lebihan-dev/cinnamon-stable
sudo apt-get update
sudo apt-get install cinnamon

Ubuntu Tweak


Ubuntu Tweak is a must have application for Ubuntu and LinuxMint, it is an application to config Ubuntu easier for everyone. It provides many useful desktop and system options that the default desktop environment doesn’t provide.
Using Ubuntu Tweak you can install all needed applications with a simple click, you can change the window buttons from Left to right…etc.



Install Ubuntu Tweak via PPA:
Open terminal and enter the following command:
sudo add-apt-repository ppa:tualatrix/ppa  
sudo apt-get update 
sudo apt-get install ubuntu-tweak
Most of the applications listed in this post, can be installed from Ubuntu Tweak Center with one click.
If you want to learn how to use Ubuntu Tweak read our previous post

Install LibreOffice In Liunx


LibreOffice is developed by forking the OpenOffice(Probably due to the fact that Oracle had bought the Sun MicroSystems,therefore the future of OpenOffice wasn’t good in the hand of Oracle). It is free,open source and cross-platform(Linux,Windows and Mac). LibreOffice is the best substitute for Microsoft Office. LibreOffice is very useful for creating and editing Text Documents,Drawing,Spreadsheet,Presentation etc.

top ubuntu apps 4 - LibreOffice

Ubuntu ships OpenOffice by default so, if you want to install Libre Office then first remove the OpenOffice package(use Synaptic Package Manager). Then install the LibreOffice by typing the commands written below -
First Add the PPA Repository -
sudo add-apt-repository ppa:libreoffice/ppa
Then Update the Repository -
sudo apt-get update
Now install gnome version of LibreOffice -
sudo apt-get install libreoffice && sudo apt-get install libreoffice-gnome

Install GIMP In Liunx


GIMP(GNU Image Manipulation Program) is a powerful image editor application, equivalent to the Adobe Photoshop. It has a lot of advanced features with a simple and easy to use GUI(Graphical User Interface). GIMP is available for all major operating system. It is the most popular image processing program on Linux platform. The default features can be extended easily using plugins e.g ‘save for web’ plugin on gimp is used to optimize the image files.

top-ubuntu-apps-1-gimp

you can install GIMP on Ubuntu by one simple command -(More details on – installing gimp on Ubuntu)
$ sudo apt-get install gimp

Install VLC In Liunx


VLC is the best media player because it can play all the common formats seamlessly. On Ubuntu it is not installed by default, due to the dependencies of vlc on  libdvdcss2 libraries(a proprietary library).

vlc-player-ubuntu-snapshot

To install vlc on Ubuntu, type the command given below(More details : installing vlc on Ubuntu)

sudo apt-get install vlc vlc-plugin-pulse mozilla-plugin-vlc

Finding the Size of a Directory Using du


Here is an easy way to find out the the number of Kilobytes your directories are taking up. For example, when doing backups, sometimes I will notice a particular directory has ballooned in size for no apparent reason. Often this is because I copied a file someplace and forgot to clean up after myself.
The du command is really good for looking up this kind of information. It recursively searches directories and returns the number of blocks or bytes each directory and all of its subdirectories are using. The following command will list all the subdirectory sizes of the current directory in kilobytes. The command is then piped through sort to sort the directory list by size in K. Below are several examples of how to use the command on several different platforms.

Mac OS X Example

du -k -d 2 | sort -n
~/Pictures $ dirsize
0       ./Palm Photos
204     ./Temp
4344    ./Backgrounds
4556    .
  

Cygwin Example

du --max-depth=1 -k | sort -n
  

Unzipping a File Using gunzip and tar


In UNIX and Linux, files are compressed and stored using the GNU zip utilities. Often, if a directory containing a number of files needs to be compressed, it is first stored in a single file using tar. The tar command was originally used to make tape archives, but is still commonly used to store many files into one file. You can combine the gzip utilities with tar on one line to simplify your commands.

For example, to uncompress the file foo.tar.gz you could use one of the following commands:

gunzip -c foo.tar.gz | tar xvf -
or alternatively:

gunzip < foo.tar.gz | tar xvf -
Both commands write the data produced from the gunzip command to standard out. (-c in the first example and using < in the second), using a pipe, the data is used as input in the tar command. The dash "-" represents standard input.

Zipping

Since you can unzip, you can also zip with a single command. For example, to zip the foodir directory into the foo.tar.gz archive you can use the following command:
tar cvf - foodir | gzip > foo.tar.gz

control computer with iphone


a)Develop a boot loader to run on the PowerON
b) configured linux kernel
c)A sweet file-system all with the necessary software.

Hardware Used:

I) A P2 machine
II) 16MB RAM
III) 2GB HDD
Iv) A AMD Athlon 64 2800+(1.8GHz)machine as a host for our development

Maintaining the development Environment:
In this case,the development process has done on the host system,taking the targeting system as the consideration,because of the high memory,advantage of the lower compile time of the host machine.Here,the concept of the "Cross-compilation "is needed.Because the CROSS_COMPILER is a system that runs on one type of processor,but compiles instructions for the another.

Setting up the HOST::
Though the presence of the different several processes I have used here "REMOVABLE STORAGE SETUP", where there are no direct physical link between the host and the target.Actually, a storage device is written by the host and is transferred into the target,which is used to boot the target system.


Preparation for the Host Environment::

1) Install a latest Linux edition of REDHAT,or other similar.
2) Format the target HDD with a suitable file system.(I prefer ext2).
3) The host system should have "Cross-Compiler toolchain" to build up the software for the target system.I have used GNU's cross Platform developent toolchain.I also used


i) Binary Utilities (Assembler,linker and Various Object file Utilities).
ii) The GCC compiler for GNU C,C++
iii) The C Library(like glibc,newlib etc.)



Binding up our personal Toolchaon::
Here , an alternative C library like "uClibc" is choosen for my personal system development.The "uClibc" is a C library optimized for embedded systems.


To build up our custom toolchain I have performed some steps as --------
With the open source Automation tools like "buildroot" I have configured the toolchain and installed it in "uClibc" version, "binutils" version, GCC version and so on. After the succesful toolchain compilation,it has installed in a specific PATH environment variable to the "bin" directory of the installed path.

Having the cross development platform ready,we need three components to build up a complete Linux environment for an embedded system.


A) The Kernel
B) The Root file System
C) The Boot Loader


Setting up the KERNEL:
First download the Linux kernel from "www.kernel.org" (say as inux2.4.20.tar.bz2) and extract it and cd to the directory.Now ,feel the thrillings that U'r ready now to compile the chossen kernel with your new toolchain.So, edit the "makefile" to set up the "CROSSCOMPILE" prefix using

Code:
CROSSCOMPILE =i386-linux-uclibc


Then configure the kernel according to the embedded target device requirements using
Quote:
make menuconfig
or make xconfig.

Then issue the "make dep" and "make bzImage" commands. The kernel image is now built in the "arch/i386/boot" directory. If the modules r enabled,implement "make modules",and " make modules-install" . The compiled modules will be installed in " /lib/modules/linux-".




Creating the Root File System::
I have created the root file system on the previous "ext2" formatted HDD.FIrst, we mount the partition as SUPER USER,by

Quote:
#mount -t ext2 /dev/hdc1 /mnt/target


Now enter to the /mnt/target dir and create a standard Linux root directory structure
Quote:
#mkdir bin boot dev etc etc/init.d proc sbin usr


Create "modules" directory in "lib" if modules were enabled.
Quote:
#mkdir /lib/modules

Now set appropriate permissions for these directories.To set up various core linux utilities like sh,ls,cp,clear,mkdir.......Fortunately u can get a tool that combines all the utilities called " BUSYBOX".Busybox is highly configureable,and u can select only those utilities u want to for your platform.U can select also static or dynamic compilation.


Compile it with your new toolchain.
Quote:
$ make
$ make PREFIX= /mnt/target install

This will populate bin,sbin,usr,usr directories with all symlinks to "busybox" binary in /mnt/target/bin directory.

Then,the boot directory needs to be generated with your previous compiled kernel image. U need to create the necessary device nodes appropriately in the "dev" directory using "mknod" utility; for example, the terminal devices like "tty", console , virtual terminal devices for VGA display,serial terminal devices,the ps mouse,null device etc.

Next set up the various startup scripts .Create a "rcS" script in " etc/init.d/"

Quote:
#! /bin/sh
mount -a #Mount the default file system mentioned in /etc
/fstab
/bin/sh #Invoke Busybox shell

Create "fstab " file in /etc directory
Create "inittab" file in /etc directory

#This is run as first script
:: sysinit : /etc/init.d/rcS
::askfirst :-/bin/sh
::restart : /sbin/init
::ctrlaltdel:/sbin/reboot
::shutdown:/bin/unmount -a -r >/dev/null 2>&1


Thse script may be customizesd according to the target requirements.



Installing the Boot Loader::
To make first bootable Personal linux system u need to install the Boot Loader.Copy the Stage1 ,Stage2 dir.s of GRUB from the host machine into target's boot/GRUB directory.Install the GRUB on the target hard disk.

Quote:
#/sbin/GRUB
#GRUB> root(hd1,0)
#GRUB> setup(hd1)



Now ,u need to edit 'etc/GRUB.conf as shown below:
Quote:
#Assuming the Storage device will be installed as first
#harddisk.
title MYPERSONAL LINUX
root(hd0,0)
kernel /boot/bzImage ro root=/dev/hda1


Atlast,the GRUB should be compiled with our cross toolchain.


Ready to Enjoy::
Shut down the host system.Remove the target HDD and install it on the target system.Power on this machine.See the GRUB menu.Select your choice.If choice the MYPERSONAL LINUX,your linux system get booted,and a Busybox shell promt should appear..


Now Start to enjoy........with Your Personal Linux System.
www.comhttp.blogspot.in. Powered by Blogger.