MUSAFIR HOON YAARON

April 23, 2008

Uncompressing files

Filed under: linux — gurudev @ 3:49 pm
Tags: , ,

Install unrar command

Under Debian Linux, you need to type apt-get as follows to install unrar program:
# apt-get install unrar

If you are using Fedora core Linux then use yum command as follows (see discussion below):
# yum install unrar

If you are using FreeBSD, use:
# pkg_add -v -r unrar

If any of above, methods is not working for you, download binary package from official rarlab site:
$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.6.0.tar.gz

Untar file
$ tar -zxvf rarlinux-3.6.0.tar.gz

Both unrar and rar commands are located in rar sub-directory. Just go to rar directory:
$ cd rar
$ ./unrar

Now copy rar and unrar to /bin directory:
# cp rar unrar /bin

How to use unrar

unrar command supports various options below are common options that you need to use everyday.

Task: To open rar (unpack) file in current directory type command:

$ unrar e file.rar

April 16, 2008

Installing Applications from Compressed Files

Filed under: linux, musings — gurudev @ 7:41 pm
Tags: ,

i v just copied and pasted from another site and is for reference

This question comes up frequently on the Linux_Newbies list. There are various commands that work, so if you’ve heard something different, and it works well for you, then use it. There are variations of commands that one person, such as myself, uses more out of habit than anything else.

RPMS are packages compressed using the RedHat Package Manager (ergo, R P M). Both KDE and Gnome have graphic interfaces for installing RPMS, however, some folks seem to have difficulty using them and of course, one feels more like a Linux ace if they install via command line.

I am only going to cover the RPM, tar.gz tar.bz2 and tar.Z formats here. Slack and Debian have their own formats–for example, with Slack, you can use installpkg, but any distro will work with tar.Z, tar.gz and tar.bz2 files. (NOTE: Sometimes tar.gz files have the extension .tgz and tar.bz2 files may have the extension .tbz. This comes from the days when there were more limitations on file name length and calling something .tar.gz already used up 5 characters.)

RPMS are the simplest. First get your RPM, either by downloading it, or perhaps, by using the distro’s CD. For example, the RedHat 7.1 CD includes a variety of packages in a directory on both CDs named RedHat/RPMS.

Many packages have to be installed as root. So, if you get permission problems in trying to install something, simply log in as root to do so.

