linux on a pc
a howto by tubedeejay
chapter 3: trying linux in windows
#licensing: i, the copyright holder of this work, hereby release it into the public domain. this applies worldwide.
in case this is not legally possible:
i grant anyone the right to use this work for any purpose, without any conditions, unless such conditions are required by law.
#end of licensing
an important convention and exception to the above is that while it applies to my own work, the following documentation includes brief quotations from many other sources. all such quotations will be contained in quote marks "like this" and include attribution, or they will be noted in the credits for each entry. "fair use" is an important and complex issue, and i will not attempt to explain it here.
furthermore, it should be assumed that any image contained in this work is subject to copyright. it is common practice to include screenshots of software for educational purposes, but i do not wish to mislead you into thinking these images are in the public domain. how you use them is not up to me to decide or permit.
it is my hope that you are able to use, modify, and share this document in any way you see fit, for non-commercial or commercial purposes, in any way that is legally possible.
i do believe in copyleft, but there are times when i think eric s. raymond was right about the public domain. i benefit from the use of copyleft, (i am using a copylefted editor to write this,) and i have created material under copyleft, but many of my own works i like to contribute to the public domain, which naturally may be used in a copylefted work also.
chapter 3
trying linux in windows
finally, hands-on experience. the key is to remember that as you practice, things become clearer and more second-nature.
we'll start by downloading qemu, a tool for windows that allows you to run linux inside a window. it's actually a little more amazing than that. you can run lots of things in a window using qemu, including linux, dos, aros (it's like amiga,) several versions of windows, you could even write your own (but, you probably won't.)
also, qemu will run in several other environments. there is a version for linux (so we can run one distro within another...) and there are other versions, but one of the fun things about linux is its ability to run programs designed for microsoft windows. it isn't always the best experience, but wine (it lets you run windows programs) gets better with each version.
(mac users: you may be able to install the windows version of qemu and then run it from parallels, which is similar to both wine and qemu.)
the distros in this book do not include wine, but it can be installed with some ease in xubuntu and dsl. thanks to wine, i'll be using the same version of qemu i link you to, even in linux.
obviously i can't be responsible for what you do with qemu, it's not even something i authored, so i'm not responsible for what it does. i can tell you that it has a good reputation as a useful software tool, that you can read about it online, and that you ought to scan it for viruses anyway.
when you've decided to install qemu, go to this website for the windows version:
http://www1.interq.or.jp/~t-takeda/qemu/ and download the file from the link that says:
qemu on windows Ver 0.9.1
after opening the qemu file and copying everything into a new folder, open the folder and look for a file called qemu-win.bat (in windows it might only say "qemu-win" but that's the one.) open it, and it should scroll for a moment, then show you something like this:
but you just have no idea how boring that is until you try to find something interesting about it. download basiclinux as a single image file, from
this link (at ibiblio.org,) and unzip it to the same folder you put qemu in.
this time, right click on qemu-win and select "edit," (or if that's not an option, click start, run, type in: notepad and enter, then drag qemu-win into notepad.)
look for the part that says "-hda linux.img" and change that to "-hda BL3-5qemu.img" then save the file. open your qemu folder again and start it from the qemu-win file. press enter when it asks you to, you should see the linux prompt:
/<#>
yes, it's a little different again, but if you remember anything from the other chapters (that's ok) you know that # means you're super! (really, you are.)
note: any time you need to use qemu, click on qemu.
after clicking on qemu, use ctrl-alt to leave qemu.
and / means you're in the root directory, so:
/<#>find [enter]
will show you all the files...
and if you want to count them, simply pipe | the contents of find (it's the key that has a \ and a | on it on your keyboard, if you have trouble making a vertical bar in qemu, don't worry about it, just don't use commands that have a vertical bar for this chapter.) to wc:
/<#>find | wc
950 950 19470
the first number tells you there are 950 lines (one for each file) and the second number tells you how many words. (i use that in writing this book, although wc won't tell you "
how many pages?")
if there are eight words on this line,
and if there are nine words on this line,
you may notice both lines have spaces in them.
althoughthislinehasnospaces,
so wc would only count one word. 950 lines, 950 "words" suggests that none of the files have spaces in the names. (that's actually good practice for naming files in linux. people-often-use-dashes, or_underscores instead.)
19470 tells you how many bytes are in the information you just piped to wc. so if i were to:
/<#>cat mylinonpc03chapter | wc
just as i type this and save...
it tells me i've typed 5791 bytes (or about 5k.) that may change when i edit the chapter.
if you press tab twice, it asks what keywords (and files and folders) you can access from the current folder, and also those outside the current folder, including programs stored in the /usr/bin folder (such as wc.)
cal find md5sum rxvt unzip
calctool fold mgp sbin/ uptime
calctool.help free microcom sed usr/
cardmgr ftpput mkdir send uudecode
cat grep mke2fs send2mbox var/
chmod gunzip mknod seq watch
chown gzip mkswap setserial wc
chroot halt mnt/ setterm wget
clear hd/ more sh which
cmp head mount sleep whoami
compress home/ mv sort wp
cp hostname nc startx xargs
cut httpd nslookup startxt xcal
date id pidof strings xinit
dc ifconfig ping stty xli
dd init pkg swapoff xmodmap
dev/ insmod pmail swapon xset
df install-to-hd poweroff sync yes
dirname jwm ppp-off syslogd zcat
dmesg kill ppp-on tail zless
dos2unix killall pppd tar
du ldconfig pppsetup tee
e2fsck ldd printf telnet
e3pi length proc/ test
/<#>
and there's our friend wc. there are numerous hints on this list that it's not just text-only. jwm is our window manager, rxvt is a graphical console for xwindows, xset (as far as i know) implies that xwindows is installed, and xli is a simple image viewer.
don't worry if you don't know what everything is. i don't either (although i recognize many of them.)
this list has scrolled so there should be other items in the list. you can be specific in what you're looking for. use tab completion by typing a and hitting tab twice.
you'll only get ar, because that's the only item you can use right now that starts with a. there are more that start with b:
/<#>b [use the tab key twice]
badblocks bash boot/ busybox
basename bin/ bunzip2 bzcat
also try:
/<#>se
sed send send2mbox seq setserial setterm
it doesn't show the keywords we were looking for, so let's just this one from the bigger listing:
/<#>startx
now it wants to know what size monitor we have. since the "monitor" is the qemu window, we're going to assume you can fit a 800x600 window on your screen and select c (enter.)
the mouse options don't include your usb mouse, but again because we're in qemu, it can emulate a ps/2 mouse. select p (enter.)
how many buttons? actually if you're on a mac, i don't know how to right-click in qemu. ctrl + mouse-click possibly. whether you're on a mac or not, select 2 (enter.) and, voila:
by showing you basiclinux, i'm showing you the smallest distro i know of that includes the x windows graphical environment. that means it doesn't do much without adding extras, that means i'm misleading you into thinking linux always looks like this.
but even with much, much larger distros, you can run jwm (it will usually have nicer fonts than this) and many of the optional packages that are actually available for basiclinux.
most of the utilities in basiclinux are also available in other distros, so if you aren't yet familiar with a new distro, you can usually just look for the items that you know from basiclinux. there's more of a standard than you may think!
let's open rxvt first. in almost any graphical distro you can open aterm, rxvt, or xterm to get a command line. click anywhere on the screen (except the jwm tray at the bottom) and you will get the jwm menu. you can also click the "jwm" button on the tray. (in some distros, you must right click the desktop, but in basiclinux either left click or right click should access the menu.)
select xterm, and there is your command line again.
one of the oddest things about window managers in my opinion is the old convention that whatever window the mouse cursor is placed over, that's the window you're typing into. this dates back to before most of the people now using linux were using it, and most distros you'll try will not work this way unless you want them to- they will work more like you're use to in that whatever window you clicked on will be the one you type into.
until you learn how to edit the setting in basiclinux, (it's just one line of text) just make certain you click or keep the cursor over the window you're typing into.
right now we're going to change another setting. to change to the /etc folder, use cd:
/<#>cd /etc
/etc<#> cat xconfig:
cat: xconfig: No such file or directory
in linux, the files are case-sensitive. so we'll try again:
/etc<#> cat Xconfig:
800x600x15
2button
the closest thing to a friendly editor in this distro is e3pi (which is a miniature version of an editor called "pico," if you can believe that. e3nano would be so much better, alas...)
but we don't need it for a tiny, two line file. we'll write the two lines like this:
echo 1024x768x24 > Xconfig
echo 2button >> Xconfig
notice on the second line we used two "greater than" angle brackets. on the first line we write "1024x768x24" to the file named Xconfig, replacing the file with that line.
two brackets >> means "append" so it adds the line "2button" instead of replacing the first one.
admire your work:
/etc<#> cat Xconfig:
1024x768x24
2button
you've reconfigured basiclinux to do a resolution it didn't offer to you. sometimes this works. although in most distros, there is an easier way to change to a higher resolution.
if you open the jwm menu and select "exit," then select "ok" and enter "startx" at the command line again, it will open xwindows using these settings instead of asking you to do the setup again. (but don't, unless you want to use qemu in a 1024x768 size window.) you can use the same method you just used to change 1024x768x24 back to 800x600x15 (or 800x600x24.)
one of the extras for basiclinux is a graphical web browser, but since links is already included, let's learn how to use it. in rxvt, enter the keyword: links
use tab completion to extend "links" to "links-0.95" (no one wants to type that) and hit enter. no, it's not you, use the "g" key for "goto url" and type file:/// [enter]
in the upper right corner, ".." is highlighted. use your arrow keys to scroll down to root [enter to open,] then from /root/ scroll down to hotlist.html [enter to open,] and "basiclinux american site" will be highlighted. [enter again.]
if you are online in windows you will be able to access pages like this on the internet, from links in qemu.
only a moment ago, i explained how to create a file with two lines using echo and angle brackets. this is great for two lines, but it's not all that practical for doing more. there are times when you can redirect cat to a text file, then when you're done create a new line and ctrl-c, but that doesn't work in basiclinux and we can do better than that.
nonetheless, let's talk about options in linux. if you're looking for the power of microsoft word, try
openoffice.org (there's even a version for windows.) this is the firefox of word processors, designed to compete with the software you're already using.
for a lighter option more like wordpad, there's abiword, but i've never been able to truly recommend it. a lot of people say it's good, though that's not my experience. conceptually, however, it's the text program i'd like to use most. there will probably be a similar option in the future, created by someone who feels as i do about it. i sometimes compromise and use a wysiwyg html editor instead of abiword or the massive openoffice editor.
if the size does not bother you (if you're used to word, it probably won't,) then openoffice's editor is the best around. for people looking to replace (or upgrade) notepad, the options are more varied. this book has been written using such an option.
a lot of people that love the command line use the now infamous vi or emacs. both have a learning curve i don't want to subject you to, but there is a lite version of vi (named e3vi) included in basiclinux. there is also an editor based on pico, which is at least more friendly than e3vi, and i will show you how to use it.
for the command line, i'm very fond of both minimum profit ("mped" for apt-get users,) which also has a gui mode, and nano, which is more common than mp. both are friendly enough that i wish i could show them to you without installing extras.
but before i show you how to use the included text editor, or install another text editor in basiclinux, i'm going to show you how to use grep to remove a line from a file. doing it this way is kind of silly, but it could be useful, and besides it demonstrates things that linux can do. it's really only silly if being able to automate common tasks is silly. (then again for you, this may likely not be a common task.)
click the desktop and open an xterm (if you have links open, leave it open) and change to te /root folder:
/<#>cd /root
then type: cat .jwmrc [enter, and note the "." when typing]
if you typed it correctly, you should see quite a few lines scroll past you. you can see some of them if you hold down shift and press pgup and pgdn.
you can also try this: cat .jwmrc | less [enter. try ctrl-c or "q" to quit after moving up and down with the arrow keys.]
"less" is often unavailable, sometimes using "more" is useful: cat .jwmrc | more [enter. again, try ctrl-c or "q" to quit, spacebar or enter for more text.]
but if you know what you're looking for, it's easier to use grep:
~<#>cat .jwmrc | grep -i dns [enter]
<Program label="DNS config">rxvt +sb -g 60x10 -e e3pi /etc/resolv.conf</Program>
if this seems unreasonable, let's look at what's there. there are two program tags, <Program> and </Program> and the first one contains the "label" attribute. this is just like html, if you're familiar.
label="DNS config"
so that means create an entry in your jwm menu named: dns config. everything between the two tags tells jwm what to do: rxvt +sb -g 60x10 -e e3pi /etc/resolv.conf
if you type all that into xterm (don't, unless you really want to) it will do the same thing as selecting it from the menu. and if you look in your menu, you'll see the option: dns config (it's in the "edit settings" group.) and if you clicked on it, or typed all that into xterm, it's ctrl-x to quit (then "n," if it doesn't close.)
you already know what rxvt is, the options for rxvt are +sb -g (whatever that means,) 60x10 (what size to open rxvt as,) -e (tell rxvt to run something,) e3pi (the editor,) /etc/resolv.conf (the file to edit.) do you have to know this to use linux? thankfully, no.
but since we don't need to edit the dns settings, we're going to remove the option from the menu, we're going to edit the file just by using grep to search text.
the command: "cat .jwmrc | grep -i dns" simply looks for the text "dns" in the file .jwmrc, the -i tells it "case insensitive," so dns, DNS, and Dns will be found. by adding "v" we say "look for everything but..." and so:
cat .jwmrc | grep -iv dns
will show every line that does
not say "dns." (we already know that's every line except one.
then we can redirect it to a temporary file:
cat .jwmrc | grep -iv dns > jwm
that can be copied (using the "cp" command to copy) back to .jwmrc:
cp jwm .jwmrc [be certain to put a space between jwm and .jwmrc]
...now you've just removed a menu entry, like a real geek. click the jwm menu and "restart" to restart jwm. the menu entry for "dns config" will be gone.
delete the temporary file:
~<#>rm jwm
next to that, e3pi is friendly! first, make a backup of the file: (it's just a good idea)
~<#>cp .jwmrc jwmrc2
(if you need the backup: cd /root && cp jwmrc2 .jwmrc)
and type: e3pi .jwmrc [enter]
now you can edit your jwm settings by typing, using the arrow keys, backspace, and delete. when you're done, ctrl-x. (then if you want to save, "y" but if you don't want to save, "n.")
before you quit though, let's edit the clock. you can't remove it using grep, because to "remove" the clock you have to actually change its settings. (it's automatically on, whether you mention its settings or not!)
scroll down to the <Clock> tag, and change it to <Clock format=" "> so that the next time you start jwm, it won't display. (this is improved in later versions of jwm.)
if the window focus is still getting on your nerves, we can edit that right now. scroll down a little farther to where it says "focus model" and look for where it says "sloppy" between the two focusmodel tags. edit that to say "click" instead. ctrl-x, then "y" to save. from the jwm menu, select "restart." now your window focus is more like windows (and the other distros covered in this book.)
if windows is connected to the internet: open "browser" from the jwm menu. if links is not still open. "g" for goto url, enter file:/// and scroll down to "root," enter, then "hotlist.html," enter, basiclinux american site, enter.
only use the up and down arrow keys! left is "back" and right is the same as "enter," or the same as clicking on a link with the mouse in a graphical browser. you can even use search engines if you can stand browsing this way, but you may find it impossible to check webmail from a browser like links. most linux users will be using firefox.
you want the links that say "add-ons for bl3 are available here and here." it's under the text "additional components for basiclinux." highlight the first "here" by using the up and down arrows, then select it with enter. you will notice that installing abiword is an option. since there are no other editors listed, and since the version of abiword in basiclinux is okay for demonstrating addons, hightlight it with up and down keys, then enter.
when it asks, save. be sure to save it to /abiword.tgz, with the "/" and use tab to change to [ok] before hitting [enter] again. you may have to try more than once. it's not installed yet, download another package if you want to, then quit links with "q." open an xterm if one isn't open, and: cd / [enter] then use ls to list the files there:
/<#>ls [enter]
it should list abiword.tgz and a lot of folders. if not, decide if you want to try again. if it's there:
/<#>pkg abi[tab to complete, then enter.]
you've installed abiword. to open it:
/<#>abiword &exit
to close abiword, ctrl-q.
to quit jwm, use the menu and "exit."
to properly shutdown (this is recommended,) quit jwm then use the command:
/<#>poweroff
wait until it says "power down." then close qemu.
you have now experienced linux! remember that basiclinux can be extremely limited, and that not every distro is designed to be ready to use. many experienced and novice users prefer to customize their distro, rather than have it customized for them. obviously, the point of distros is they are different, but you can customise them as well, and some are made more to be used as-is, others made more to be customized. basic linux is made to run from floppies.
in the next chapters, we'll show you the other distros (that are made to run from cd,) how you can use them, and if you like, how to get your own copy.
You need to be a member of MIX to add comments!
Join this social network