Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, January 25, 2007

Important Linux Directories

There are many variants of Linux used in different computer systems today. Luckily, most Linux developers employ a common naming and utilization scheme that makes different variants of Linux easy to use and maintain. This article will discuss some important and common directories in many popular Linux distributions.

/home
Each user of a Linux system is assigned a special directory, called "home" direectory, that represents their private space on the system. For example, if a user of the system is called tom, the home directory of tom will be /home/tom. Tom has the right to create any files and directories under his home directory. This is also the default location when tom logs into the system.

/root
This is the home directory of the adminstrator or super user.

/tmp
In addition to personal hard disk space in the home directories, users are also given special access to shared temporary space in the /tmp directory. Linux systems often implement quotas on user accounts to prevent anyone from using too much disk space. The /tmp directory allows all users access to additional space to meet short term needs without charging the space against their quota. All files placed in this directory are deleted automatically after a few days.

/etc
This directory stores all the configuration files needed for the operating system. For example, startup configuration scripts are found in /etc/rc.d and network configuration scripts are found in /etc/sysconfig. Normal users cannot modify the files in /etc.

/bin and /usr/bin
Most system commands are stored as binary files only in machine readable format. Commands appropriate for use by ordinary users are either placed in the /bin or /usr/bin directory. Core commands like rm, mv, ls, cd go into /bin while supplementary utilities like compilers, firefox browser and openoffice go into /usr/bin.

/sbin and /usr/sbin
Like /bin and /usr/bin, /sbin and /usr/sbin store commands to be used only by the super user, ie root user. These include commands for attaching and removing hardware, starting and stopping the system...etc.

/var
This directory stores all the frequently changed files in the system. For example, incoming, outgoing mails, system logs, websites, ftp file archives...etc. very

Conlcusion
There are only a few directories to know to really start using Linux. If you understand what the main directories are, then exploring the sub-direectories becomes much easier. If you are lost while navigating the directories, always use "cd /" to return back the the root, "cd .." to go up one level or use "pwd" to find out where you are. Another command "which xxx" tells you where certain commands are located.

About the Author
Bernard Peh is a great passioner of web technologies and one of the co-founders of Sitecritic.net Site Reviews. He works with experienced web designers and developers for more than 5 years, developing and designing commercial and non-commercial websites. During his free time, he does website reviews, freelance SEO and PHP work.

Wednesday, January 03, 2007

Using Linux and Windows with Vmware


Learn how to download and use VMware software, which allows you to use both Linux and Windows operating systems on your computer simultaneously with no reboot.

Wednesday, December 27, 2006

Photoshop on Linux

Can you run Adobe Photoshop on Linux?

Many Web designers, graphic artists and bloggers might consider the answer to this question crucial when considering a shift from Windows.

After all, while there are many excellent open-source alternatives to common office and multimedia applications, the defacto graphics program on Linux, the unfortunately-named Gimp, hobbles a generation or two behind the market-leading Photoshop, which is available only for Windows and Mac OS X.

Years of speculation and wishful thinking have not yielded a Linux version from Adobe, nor does one look likely to come anytime soon.

As they are often wont to do, users have taken matters into their own hands, using free and open-source software called Wine to run Windows programs – including Photoshop – in Linux.

A group of hackers began the Wine project in 1993 as a way to run Windows 3.1 programs on Linux. Over the years, Wine has been expanded to include programs running under later versions of Windows, including 95, 98, 2000 and XP.

Wine, short for “Wine Is Not an Emulator,” is software that translates Windows commands into their equivalent in Linux or Unix.

While the project is more than a decade old, Wine is still under testing, with the latest beta version being 0.9.18.

