Thursday, August 25, 2011

ls command is your friend.. :)

How to know the inode of a file of directory:
$ls -i <- displays the innode of the file& directory in current directory
Ex:
$ ls -i
320785 a 320800 abc 320786 b 320787 c
The numbers represents the inode

How to list files sorted with modification time:
$ls -lt <- displays with time sorted manner with latest first
Ex:
$ ls -lt
total 4
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:54 c.odt
drwxr-xr-x 2 hanu hanu 4096 Aug 26 11:53 empty_dir
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:53 a.txt
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:53 b.png

Note: if you want to reverse the output of ls add option -r
Ex:
$ ls -ltr
total 4
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:53 b.png
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:53 a.txt
drwxr-xr-x 2 hanu hanu 4096 Aug 26 11:53 empty_dir
-rw-r--r-- 1 hanu hanu 0 Aug 26 11:54 c.odt




Wednesday, August 24, 2011

How to initialize sound in debian based Linux?

I met with this weird problem today, No sound output from my system with any player say banshee, totem etc... But yesterday it works fine. I checked all the sound settings in volume control it seems everything is perfect, but no sound output :(. Atlast i got the solution for this. Just give the following command in the terminal as root.

#alsactl init
The above command initializes the alsa sound card driver :). So after this audio works find

My audio driver is
:~$ lspci | grep -i audio
00:1b.0 Audio device: Intel Corporation 82801JD/DO (ICH10 Family) HD Audio Controller (rev 02)

My system's snd module details:
:~$ lsmod | grep snd
snd_hda_codec_realtek 163294 1
snd_hda_intel 16811 4
snd_hda_codec 46002 2 snd_hda_codec_realtek,snd_hda_intel
snd_hwdep 4054 1 snd_hda_codec
snd_pcm_oss 28671 0
snd_mixer_oss 10461 1 snd_pcm_oss
snd_pcm 47226 4 snd_hda_intel,snd_hda_codec,snd_pcm_oss
snd_seq_midi 3576 0
snd_rawmidi 12513 1 snd_seq_midi
snd_seq_midi_event 3684 1 snd_seq_midi
snd_seq 35463 2 snd_seq_midi,snd_seq_midi_event
snd_timer 12258 3 snd_pcm,snd_seq
snd_seq_device 3673 3 snd_seq_midi,snd_rawmidi,snd_seq
snd 34375 17 snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
soundcore 3450 1 snd
snd_page_alloc 5045 2 snd_hda_intel,snd_pcm

# <- Refers the root user in terminal
$ <- Refers the non-root user in terminal
Am using BOSS 4.0 Linux.

Thursday, August 11, 2011

How to import mails to/Export mails from Icedove?



1. Download the following icedove add-on(ImportExporttools) from here.

2. Configure the add-on with your icedove client, steps are as follows.
Icedove --> Tools --> Add-ons

Now you will see a window like this ->


click on install button. Navigate to the downoalded ImportExportTools.xpi file and select it.

Now you will see a window like this ->

Once the "install" button enabled then click it. Your Icedove will automatically get restarted. Now you have the an option named "ImportExportTools"
in Icedove -> Tools ->

with sub options as show in the following image ->

So, Now if you want to export(backup) mails from icedove then select
Tools -> ImportExportTools -> Export options

If you want to import mails from some other backups(other mail client, but mbox format file) then select
Tools -> ImportExportTools -> Import options

Give a go through of all the available options in the Tools -> ImportExporttools and select the one which you want. Thats all now you are able to import/export backup your mails from icedove.

Note: Am using BOSS Linux 4.0, icedove version 3.0.7

Monday, July 4, 2011

When a new package installed.., What are the files installed & where they are?


In Debian linux(which uses apt-get & dpkg for package mangement) we can find out what are the files
get installed when a new package installed into your system. There are two ways to do this.

GUI Way:
System -> Administration -> Synaptic Package Manager
1. Now you got a GUI window. In that window on left side select "status" button & then "Installed"
2. Now you will see all the installed packages in your system on the right side.
3. Select the package to which you want to get the information, then right click select "properties"
4. Now you will get a new window with tabs "common, dependencies, installed files.. etc". Click the installed files tab.



Now you can see all the files installed in your system regarding that particular package with the full path to those files. :)

CUI Way(Terminal):
Issue the following command in terminal
#dpkg -L "packagename" | more
Note: Replace with the package which you want without quotes. I am using the debian derived Indian linux distro "BOSS- Bharat Operating System Solutions"



This will be useful when you are not sure/know where the configuration, log files, command regarding particular package is.

Thursday, June 2, 2011

How to remove continuous(unnecessary) occurance of a character?

In Debian Linux we have one superb command tool called 'tr' [Translate or delete characters]. This simple handy tool has may usages, here am going to explain how to remove sequence of repeated (same)character.

The date command will produce output as follows
Ex-1-scenario:
$date
Thu Jun 2 17:10:17 IST 2011
Note: There are 2 spaces between the Month(Jun) and the date(2) because the date is single digit.
Ex-2-scenario:
$date
Thu Jun 22 17:10:17 IST 2011

So, if i try to cut the date using cut command then with empty space( ) as delimiter. then the field count will change.
For example:
Ex-1-scenario:
In f1-Thu f2-Jun f3-( ) f4-2 f5-17:10:17 f6-IST f7-2011

Ex-2-scenario:
In f1-Thu f2-Jun f3-2 f4-17:10:17 f5-IST f6-2011

So, how can i split fields correctly regardless of the single or double digit dates. Here comes our tr tool. It will be done as follows
for both scenario-1, scenario-2
$date | tr -s ' '
Note: if you use tr -s 'y' it will remove the continues occarance of 'yyyyy' and put only one single 'y' there.
will output with single space( ) between fields. Happy scripting.. :)

For more information see the man page of tr, date commands. For online man pages of tr, date.