5 Feb 2011

10 ways to finding things in linux

Basically i am talking about Linux terminal and without installing any new programs. I will also not use any programming languages. I am not digging into regexp details, please refer to their documentations. Many programs have their own regexp and syntax so I usually pipe the output to the input of egrep or such to satisfy my needs. This document is for reference and only states how i use them. These are obviously not the only ways.

1. ls (dir also does things similar) : List the contents. Ls is the first command I use to search in Linux. Obviously the very basic but also, very useful if you know in which directory your file is. This command was written partly by Richard stallman himself. To do a simple search just type ls followed by the file name. Other examples:

    # To search file names with a fixed file-type (Using Wildcard)
    # Here I am searching for mp3 files in my current directory
    ls -C *.mp3
   
    * this matches everything that has a '.mp3' anywhere in the filename and puts it in a column (-C).
   
    # To search for file whose filetype and first starting character I remember
    # I am searching for mp3 files whose first character is y
    ls | egrep '^[Yy].*.mp3$'
   
    * this matches everything starting('^' for starting character) with a 'Y or y' and any number (here '*' for any number of times) of character (here '.' for any character) following it which ends in ".mp3" (here $ as end of line).
   
2. locate : Locate is a command line file search utility which finds file by it's name until regexp is used. Unlike ls, locate searches for files in all directories. But it has a major drawback. It uses a database('/var/lib/mlocate/mlocate.db') to search from, which might not be updated all the time.

    # To update the database use
    updatedb

3. who (also, finger and w) : While a little different, it searches for users who are logged into the computer right now. Finger provides a little more detail
    # To find out who logged into the system after the computer booted type:
    who -a -H
   
4. whatis (apropos and man) : These commands searches for discription about some binaries, files whose manual pages are available. It is very useful to find out if an application is installed which additionally displays descriptions (short description in whatis and broader and long description in apropos and a complete manual with man) of the application. whatis and apropos supports regex and wildcards.

    # To find out if ls is installed in your system with whatis type:
    whatis ls
   
    # To do the same with apropos
    apropos -e ls

Read the rest of this post »

23 Dec 2010

Ubuntu 10.10. What I did to my computer.

SAfter installing Ubuntu 10.10 into my computer the following are the list of software and tweaks i did to my computer. If you like it you can use it.

1. Installed Firefox addons:
    a. Adblock Plus
    b. DownloadHelper
    c. Download Statusbar
    d. FaviconizeTab
    e. Fission
    f. Greasemonkey
    g. Omnibar
    h. Smart Stop/Reload
    i.  SmoothWheel
    j.  Stylish (installed the style: Highlight Input&Textarea)
    k. Firebug
    l. FireFTP
    m. Chromifox Basic
   
    And Did the following Tweaks

Read the rest of this post »

30 Jun 2010

Stop Mysql service to run at startup

My Linux box was running mysql from the start and I did have no clue. It was not in my startup applications list, neither in my init.d folders.

But whenever i did nmap of localhost, i could see the mysql port open. I could kill mysql service, need to kill it multiple times, only then it used to die.

I even installed "sysv-rc-conf" so that i could stop it at run levels, but it was not running at any runlevels. I then did "update-rc.d mysql disable". Which didn't work either.

Later I found that there was a file called "mysql.conf" in /etc/init/ folder. I renamed the file to mysql.conf.disabled and it worked out. Hope this will help others who have the same problem.

26 May 2010

Lookup details of an IP or Domain (whois lookup) graphically

By using the following script you can easily lookup for an ip or domain using zenity and shell script. (sorry Windows folks, i just hate you).

 

#!/bin/bash
# Get the domain name
Z="/usr/bin/zenity"
O="/tmp/whois.o.$$"
domain=$(${Z} --title  "Domain Information" \
                --entry --text "Domain name who's information you seek!" )

if [ $? -eq 0 ]
then
    whois $domain  | tee >${O}
 
  # Display back output
  ${Z} --width=800 --height=600  \
               --title "Whois info for $domain" \
               --text-info --filename="${O}"
else
  ${Z} --error \
               --text="No input provided"
fi

 

Enjoy. :D

8 Apr 2010

oh i am back in ruby!

After a long time, I am back and am back in ruby too.
doing new things in ruby.

class linuxfanatic 
  def says(message)  
    puts message  
  end  
end  
  
tushar = linuxfanatic.new  
tushar.says "oh i am back in ruby!" 

 