We’ll use openssh as an example. I don’t know the current version number off the top of my head, but let’s say it’s 2.7-9. If installing from CD, it’s easiest to first change your working directory to the RPMS directory–otherwise, you’ll have to type the full path, which, in RH 7.1 would be /mnt/cdrom/RedHat/RPMS/openssh-2.7-9. In the following example, we change to the RPM directory on the CD and install. (I’m assuming you’ve already mounted the cdrom–if not, the command

mount /dev/cdrom

usually works.

cd /mnt/cdrom/RedHat/RPMS
ls openssh*

(this will give you the version number and let you know if you might need or want other related packages such as openssh-clients)

rpm -Uvh openssh-2.7-9

You will then get a message that it’s preparing, and see hash marks as the package installs. At the end, hopefully you see a message that it’s installed.

The above rpm command is my habit. U means upgrade–this way, if I already have an earlier version of the package, it will be upgraded. If I don’t have the package on my system, then it will simply be installed. v is for verbose, to give me any messages that might be helpful during installation and h stands for hash marks, giving me a visual indication of progress. I find this combination works best for me.

tar.gz and tar.bz2 files are installed slightly differently. First, I’ll assume that you’ve cd’d over to the directory where the tarball is. Again we’ll use openssh-2.7-9 and assume we have a package called openssh-2.7-9.tar.gz.

tar ztf

will list the contents of the tarball. Now, we’ll decompress and untar it. Note that tar commands usually don’t require the - in front of the options. (This might vary with your version of tar.) That is, you can do tar -zxvf or tar zxvf and either one will work.

tar zxvf openssh-2.7-9.tar.gz

You’ll see various things happening on your screen as the tarball is unpacked and unzipped. (A quick note on this–if there is nothing else in the current directory named openssh then you could simply use tar xzvf openssh* and lazily avoid typing out the version number).

If you now do

ls

you’ll see that you still have openssh-2.7-9.tar.gz and a new directory called openssh-2.7-9. (The flags we added did the following: The z decompressed, or unzipped, if you prefer, the file, the x then extracted its various parts. The v is for verbose, helpful if there are errors and f is for file.) If you now cd to the new directory and do ls, you’ll see a variety of files in there. One of them will be called README. It will give directions of how to install the package. (It may simply direct you to read another file called INSTALL that is often included.) So, to view README

less README

From there, each package is different. A typical sequence of commands might be (but DO NOT try this one without reading the README as other packages have totally different commands)

./configure
make
make install
make clean

If the file is a tar.bz2 rather than tar.gz the process is almost the same. However, instead of typing tar -zxvf filename.tar.gzyou would type

tar -jxvf filename.bz2

From there, the rest of the process is identical to installing a .tar.gz as mentioned above, beginning with the step of cd’ing to the newly created directory.

With some distributions of Linux, they’re using different versions of bunzip2 and this won’t work. You will get a message that j is an unknown option. If this happens, then try again with y.

tar yxvf filename.bz2.

One of these should work, but if neither does then

bunzip2 filename.bz2 && tar -xvf filename.tar

The bunzip2 command decompresses the file. The && means that if the command completed successfully, then perform the following command which in this case is the tar -xvf. (As mentioned above, extract the various parts of the file, with the verbose and file options).

So, once again using our openssh tarball, it’d be

bunzip2 openssh-2.7.9.tar.bz2 && tar -xvf openssh-2.7.9.tar

Lastly, though they’re becoming less common, is one with a .tar.Z extension. In this case use

uncompress filename.tar.Z && tar -xvf filename.tar

Once again, you’ll have a new directory of the filename without the .tar.Z extension. CD to the new directory and follow the instructions given above.

Note that there are also non-tarred files that are simply compressed. If you have a file called file.bz2 and do tar -jxvf on the file you’ll get an error message that it’s an inappropriate file type or the like. If the file is called file.bz2 rather than file.tar.bz2 then just decompress it with the appropriate program. If it’s a .bz2 file then

bunzip2 file.bz2

If it’s a file.gz then substitute gunzip for bunzip2 and if it’s just a .Z then the command is uncompress file.Z

From time to time, you might have to open a Microsoft .zip format file. There are zip and unzip utilities. In FreeBSD they’re in /usr/ports/archivers/zip and /usr/ports/archivers/unzip. I think that they both install the other as a dependency, but I wouldn’t swear to that. Most Linux distributions also have these two utilities available.

Lastly, you might need to know how to collect and compress the files. Lets say you have a bunch of great bash scripts that you want to send your friend as a tarball. They’re all in a directory called bashscripts. Again, there are various ways to do it (and some that might be simpler than this) but, like everyone else, I have my habits. So, we’re in the directory that houses the directory bashscripts. You’re going to tar it into a file called scripts.tar and then compress that file into a tar.bz2 file. (I haven’t compressed into a tar.Z in a long time–most distros have bzip2 and gzip, so the following should work)

tar -cf scripts.tar bashscripts && bzip2 scripts.tar

(If your browser broke that, it should be on one line)
If you’d wanted to make a tar.gz file instead you would substitute gzip for bzip2.

tar -cf scripts.tar—this gives the name of the new file, which consists of the files that you tarred together. bashscripts is obviously all the files in the directory bashscripts. && means that if the command completes successfully, go on to the following command. bzip2 compresses the file (as does gzip). When you’re done, you’ll find that you have a new file called scripts.tar.bz2 ( or scripts.tar.gz)

The other way to do it, at least with most versions of tar (check the man page to see if it’s supported) is to compress it as you’re tarring it. This can be done with the j y or z option. In FreeBSD, at least, one has to put the j before the cf or it doesn’t work, for example

tar -jcf scripts.tar bashscripts

If you do it the first way, tar -cf scripts.tar && bzip2 scripts.tar the .bz2 suffix is appended to the filename, so you would automatically have a file called scripts.tar.bz2. If you do it the second way, with -jcf then the file will be called whatever you chose to call it—in this case, scripts.tar. Doing a file scripts.tar will show that it is a bzipped file. You can manually add the bz2 suffix or call the file that in the original command, e.g.

tar -jcf scripts.tar.bz2 bashscripts

(This can also work with the -z option.)

That’s all there is to it. This should get you started.

Be-title

Filed under: Uncategorized — gurudev @ 7:39 pm

Kuch dino se [shayad kaafi dino se] I have not written much or anything of consequence but today is a new day [or night should I say] and by a happy coincidence I was presented with food for thought by a bunch of bloggers themselves .

I am not what you would call a regular “Geeky” blogger and even though the things I do in my daily life are classified by most as geeky I hate to write anything technical. I mean to say that my blog is a reflection of my personality . It is very easy to form a mental picture of what a person is like by looking at his writings . The purpose of writing a blog is to be able to put your thoughts down in writing.

March 24, 2008

Power from salt

Filed under: musings — gurudev @ 10:47 pm
Tags: , , , ,

Read an scientific article today which promised that we could one day generate power from salt . Now thats something new … I mean how easy and simple would it become if we were to generate power from such a source . Reading this article I could not help but notice a parallel in history.

I believe power was generated from salt way earlier , real , manifested , coercive power which brought an entire government to its knees . This power was produced from salt , one of the basic needs of life , which was used as a weapon to subdue an entire populace . I am talking of the SALT SATYAGRAH of 1930 .

February 24, 2008

Taking a sabbatical

Filed under: musings — gurudev @ 6:50 pm

I’ve been writing non-stop for some time now . I need to take a break for a few days .

February 19, 2008

Caught in the cycle of birth and re-birth

Filed under: musings — gurudev @ 11:23 pm

Why does man get so attached?? So much so that he’s afraid of change?? Why do all good things have to end??

What is the ultimate purpose of life?? What do I seek from life?? What is MY purpose ??? What is the reason of my being??

Some pertinent questions for which I have not yet found any satisfactory answer … Plus why did I start thinking on these lines for is it not that one must do his KARM without worrying about the outcome ?? But then again any work or action without purpose is useless , there’s got to be some justification [not those served up by William].. so here I am at a crossroad in life thinking about why I have done things in a certain way , trying to put things into perspective , trying hard and yet not succeeding…

February 17, 2008

Microsoft Test

Filed under: Bangalore, test — gurudev @ 4:25 pm
Tags: ,

well aaj test tha .. hame topics jo bataye gaye the were Data Structures , Algos , C/C++ but we were asked  questions from Operating Systems and DBMS as well.. proper type lagi … uspar se pehle paper me itna kam time diya gaya ki kya kahu ,… C?C++ ke liye half an hour … wat were they thinking when they decided on the timings … so raha tha koi pakka

well OS and DBMS ko maine revise bhi nahi kiya tha .. hadnt dreamt of those parts as possible topics par pooch diya gadho ne .. so kya karen test kisi tarah diya … ab room par biatha hoon blog likh raha hoon ..

In B’lore

Filed under: Bangalore, travels — gurudev @ 12:00 am
Tags: , ,

aaj subah B’lore pahucha … Chas came to pick me up .. these guys are living in a flat in Yelahanka … kal exam hai aur main ne ab tak kuch nahi padha hai …. koi asar bhi nahi lag rahe ki padhunga …. well timepass karne aaya tha , wahi kar raha hoon …. din bhar kuch khaas nahi kiya .. soya .. ek film dekhi … HITMAN … ab sone jane ka hai … kal subah test hai … hoping for the best .. well as always main ANANT ASHAWAADI HOON

February 15, 2008

NEXT Stop B’lore

Filed under: Bangalore, travels — gurudev @ 3:53 pm
Tags: , ,

Well today i’m going to B’lore.. reason is internship test of Microsoft [ officially thats the reason but the real reason is ghoomna].. hope that i have a gud journey … and a fulfilling visit…

I’ll stay with some of my friends from school .

center is SirMVIT , Yelahanka , which happens to be Chittu’s college too and is close by, from what Chas tells me , so all in all i’m set for the trip.

these MICROSOFT guys have unnecessary pangas .. ist stage is written , followed by 2 rounds of interviews .. looks like they are giving a job not an internship…well they have to do some nautanki don’t they …

Adventures of Goa

Filed under: Goa, travels — gurudev @ 1:30 am
Tags: , , , ,

Well Goa me adventures kuch nahi the ….. proper type hamara kata tha .Socha tha ghoomne ka par for some reasons [personified] we didn’t. Aaj mere dosto ne meri bahut li …aur saath Chacha bhi tha so all the more reason that people get to know from me rather than distorted facts from Chacha & Co. so here goes…

well for those of you who are wondering as to who this “Chacha” is .. well he’s a mythical creature who comes down to Earth to wreck , what shud i say , well things .. he’s said to be a male but that is something which is “questioned” by some , not all of whom are guys .

And the story:::

Well the reason i had gone to Goa was that I had a Paper Presentation at BITS Pilani , Goa Campus in their techfest QUARK 08. A major motivation for going to Goa was that nearly all of my college has been to that place yet i am one of those few who haven’t even though Goa is just 4 hrs from here. I had planned to visit places of interest , beaches , etc.

I have not had a very good experience of working with a team on a project , which is a different story , while my dear friend had not had such an experience till the journey to Goa . What happened there was a matter which I promised him not to disclose coz it would put a few people [ NOT ME] in a tight spot , so to speak . Even though he did not keep his word I intend to keep mine and so my lips are pursed , or shud i say my fingers are tied.

So during my presentation i met a team from ICFAI Tech , Hyderabad . they were a team of 3 , all girls , and no i did not fall for any on them [ told you don't jump the gun ].During the event I chatted with all 3 of them .

In the evening about 7 pm when the 4 of us [Subbu, Amey , Abhinav and myself ] were going for our dinner to Vasco ahead of us was a group of 3 girls . One of them suddenly turned around and said “are u guys following us??” .

this particular girl was so much like one of those ICFAI team .Abhinav’s reply was that we weren’t .

Now I don’t know what came on me but suddenly a said ” even if we are wats the problem !!”

And the girl was like ” And who are you ?”

I said that we had met during the paper presentation and then on looking at her more closely I realized the she wasn’t the girl I had thought she was .

Meri toh proper type phat gayi thi.I have never been so embarrassed in my life and that too in front of strangers and that too girls. I normally maintain a safe distance from them but then HONI KO KAUN TAAL SAKTA HAI. Proper type katwana yahi hai.

The girl , thankfully, didn’t take it too seriously …. I apologized as best as I could. She was quite cool thereafter [ sorry once again if u r reading this] and hope she doesn’t carry that kind of a bad impression about me .

Haan toh bhakto is se humne aaj kya seekha ???

yahi ki apni policy sahi hai …. ladkiyo se abhi door rehne ka kyoki apan door rehne ke liye hi baney hain …

Next Page »

Blog at WordPress.com.