Posts

Showing posts with the label Linux

line-by-line processing : Linux Bash

Often we require to process a file content line by line. Linux inherently supports this thorough its powerful shell commands. Lets walk through some of the ways to parse a file line-by-line. First, we can parse a file by catting a file and piping the file output to a while read loop. The following bash script produces it own code as output. Isn't it interesting? code for dumping own file content #!bin/bash cat $0 | while read line do echo $line; done Secondly, using file descriptors we can play a lot with it. But, before we will learn about firl descriptors in brief. Under unix/linux OS, files are referenced, copied, and moved by unique numbers known as file descriptors. 0 stdin It is(devie) usually the keyboard or mouse from where the input comes. 1 stdout It is where output is redirected e.g. screen or file 2 stderr It is where the standard error messages are routed by commands, programs, and scripts. $ some_command 2>&1 this means, the command sends all of ...

Upgrading Ubuntu to Natty Narwhal

I recently upgraded Maverick Meerkat to Natty Narwhal. The new ubuntu is packed with Unity for default desktop session. The Unity brings a lot of improvements with it. Along with improved UI and perceivable improved speed we could see a new scrollbar which takes less space and looks nice. Real gift to Ubuntu lovers!! worth a try !!!

Removing packages from linux (ubuntu)

I tried to remove the packages from maverick (Ubuntu 10.10), today..and found some good ways to do it (A)First search the package : The traditional way: dpkg -l | grep partial-name-of-package-to-be-removed Using dpkg command ....more conspicuous way dpkg -l '* partial-name-of-package-to-be-removed *' For example, you want to remove jdk then dpkg -l '*jdk*' (B)There are two ways to remove packages: Using apt command : ...the better way... After getting the list of packages choose the appropriate one and run following command * To remove packages: sudo apt-get remove package-name * To remove packages and dependencies: sudo apt-get autoremove package-name * To remove packages, dependencies and configuration files: sudo apt-get purge package-name Using dpkg command : ...the crude way... * To remove packages: sudo dpkg -r package-name * To remove packages,and configuration files: sudo dpkg --purge package-name * To force removal, if got depe...