21 Mar 2010

Make Your Linux Box Blazing fast!

This list is compiled for my personal use, should work for anyone. Try the followings:

1. Use lighter applications (Replace your default applications with them)

Gedit >> Mousepad
Picture viewer (EOG ...) >> Gpicview
Network Manager >> Wicd
Open Office Writer >> AbiWord
Open Office Spreadsheet >> Gnumeric
Evince >> epdfview

2. Increase Swappiness

$ sudo vim /etc/sysctl.conf
Edit: vm.swappiness=10

3.  For dual cores (Use Concurrency)

$ sudo vim /etc/init.d/rc
Edit: CONCURRENCY=shell

Read the rest of this post »

13 Jan 2010

My .vimrc file

Vim is the editor of my choice for my linux box. I have configured my .vimrc file in my ubuntu.

-------------------------------------------------------------------------------------------------------------

" Tushar Neupaney's VIMRC File
" Followme twitter.com/tneupaney
" linuxfanatic.posterous.com

" (sw)shiftwidth: how many columns text is indented with reindent operations
" (sts)softtabstop: how many columns vim uses when you hit tab
" (ts)tabstop: how many columns a tab counts for
set ts=4 sw=4 sts=2

" expandtab: appropriate number of spaces in insert mode
set expandtab

" Make gvim colorscheme as evening
if v:progname =~? "gvim"
    colorscheme evening
endif

" Prevents keeping of backup after overwriting the file
set nobk

" To see line numbers on the left
set number

" autocomplete parenthesis, brackets and braces
inoremap ( ()<Left>
inoremap [ []<Left>
inoremap { {}<Left>

" Syntax highlighting on
syntax on

" share windows clipboard
set clipboard+=unnamed

" Hightlight the curent column
set cursorcolumn

" Hightlight the current line
set cursorline

-------------------------------------------------------------------------------------------

Here is the Screenshot!

 

13 Jan 2010

[Solved] Wireless Driver for Compaq CQ40 (bcm4312)

Trying out ubuntu in our new office laptops the Compaq CQ40, I found out that the wireless driver was not working. To find out the actual wirelss device installed in the system I tried the following commands:

1. lshw -C network

This gave me the product result as BCM4312 802.11b/g from Broadcom Corporation. Tried a lot of googling and found that you could download a file from broadcom here. And do the following! While this works for me.

Try the following while being root!

# Removing previous instances of wireless drivers if any
2. lsmod | grep "b43\|ssb\|wl"
3. rmmod b43
4. rmmod ssb
5. rmmod wl

# Prepare the device driver from the file that you've downloaded
6. cd to the downloaded file
7. make clean
8. make

# Blacklist previous drivers
9. echo "blacklist ssb" >> /etc/modprobe.d/blacklist.conf
10. echo "blacklist b43" >> /etc/modprobe.d/blacklist.conf
11. echo "blacklist wl" >> /etc/modprobe.d/blacklist.conf

# Install the driver
12. modprobe lib80211
13. insmod wl.ko

:-)

 

5 Dec 2009

What is the motive beind today's nepal band?

5 Dec 2009

Why did the chicken crossed the road?

We can see people taking strange stand in things they think true,
but holds meanings from different perspectives and may not be true to
all ranges of beholders. We can visualize this in political agendas where,
 each agenda is a mere delusion and are produced to shadow the
real fact. But for it's faithful believers all points are considered to be true.
 Here is an example of a small question being asked and supposed
opinions of famous people around the globe.
The question being "Why did the chicken crossed the road?".

Plato:  For the greater good.

Aristotle:  To fulfill its nature on the other side.

Karl Marx:  It was a historical inevitability.

Nietzsche:  Because if you gaze too long across the Road, the Road
gazes also across you.

Albert Einstein:  Whether the chicken crossed the road or the road
crossed the chicken depends upon your frame of reference.

Darwin:  It was the logical next step after coming down from the
trees.

Ernest Hemingway:  To die.  In the rain.

Buddha:  If you ask this question, you deny your own chicken-nature.

Pyrrho the Skeptic: What road?

Ronald Reagan:  Well,...................

Mark Twain:  The news of its crossing has been greatly exaggerated.

Johnny Cochran:  The chicken didn't cross the road. Some chicken-hating, genocidal,
lying public official moved the road right under the chicken's feet while he was practising his golf swing and
thinking about his family.

More on INFILTEC:HUMOR