Saturday, July 12, 2008

Essenstial skills:navigating the terminal

The standard terminal on Ubuntu is Gnome Terminal which can be found in Applications → Accessories → Terminal. A terminal is in a way very similar to a file manager in that it's always inside a specific folder and is able to navigate to other folders and do regular file management. By default it will be inside your home folder when you run it. To confirm that your terminal is indeed browsing your home folder, type pwd ending with a press on enter. The pwd command will output the path to the current folder.

To see a list of files and directories inside the current directory, run the command ls. If you want to navigate up the directory tree run cd ... If you want to navigate down the directory tree run cd NAME where NAME is the name of the folder you want to navigate to. Example: if Tom is inside his home folder and there's a directory called test inside it, he will run cd test to change directory. If he wants to go back he can run cd ... If he ever gets lost he can run cd by itself; this will take him back to his home folder.

--------------------------------------

Cursor Movement

You can navigate with the cursor using the same keystrokes as you would use in Emacs. A few examples:

C means the "Ctrl" key. M means the "Alt" key (meta key). Often the Ctrl key will act on one character (or smaller unit) and the Meta key (Alt) will act on one word (or larger unit).

  • C-f — Forward one character.
  • C-b — Backwards one character.
  • M-f — Forward one word.
  • M-b — Backwards one word.
  • C-a — Move to the beginning of the line.
  • C-e — Move to the end of the line.
  • C-d — Delete one character.
  • M-d — Delete one word.

You can also highlight text and use Ctrl-Shift-c to copy, and Ctrl-Shift v to paste (at least in GNOME Terminal in Ubuntu).

Scrolling the Terminal

To scroll the terminal text, use Shift-PageUp and Shift-PageDown. In GNOME terminal you can also use the mouse wheel to scroll.

Terminal History

Your computer stores a history of commands that you type. You can use the up arrow key or down arrow key to navigate through your history.

You can view your history by typing history in the terminal.

You can search for a previously typed command by using the key combination C-r (which means "reverse search" in Emacs).

You can also use grep to find previously typed commands like this: history | grep "search words here"


Excellent tutorial here:

http://ubuntuforums.org/showthread.php?t=73885

Friday, July 11, 2008

Graphical Bootloader



If you don't want to change you Master Boot Record and have a floppy drive, you can use the the GAG bootloader.
Also very handy if you want very extended boot possibilities:
http://gag.sourceforge.net/

How to reboot or shut when Linux system freezes?

After I press ctrl alt F2 and it drops me into the manual login.
Alternately you can use Ctrl+Alt+Backspace to restart X and return to the login screen.
Carrying on with Ctrl+Alt+F2 method, just login to the VT session and type in
Code:
sudo killall appname
Then return to your X session (Ctrl+Alt+F7), then continue with your duties.



Another alternative is to restart X (the graphical interface). When X freezes, simply push ctrl-alt-backspace. This will restart X without restarting the computer, then you can login again. Be aware though that you lose any unsaved data in any open applications.

If ctrl-alt-backspace won't do anything you can use a terminal (getting to it as you described) and then after login issuing

Code:
sudo /etc/init.d/gdm restart
If that doesn't do the trick either (which is rare) you can raise a skinny elephant. It's a silly name for a simple meme.

Hold down alt + SysRQ (often also labeled Print Screen) and press the following keys in order:

R - raising (switches keyboard from raw mode)
S - skinny (sync all mounted filesystems)
E - elephants (shuts down all processes except init)
I - is (terminates all processes except init)
U - utterly (remounts all filesystems in read-only mode)
B - boring (immediately reboots the system)

This is for when nothing else works.

Other description:

Should your system completely lock up, and you need to do a hard reboot - do this instead. It works by sending signals directly to the linux kernel, to unmount all partitions, kill processes, etc, relatively safely:

Holding ALT, tap [sys rq], r, e, i, s, u, b.

Wait a couple seconds between each of the letters to ensure it finishes the operations before starting the next. ‘b’ causes a reboot, so no need to touch the power button. On laptops like mine, you may need to hold the [fn] button while hitting [sys rq] - don’t hold it for any other buttons.


