Wednesday, February 6, 2013

How to count duplicate the lines of a file by using Linux Shell Programming?

Q. Hi,

I'm new to linux and to shell programming. I have an assignment to create a shell script that shows all the folders, sub folders and files of the current directory. LS does this. But I must count how many duplicate lines each file has, and show the line that is repeated the most times in each file.

I really have no idea where to start. How can I read/compare lines within a file?

Thanks in advance!

A. grep . anyFile | sort | uniq | wc
grep . anyFile | sort | wc

If a line is repeated, the output of the top grep code will be less than the bottom one.

How do I download a version of Linux without deleting my windows xp?
Q. I want to download a version of Linux without erasing windows xp. Can someone please give me step-by-step information on how to do this.(If you are familiar with Linux could you please recommed the best version). Thanks.

A. Options to try Linux:

(1) Download what's called a "Live CD". That's a bootable CD which contains the Linux of your choice set up so that it runs directly off the CD and doesn't change your hard drive at all.
* pro: Easiest option to try it out and install it.
* con: Can be slow to boot and run, so if you want to experiment with Linux for days or weeks you might find using a Live CD tedious. Usually can't save anything because you can't write to the hard drive.

(2) Make your system dual-boot. Most Linux distributions allow you to split your hard drive by shrinking the space devoted to your "C:" drive and install Linux in the free space.
* pro: Get the best performance, as you're running directly on the hardware and reading and writing to a hard drive instead of a CD.
* con: Requires a permanent change to your hard disk and a modification of your Windows partition, introducting the possibility of a failure or glitch in this process ruining your Windows partition (I suggest you back up your drive or at least important files when you do this). Also, normally the Windows partition is invisible to Linux and vice versa (though there are tools to remedy this to varying degrees). If you switch a lot between OS'es, can be time consuming to reboot all the time.
* when it's best: Best option when you've decided to use Linux long term and it's the best performer. Also best if you plan to use the computer intensively and for long periods of time.


(3) Use an emulator. One is vmware, but you can find other options. Generally, emulators are programs that emulate a whole x86 computer in software. However, installing directly to your hard drive, you create a file that the emulator uses as a virtual hard disk and install onto that.
* pro: Requires no hardware changes. Can run both OS'es concurrently, so you can do things like cut and paste between the two systems, or even use networking. A good compromise between Live CD's in that it's faster than a live CD, slower than running directly on the hardware.
* con: Can be slower than running than on the native hardware. Some devices may not work properly running under emulation.
* when it's best: This option works best for folks who wish to use Windows mostly and Linux lightly, switching between the two, as the switching effort is next to none. Also best for short-term trials of one or more Linux distributions, as setting up different VM's is very easy.

(4) Loadlin is a system to let you install and run Linux on top of a FAT16 or FAT32 partition (default for Windows 98 and earlier; NTFS is default for NT, XP and later). Technically, you're dual booting and have to reboot to switch OS'es, but you don't need to repartition your drive:
* pro: Avoids the need to repartition
* con: Not an option for most people running XP, unless their drive is already formatted for FAT32.

As for favorite distribution, my current favorite is called "Ubuntu", derived from Debian (see link below). Debian is one of the best distributions but can be a complicated and intimidating setup for someone new to Linux. Ubuntu is a commercially supported derivative with a GUI installer, a friendly and powerful repartitioner, lots of popular and useful utilities built-in, and huge free online repositories available with even more software which can be installed automatically from a friendly GUI-based program.

Others are:

* Fedora Core, based on Red Hat Linux. Perhaps the most widely known and popular distribution in my experience. Broad support in terms of hardware and many programs both free and commercial are built to run on Red Hat, everything from Oracle Databases to freeware media players. Also offers an online package installation system like Debian and Ubuntu, which goes by the name of "yum" (never used it myself though).

* Slackware: A favorite of many Linux veterans. While it lacks the flashiness of more recent entrants like Red Hat, has a reputation for being a solid Linux distribution. In my experience I love setting up servers under slackware because I've had Slackware boxes run longer without crashing than anything else. Many Linux experts like it because of the simplicity with which one can configure it from the command line. However, as it's supported by a very small crew it evolves more slowly than others. An advantage or liability depending upon your point of view.

For others, shop around by visiting DistroWatch. There are many more options, too many to list. Everything from full-featured distributions which have every program under the sun to highly specialized distributions for everything from building parallel compute clusters (Parallel Knoppix, scientific Linux) to building video player boxes (GeexBox)

All the best, and have fun!!

How can I access to an internet connection on linux using the wireless?
Q. I want to access to a wireless connection in a PC with linux (ubuntu 10.04). But I can't find any connection. Lately I realized that the wireless light on my computer (fujitsu Siemens) is turned off. How can I turn it on and access to an internet connection by wireless.

A. Weeks after weeks ppl keep asking this question. The answer is because you are using a free linux that mostly relies on opensource technology and insanely restrictive laws in the USA do not allow to integrate proprietary drivers in open source technology.

Ubuntu is a cute little linux but a nightmare for ppl using wifi, forget about installing the drivers yourself unless you are a programmer. Solution? use a top notch linux like Mandriva Power pack or SUSE linux entreprise they cost money but u pay for windows don t u?

You could always try your luck with linux miint it contains some proprietary drivers but has many bugs we found and translation of many applications in English or other languages is not always proper.

RICK



Nec Projector Review

Plastic Shed Reviews

Ati Graphic Reviews

Nurse Uniforms Reviews

Cabochons Reviews

Inflatable Water Slides Reviews

Barcode Scanner Reviews

No comments:

Post a Comment