“Wine is still under development, and it is not yet suitable for general use,” the official Web site (http://www.winehq.com) says. “Nevertheless, many people find it useful in running a growing number of Windows programs.”

Intrigued by the possibilities, I did some research and found a 2003 article in eWeek about how Walt Disney’s animation unit and two other competing studios jointly funded a project with CodeWeavers, the leading corporate backer of Wine, to develop a solution that would allow them to run Photoshop on Linux.

The project cost Disney less than $15,000, but saved it more than $50,000 a year in Windows licenses, eWeek reported. At the same time, CodeWeavers was able to incorporate the technology into Wine and its commercial version, CrossOver Office.

A quick check with the Wine Web site showed that Photoshop was indeed among the 4,398 Windows applications that would run under Wine.

Setting up Wine and using it isn’t rocket science, but it’s probably complicated enough to intimidate the typical Windows user.

I downloaded Wine (using the Synaptic Package Manager in Ubuntu Linux) then configured it by using the winecfg utility (type “winecfg” in the Terminal command line). Doing this the first time creates a fake “Drive C” in the hidden .wine directory of your home folder. This is where Wine installs all Windows programs.

To install a Windows program, pop in the install CD and type this into the command line:

wine /media/cdrom0/setup.exe

The Windows installer will come up and install the program. Theoretically, to run the program, you’d type the following:

wine “C:Program FilesAdobePhotoshop 7.0Photoshop.exe”

Sadly, this did not work. Further research showed I needed to tell Wine which dynamic link library or DLL file to use. This line from an Ubuntu forum does the job:

WINEDLLOVERRIDES=wintab32=n wine “C:Program FilesAdobePhotoshop 7.0Photoshop.exe”

To save myself some typing, I created a script that executes the command when I click on an icon.

So how does running Photoshop in Linux measure up?

In general, I was pleasantly surprised by the program’s responsiveness. There was none of the sluggishness that I expected and most of the features I use heavily work.

There are some major caveats, however.

  1. Right-click menus do not work. In fact, they can lock up the program. This is a pain, because I’m used to right-clicking on items in the Layers palette to manipulate them. Fortunately, there is a work-around for this, using the menu bar at the top of the window.
  2. Resizing the Layers palette will also crash the program.
  3. Alt-clicking on an area does not work for the Clone tool. Instead, you must hold down the Shift key while doing the Alt-click.
  4. The Tools and other palettes will remain on screen even when you minimize Photoshop.

These are pretty serious problems because you could lose a lot of work. On the other hand, if you’re careful to avoid these pitfalls and save your work periodically, you ought to be able to run Photoshop productively under Linux.

From Digital Life by Chin Wong
http://www.chinwong.com
Chin Wong has been covering the technology industry since the 1980s, starting as a reporter for Business Day, Southeast Asia's first daily business newspaper. He is now a lecturer in journalism at the Ateneo de Manila University in the Philippines and associate editor for the Manila Standard Today. Before that, he also served as technology editor of the Manila Times until October 2004.

Wednesday, December 06, 2006

Running Windows Applications on Linux

The perceived inability to run windows applications on Linux is what keeps many individuals from trying Linux. It turns out that it is possible to run many popular Windows applications on Linux PCs using one of several software technologies. Products that will allow Windows applications to run on Linux include:

  • Cedega from TransGaming Technologies Inc.
  • CrossOver Office for Linux from CodeWeavers Inc.
  • QEMU from Fabrice Bellard
  • VMware from VMware, an EMC company
  • Win4Lin from Win4Lin Inc.
  • Wine from the Wine Project
Cedega
TransGaming Technologies bills themselves as "the global leader in the development of software portability products for cross-platform gaming". Their flagship product, Cedega, allows games originally created for Windows to run on Linux, "out-of-the-box".

Cedega runs on Linux Kernel 2.4 or higher.

Cedega is available on a subscription basis from the TransGaming web site (http://www.transgaming.com/). TransGaming also offers a 14-day trial of Cedega on their web site.

CrossOver Office
CrossOver Office from CodeWeavers allows many popular Windows applications to run on Linux. The list of applications that CrossOver Office allows to run on Linux is quite extensive and includes applications such as: Microsoft Office, Lotus Notes, Microsoft Project and Visio, and graphics applications such as Macromedia Dreamweaver MX, Flash MX, and Adobe Photoshop, and much more. CrossOver Office also allows individuals to use many Windows Web browser plugins, such as QuickTime and Shockwave. CodeWeavers uses Wine technology in its CrossOver Office Products (see the Wine description later in this article).

CodeWeavers maintains an extensive list of applications that can run on Linux using CrossOver Office with a ranking of how well they run. The list can be accessed on their web site (http://www.codeweavers.com/compatibility/browse/name).

CrossOver Office has been tested on many Linux distributions. The complete list may be found on the CodeWeavers web site.

CrossOver Office is available in two versions, Standard and Professional. The Standard version is intended for home users and Linux enthusiasts, while Professional is more for commercial users and builds on the functionality of Standard by adding enhanced deployability features, as well as the ability to run CrossOver Office in shared mode from a single machine.

A 30-day trial of CrossOver Office is available from CodeWeavers and may be obtained from their web site (http://www.codeweavers.com/).

QEMU
QEMU is a generic open source processor emulator that was developed by Fabrice Bellard. It is available for free. QEMU allows a user to run one operating system, such as Windows, within another one, such as Linux.

QEMU is available for Free and may be downloaded from Fabrice's web site (http://fabrice.bellard.free.fr/qemu/download.html).


VMware
VMware comes from VMware, Inc., an EMC company. VMware allows users to to run multiple virtual machines on a single PC. Each virtual machine can run a different operating system. The net result is that VMWare allows a user to run multiple operating systems on a single Intel-based PC. Using VMware, a user can run a Windows virtual machine and Windows applications on a Linux PC.

VMware Workstation supports a long list of Linux distributions as the host operating system. You should check with the VMware web site for the specific releases and kernel levels supported.

A free 30-day trial of VMware Workstation may be downloaded from the VMWare web site (http://www.vmware.com/download/ws/eval.html).

VMware also provides the VMware Player for free. The VMware Player can run virtual machines created by VMware Workstation, GSX Server or ESX Server. Pre-configured VMware virtual machines may be obtained from the VMWare Virtual Machine Center (http://www.vmware.com/vmtn/vm/).

Win4Lin
Win4Lin from Win4Lin Inc. provides a Windows virtual computing environment that runs on Linux allowing Windows applications to run on Linux. Win4Lin comes in three versions that would be appropriate for the home user:

  • Win4Lin Home, which is targeted for the home or small business user.
  • Win4Lin 9x (Formerly Win4Lin 5), which is targeted for the home user/hobbyist, or business users who do not require Windows 2000.
  • Win4Lin Pro, which is targeted at power users who require Windows 2000 or XP.
Win4Lin runs on most 2.4.x or 2.6.x Linux distributions. Win4Lin 9x and Win4Lin Home require a modified kernel to work. For most users, the Win4Lin graphical installer will select, download, and install the appropriate binary replacement kernel, making patching the kernel unnecessary. However, there are some distributions that may require users to compile a vanilla kernel from source. Such distributions include Red Hat Enterprise Linux 3 and 4, and Fedora Core 3 and 4. Some Linux distributions include Win4Lin support in their default kernel or make a Win4Lin enabled kernel available, including: Gentoo, Linspire, SimplyMepis, and Xandros. Win4Lin Pro does not require kernel modification.

Wine
Wine, which stands for Wine Is Not a (CPU) Emulator, is an Open Source implementation of the Windows API (application programming interface) that runs on Linux and POSIX compatible operating systems. Wine is a compatibility layer that allows Windows programs to run on Linux. Wine is still under development, and it is not yet suitable for general use, however, many individuals use Wine to run Windows applications on Linux. WineHQ maintains an Application Database (http://www.winehq.com/site/about) of individual's success and failure reports running Windows applications with Wine. Other products mentioned in this article are based on Wine, including CodeWeavers CrossOver Office, and Cedega from TransGaming Technologies. Wine is Available for Free.

About the Author
Rob Pirozzi is a freelance writer who provides timely, quality professional writing of all types. He is also the publisher of the web site Low-Cost-Computing.com which provides information on low-cost computers and low-cost or free software for the average home or small business computer user.

    Tuesday, November 28, 2006

    Mounting A USB Flash Drive At The Linux Command Line

    In this video tutorial, learn how to mount a USB flash drive at the Linux command line.

    Saturday, November 18, 2006

    Key Factors to Find Resource BottleNeck in Linux Server Overloading

    It's very common, despite of the affordable hardware, to have load issues on the server. There can be a number of reasons for high load on the server such as, inadequate RAM/CPU, slower hard disk drives, or just unoptimized software. This article will help you identify what's the bottleneck and where do you need to invest on. Please, however, do not take it as a replacement of professional advice/service. You should always seek professional service if you can afford the costs associated.

    I) First of all, are you really in trouble?

    Usually people look for load in control panels, using "uptime" or "top" command. You can probably execute the "uptime" command in your root shell to find out what's the load, but I would like you to use "top" for the moment (pretty please). This will help you identify how many CPUs are being reported*. You should be able to see something like cpu00, cpu01, etc. A load of ~1 for each cpu is reasonable. For example, you're fine if the load's 3.50 and you have 4 CPUs.

    Another thing to consider while looking at the load via uptime or top, is to understand what it shows. For instance: (on a 2HT cpus server, reported as 4)

    18:30:55 up 17 days, 5:17, 2 users, load average: 4.76, 2.97, 2.62

    The first part (3.76) shows the load average in the last 5 mins, while the second (2.97) and third (2.62) shows averages of 10 and 15 mins respectively. It's probably a spike here which I wouldn't be too worried about (a bit carefree?), but if you are, then just read on!

    Pretty happy about how you were able to identify that your server is really overloaded? Sorry to hear that, but you never know because sometimes servers are able to handle much more load than the load shown. The load averages aren't so accurate afterall and cannot always be the ultimate deciding factor. Confused? It was just some technical information you don't need to be so bothered about. Move ahead if your loads are something to worry over.

    * note the usage of term "reported". I have used this term because a P4 CPU having HT technology will be reported as 2 even if you know your server has one CPU.

    II) Where's the problem?

    To identify the problem, you need to run a series of logical tests (Ok, it isn't as scary as it may sound). All you need is some free time, probably 30-45 mins, and root access to your server (expect no magic ;)). Ready to start? Let's go!

    Note: Perform the checks multiple times, to reach a fine conclusion.

    1. Check for RAM (most common bottleneck!).

    # free -m

    The output should look similar to this:

    # free -m

    total used free shared buffers cached Mem: 1963 1912 50 0 28 906 -/+ buffers/cache: 978 985 Swap: 1027 157 869

    Any reaction like, "Ohh Gosh, almost all the RAM is used up."? Don't panic. Have a look at the buffers/cache that says "985" mb of RAM is still free in buffers. As long as you have enough memory in the buffers, and your server isnt't using much swap, you're pretty fine on RAM. Your server starts to use SWAP (much like Pagefile), which is part of your disk mapped as memory but it is comparatively very slow and can furthur slower down your system if you have a busy hard disk (which I doubt you wouldn't if you're using so much RAM). In short, at least 175mb available in buffers and no more than 200mb swap.

    If RAM is the issue, you should probably look into optimizations on your PHP/Perl scripts, MySQL queries + server, and Apache.

    2. Check if I/O (input/output) usage is excessive

    If there are too many read/write requests on a single hard disk drive, it will become slow and you'll have to upgrade it to a faster drive (with more RPM and cache). The alternate option to a single faster drive is splitting the load onto multiple drives by spreading the most request content onto multiple drives, which can be easily accomplished using "symlinks" (soft links to files/folders). To identify, if your I/O issue is making your server lag:

    # top

    Read the output under "iowait" section, for each CPU. In ideal situations, it should be near to 0%. If you do however are scrutinizing at time of a load spike, consider rechecking these values multiple times to reach a fine conclusion. Anything above 15% is worrysome. Next, you can check the speed of your hard disk drive to see if it's really lagging:

    If you do know your hard disk exists on /dev/sda or /dev/hda, just perform the following. Or execute "df -h" command to check which is the drive that your data resides on.

    # hdparm -Tt /dev/sda

    The output:

    /dev/sda:

    Timing cached reads: 1484 MB in 2.01 seconds = 739.00 MB/sec

    Timing buffered disk reads: 62 MB in 3.00 seconds = 20.66 MB/sec


    It was awesome at the buffer-cache reads, most probably because of the disk's onboard cache, however, buffered disk reads is just at 20.66 MB / sec. Anything below 25MB is something you should worry about.

    3. CPU power is all consumed?

    # top

    Check the top output to find out if you're using too much CPU power. You should be looking the value under idle besides each CPU entry. Anything below 45% is something you should really worry about.

    III) Problem identified, What's the solution?

    To wrap it up, let me offer a few solutions for each problem:

    A global solution to all problems is to optimize MySQL, and Webserver including PHP/Perl scripts and queries. Or the least you can do is to optimize Apache and MySQL server parameters to perform better.

    1. Too much CPU usage

    In "ps -auxf" or "top" look for processes that use too much CPU. If it's HTTP or MySQL, you better optimize your scripts and queries, if possible. In most cases, it's extremely difficult to optimize all the scripts and queries and a better option is to just go for a CPU change/upgrade. A dual CPU should perform better, but what kind of upgrade you're looking for depends on your current CPU.

    2. RAM's all exhausted

    It's like you're in the same kind of situation as the CPU one. Optimize HTTP, MySQL, scripts etc. or go for a RAM upgrade. You may install Opcode cache softwares like APC (from Pear) for PHP to make it perform better while decreasing the load.

    3. Disk's all used (eh, I don't mean space)

    Here you either have to go for a faster disk like SATA over normal IDE or SCSI over SATA. Well, I was just speaking generally. You have consider factors like RPM and cache to end up going for an upgrad that's worth it. The second option is to get multiple drives of the same class and spread the load across drives. One common methodology is to serve MySQL from a second drive.

    IV) Conclusion

    That wasn't of much help? My article might be flawed, ahh, excuse me. It's my first article and this thing really consumed quite a few braincells of mine. That's a bit personal isn't it? Let's get back to business.

    FYI, In the example, the problem was with the I/O usage and hard disk getting slow.

    A guide can never be complete in itself or offer you everything you will need to reach upto expert level (you need to keep learning to reach that level). Whenever in doubt, please DO hire experts to look over your server. Somehow, if you don't have the money to spend, you're stil safe! You can head to our Server optimization help section to get help with your server optimization.

    About the Author
    Asad Niazi is a Linux system administrator, and a web developer having expertise in SEO, PHP, and linux server optimization. To get help with server optimization, visit Linux Server Optimization and Help at SpiceFuse. Discuss this article online at the official Server Overloading Explained.

    Friday, November 17, 2006

    Ubuntu Linux / Windows Dual Boot Instructional Video

    The WVU chapter of the ACM presents an instructional video on installing a dual-boot system using Windows XP and Ubuntu Linux. The video ... all » details the entire process, from partitioning the harddrive to walking through the install procedure. This video was made for the WVU ACMs Linuxfest / Installfest that occurred October 26th, 2005.

    Wednesday, November 15, 2006

    File Permissions in Linux

    Linux operating system uses a permissions schema to define user rights for each file. These permissions establish:

    • who can read the file. If the file is a directory, read means list the contents of the directory.
    • who can write/modify the file. If the file is a directory, this permission defines if you can make any changes to the directory contents, for example create or delete files.
    • who can execute the file. If the file is a directory, this permission defines if you can enter the directory and access its contents, for example run a search in the directory or execute a program in it.

    Permissions are assigned to the file owner, to the file owner group, and to all users. For example, you can set a document to be readable and writable by the owner only, and just readable by everybody else.

    When you issue an ls –l command, to list all contents of a directory, you will see file permissions like this next to each file:

    -rwxrwxrwx

    This means this file can be read, written and executed by anybody. The first dash means this file is not a directory. For directories, there will be a d letter instead of a dash.

    The first set of “rwx” refers to the file owner. The second set, to the owner group. The last set, to all other users. Let’s look at some examples:

    rwxr--r--

    This file can be read, written and executed by its owner. It can only be read by other users. When a permission is not set, you see a dash in its place.

    -rw-rw-r--

    This file can be read and written by its owner and the owner group. It can only be read by other users.

    You can set these permissions using the chmod command. For example, this command:

    chmod ugo=rwx filename

    assigns read, write and execute permissions to file owner user(u), group(g) and others (o). This other example:

    chmod ug=rw,o=r filename

    assigns read and write permissions to user and group, and only read permission to others.
    Permissions can also be expressed and set using the octal numeric system. Each permission is associated to a number:

    Read = 4 Write = 2 Execute = 1

    You need to come up with a number for the file owner, another number for the group and a last one for the other users. If you want to assign read, write and execute permissions to file owner, you add up the three values, thus getting a 7. If you want to assign same permissions to group and others, you come up with three sevens. You can set these permissions like this:

    chmod 777 filename

    If you set permissions for a file with the following command:

    chmod 764 filename

    then you’re establishing these permissions: read, write and execute for file owner (4+2+1=7), read and write for group (4+2=6) and only read for others (4).

    The following commands are equivalent:

    chmod ug=rw,o=r filename
    chmod 664 filename

    The file permissions schema lets you implement security policies. It is not a good idea to set file permissions high (e.g.: 777) for all files. It is important to think about it and assign the right permissions to the files, so users can do their job, and we are sure each file is accessed only by the right people.

    About the Author
    Sergio Roth is an experienced freelance web programmer. You can contact him for Linux hosting and website development services at http://www.ayreshost.com.