//////////////////////\\\\\\\\\\\\\\\\\\\\

Shutting down from the terminal:
Code:
sudo init 0

source: http://ubuntuforums.org/showthread.php?t=851434

Wht is the SysRq key?
source: http://en.wikipedia.org/wiki/Magic_SysRq_key

Keyboard shortcut (compare to Ctrl+Alt+Del in Windows):
Shut of the system: Alt + SysRq + o
Reboot the system: Alt + SysRq + b
SysRq is on my keyboard the same key as Prt Scr (Print Screen).

Thursday, July 10, 2008

Supergrub makes Grub a supertool

Supergrub ( http://www.supergrubdisk.org/index.php ) is the ideal tool for managing boot up problems or managing your anxieties about them.
After my first Linux install some 5 years ago (using Lilo as boot manager) my pc wouldn't boot again at all, nor the linux install nor the windows xp; I used FixMBR.exe but should have used supergrub, because then I would have been able to access my linux install.

Anyway Supergrub is a great tool and I got a webpage it deserves here:
http://users.bigpond.net.au/hermanzone/SuperGrubDiskPage.html
Citation:
Situations where Super Grub Disk is useful:
Even if your computer has no bootloader problems right now, it is still a good idea to keep a Super Grub Disk somewhere around your computer for an emergency. All good system administrators should have one.

Super Grub Disk can boot up a computer when the 'IPL' (Initial Program Loader) code in the MBR does not point to the partition with the operating system that the user wants to boot up.
For example, when someone is dual booting Windows with a Gnu/Linux operating system and they have to re-install Windows. Now the computer will only boot Windows. Super GRUB Disk features the fastest and easiest way to re-install GRUB to MBR.
Super Grub Disk can also write other bootloader codes to MBR for you, from the operating system of your choice. For example, you can even restore the Windows bootloader code to MBR if you want to uninstall your Gnu/Linux operating system. Super Grub Disk can easily perform quite a large range of other very useful functions that make troubleshooting and diagnosis of bootloader problems a lot faster and easier. For example, SGD has the ability to scan a computer for various files involved in the booting process. This scanning can save the user a lot of time and tedious repetition.

Super Grub Disk helps Windows users who want to use GRUB as their boot manager. GRUB is actually a much better for managing multiple boot Windows arrangements than Windows' own bootloader. A few Windows users who are clever enough like to add a Linux distro that contains GRUB just for this purpose. So, Super Grub Disk also has functions even to help those who are installing more than one Windows or who have Windows installed in a non-first partition or hard disk.

Sunday, June 22, 2008

Why schools should exclusively use free software

source:

http://www.gnu.org/philosophy/schools.html

by Richard Stallman

There are general reasons why all computer users should insist on free software. It gives users the freedom to control their own computers—with proprietary software, the computer does what the software owner wants it to do, not what the software user wants it to do. Free software also gives users the freedom to cooperate with each other, to lead an upright life. These reasons apply to schools as they do to everyone.

But there are special reasons that apply to schools. They are the subject of this article.

First, free software can save the schools money. Even in the richest countries, schools are short of money. Free software gives schools, like other users, the freedom to copy and redistribute the software, so the school system can make copies for all the computers they have. In poor countries, this can help close the digital divide.

This obvious reason, while important, is rather shallow. And proprietary software developers can eliminate this disadvantage by donating copies to the schools. (Watch out!—a school that accepts this offer may have to pay for future upgrades.) So let's look at the deeper reasons.

School should teach students ways of life that will benefit society as a whole. They should promote the use of free software just as they promote recycling. If schools teach students free software, then the students will use free software after they graduate. This will help society as a whole escape from being dominated (and gouged) by megacorporations. Those corporations offer free samples to schools for the same reason tobacco companies distribute free cigarettes: to get children addicted (1). They will not give discounts to these students once they grow up and graduate.

Free software permits students to learn how software works. When students reach their teens, some of them want to learn everything there is to know about their computer system and its software. That is the age when people who will be good programmers should learn it. To learn to write software well, students need to read a lot of code and write a lot of code. They need to read and understand real programs that people really use. They will be intensely curious to read the source code of the programs that they use every day.

Proprietary software rejects their thirst for knowledge: it says, “The knowledge you want is a secret—learning is forbidden!” Free software encourages everyone to learn. The free software community rejects the “priesthood of technology”, which keeps the general public in ignorance of how technology works; we encourage students of any age and situation to read the source code and learn as much as they want to know. Schools that use free software will enable gifted programming students to advance.

The next reason for using free software in schools is on an even deeper level. We expect schools to teach students basic facts, and useful skills, but that is not their whole job. The most fundamental mission of schools is to teach people to be good citizens and good neighbors—to cooperate with others who need their help. In the area of computers, this means teaching them to share software. Elementary schools, above all, should tell their pupils, “If you bring software to school, you must share it with the other children.” Of course, the school must practice what it preaches: all the software installed by the school should be available for students to copy, take home, and redistribute further.

Teaching the students to use free software, and to participate in the free software community, is a hands-on civics lesson. It also teaches students the role model of public service rather than that of tycoons. All levels of school should use free software.

  1. RJ Reynolds tobacco company was fined $15m in 2002 for handing out free samples of cigarettes at events attended by children. See http://www.bbc.co.uk/worldservice/sci_tech/features/health/tobaccotrial/usa.htm.

Bill Gates and the importance of source code

Bill Gates was interviewed by the BBC’s Money Programme. As he prepares to significantly reduce his direct work for Microsoft Corporation, Bill reflects upon what got him started in the first place and what kept him ahead of the ‘competition’. The video provides a brief glimpse into the character that founded and guided Microsoft. Regardless of whether you love him or hate him, he is indeed a fascinating character.

Skip ahead to the 40 second mark, to the segment titled “How the teenage Gates and his friend Paul Allen got access to a computer”. The story according to Gates was that he and his friends were allowed to hack on a company’s computer “like monkeys” at night to find bugs. He spent hours reading manuals and experimenting to figure out this “fascinating puzzle”. However, they were stuck at the “tinkering” stage until they stumbled across the source code in a rubbish bin. It was only then could the monkeys evolve.

I don’t think the producers of the show realised the significance of this admission, since they quickly cut to another segment. Reading between the lines, Gates is essentially confessing that he would not have progressed had he and Paul Allen not found the source code. Without this knowledge, and without this opportunity to understand and experiment with how the internals of a computer worked, Gates and Allen would have been severely constrained in their ability to found a software company and develop products

I would go so far as to say that Microsoft owes its very existence to this access to source code.

To anyone with a passing familiarity to how things worked back then, this comes as no surprise. Source code was expected to be free, and this in turn nurtured a generation of computer hackers. But whereas Richard Stallman saw the amazing potential of this freedom and wanted to preserve it for all, Bill Gates appears to have perceived it as an advantage for himself that he must deny to others.


source: http://planet.ubuntu.com/


©2008 Sridhar Dhanapalan.

Wednesday, June 11, 2008

Changing screen resolution in Xorg.conf

My screen with a resolution of 1240x1024 wasn't accurately displayed by Xandros desktop 4.1. The fonts were looking fuzzy and were barely readable.
How to solve:

Backup Xorg.conf file:
sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf_backup

Go to folder and file with root privileges for example in Ubuntu:
sudo gedit /etc/X11/xorg.conf

Open file by clicking and look for Section Screen and ad a line like:
Modes "1240x1024_60.00"
Look at the way it's defined in the existing xorg file; it may be a bit different according to your distro.

This also can be of importance by lacking performance of your monitor:

How to edit or add HorizSync and VertRefresh lines
Find your monitors manual (manufacturers website and Google are useful).
Look for hozizontal sync and vertical refresh rates, also if bandwidth or maximum dot clock / pixel clock is mentioned, write it down.

Edit xorg.conf and put correct values to your xconf.org's Monitor section. Something like this:
Code:

Section "Monitor"
Identifier "CM752ET"
HorizSync 31-101
VertRefresh 60-160
EndSection

By changing this to a broad range your monitor will likely fit into it.
Source: http://ubuntuforums.org/showthread.php?t=83973

Blog Archive