Author Archive

Linux Tools

Posted: March 26, 2012 by Vaibhav in Uncategorized
Tags: , , , , , ,

Some interesting Linux Tools:
1)    Backing up ‘/’ “root partition” in Linux:

It may happen that we run out of memory in the ‘/’ (i.e. root partition). As all the packages are stored in the root partition only it is not possible to directly delete the file(s). An alternative to this is resizing the partition with some Partition Editor program like ‘GParted’. But as the program also suggests it may lead to loss of data (and the whole partition may be needed to be reformatted leading to entire loss of data).

In such and many more cases we may perform a total backup of the ‘/’ root partition by writing some commands in the Terminal. In this case we make a ‘tar’ backup of the whole root partition which we may restore in case of data loss.

COMMANDS WHILE CREATING BACKUP#

cd /                ### Change current directory to ‘/’ root
tar   -cvpzf backup.tar.gz   –exclude=backup.tar.gz   –exclude=/media   –exclude=/proc   –exclude=/lost+found –exclude=/sys   –exclude=/mnt   –exclude=/dev   –exclude=/home

 

# ‘–exclude=/home’ only when ‘/home’ folder is on other separate partition.

# To know more about why ‘-cvpzf’ is used, try “man tar” in the Terminal.

# Note that we are using the root directory itself to store the backup (….  -cvpzf backup.tar.gz …). We may also use any suitable location to store it. (Say for example /home/test/backup.tar.gz)

# Create the backup and specify the parameters. The ‘–exclude’ flags are used for the locations which are not to be included in the backup. First ‘–exclude’ for the backup file itself as we don’t want to make a backup of the backup file itself (which will lead to error). Second ‘–exclude’ to avoid the ‘/media’ folder which is the mount point for all the other partitions. The other ‘–exclude’s for /proc,  /lost+found,  /sys, /mnt  and /dev are due to the fact that they are not needed in the backup and can be restored automatically. The ‘–exclude’ for /home is optional and is to be used only when there is separate partition for the ‘/home’

COMMANDS WHILE RESTORING BACKUP#

tar –xvpzf /home/test/backup.tar.gz   -C   /    # assuming that the backup file is stored in the directory ‘/home/test/’
mkdir   /media
mkdir   /proc
mkdir   /lost+found
mkdir   /sys
mkdir   /mnt
mkdir   /dev
mkdir   /home        ### Only if excluded while creating Backup

 

# Recreate the directories not included in the backup by using ‘mkdir’ from the Commands List.

# Refer to the commands list for more general commands.

If still by any chance after you restore the backup the GRUB menu does not show up or shows “grub rescue>” follow the commands give at ‘Tackling GRUB Rescue by the chroot method‘.

Note that if you have to, by any chance, reinstall the GRUB Bootloader, you will need a LiveOS installed on a USB stick or a Live CD/DVD.

2) How to change the display in Terminal:

Bored by looking the mylongusername@my-another-long-pc-name:$ in the Terminal, then you can change the display by just using two commands.

a=PS1

PS1=:

Using these two commands, we can change the display to only a ‘:’.

Other characters or words may be used by replacing the ‘:’ in the command by the required keyword.

To restore it just close the Terminal and open a new one. All changes are undone.

Part 2 of  https://decodingc.wordpress.com/2012/03/20/linux-is-not-windows/
Problem #2: Linux is too different from Windows
The next issue arises when people do expect Linux to be different, but find that some differences are just too radical for their liking. Probably the biggest example of this is the sheer amount of choice available to Linux users. Whereas an out-of-the-box-Windows user has the Classic or XP desktop with Wordpad, Internet Explorer, and Outlook Express installed, an out-of-the-box-Linux user has hundreds of distros to choose from, then Gnome or KDE or Fluxbox or whatever, with vi or emacs or kate, Konqueror or Opera or Firefox or Mozilla, and so on and so forth.
A Windows user isn’t used to making so many choices just to get up & running. Exasperated “Does there have to be so much choice?” posts are very common.
Does Linux really have to be so different from Windows? After all, they’re both operating systems. They both do the same job: Power your computer & give you something to run applications on. Surely they should be more or less identical?
Look at it this way: Step outside and take a look at all the different vehicles driving along the road. These are all vehicles designed with more or less the same purpose: To get you from A to B via the roads. Note the variety in designs.
But, you may be thinking, car differences are really quite minor: they all have a steering wheel, foot-pedal controls, a gear stick, a handbrake, windows & doors, a petrol tank. . . If you can drive one car, you can drive any car!
Quite true. But did you not see that some people weren’t driving cars, but were riding motorbikes instead. . ?
Switching from one version of Windows to another is like switching from one car to another. Win95 to Win98, I honestly couldn’t tell the difference. Win98 to WinXP, it was a bigger change but really nothing major.
But switching from Windows to Linux is like switching between a motorbike and a car. They may both be OSes/road vehicles. They may both use the same hardware/roads. They may both provide an environment for you to run applications/transport you from A to B. But they use fundamentally different approaches to do so.
Windows/cars are not safe from viruses/theft unless you install an antivirus/lock the doors. Linux/motorbikes don’t have viruses/doors, so are perfectly safe without you having to install an antivirus/lock any doors.
Or look at it the other way round:
Linux/cars were designed from the ground up for multiple users/passengers. Windows/motorbikes were designed for one user/passenger. Every Windows user/motorbike driver is used to being in full control of his computer/vehicle at all times. A Linux user/car passenger is used to only being in control of his computer/vehicle when logged in as root/sitting in the driver’s seat.
Two different approaches to fulfilling the same goal. They differ in fundamental ways. They have different strengths and weaknesses: A car is the clear winner at transporting a family & a lot of cargo from A to B: More seats & more storage space. A motorbike is the clear winner at getting one person from A to B: Less affected by congestion and uses less fuel.
There are many things that don’t change when you switch between cars and motorbikes: You still have to put petrol in the tank, you still have to drive on the same roads, you still have to obey the traffic lights and Stop signs, you still have to indicate before turning, you still have to obey the same speed limits.
But there are also many things that do change: Car drivers don’t have to wear crash helmets, motorbike drivers don’t have to put on a seatbelt. Car drivers have to turn the steering wheel to get around a corner, motorbike drivers have to lean over. Car drivers accelerate by pushing a foot-pedal, motorbike drivers accelerate by twisting a hand control.
A motorbike driver who tries to corner a car by leaning over is going to run into problems very quickly. And Windows users who try to use their existing skills and habits generally also find themselves having many issues. In fact, Windows “Power Users” frequently have more problems with Linux than people with little or no computer experience, for this very reason. Typically, the most vehement “Linux is not ready for the desktop yet” arguments come from ingrained Windows users who reason that if they couldn’t make the switch, a less-experienced user has no chance. But this is the exact opposite of the truth.
So, to avoid problem #2: Don’t assume that being a knowledgeable Windows user means you’re a knowledgeable Linux user: When you first start with Linux, you are a novice.
Look out this page for some more…

Linux is Not Windows

Posted: March 20, 2012 by Vaibhav in Uncategorized
Tags: , , , , , , ,


(Linux is Not Windows)

Problem Switching From Windows to Linux……

Problem #1: Linux isn’t exactly the same as Windows.

You’d be amazed how many people make this complaint. They come to Linux, expecting to find essentially a free, open-source version of Windows. Quite often, this is what they’ve been told to expect by over-zealous Linux users. However, it’s a paradoxical hope.

The specific reasons why people try Linux vary wildly, but the overall reason boils down to one thing: They hope Linux will be better than Windows. Common yardsticks for measuring success are cost, choice, performance, and security. There are many others. But every Windows user who tries Linux, does so because they hope it will be better than what they’ve got.

Therein lies the problem.

It is logically impossible for any thing to be better than any other thing whilst remaining completely identical to it. A perfect copy may be equal, but it can never surpass. So when you gave Linux a try in hopes that it would be better, you were inescapably hoping that it would be different. Too many people ignore this fact, and hold up every difference between the two OSes as a Linux failure.

As a simple example, consider driver upgrades: one typically upgrades a hardware driver on Windows by going to the manufacturer’s website and downloading the new driver; whereas in Linux you upgrade the kernel.

This means that a single Linux download & upgrade will give you the newest drivers available for your machine, whereas in Windows you would have to surf to multiple sites and download all the upgrades individually. It’s a very different process, but it’s certainly not a bad one. But many people complain because it’s not what they’re used to.

Or, as an example you’re more likely to relate to, consider Firefox: One of the biggest open-source success stories. A web browser that took the world by storm. Did it achieve this success by being a perfect imitation of IE, the then-most-popular browser?

No. It was successful because it was better than IE, and it was better because it was different. It had tabbed browsing, live bookmarks, built-in searchbar, PNG support, adblock extensions, and other wonderful things. The “Find” functionality appeared in a toolbar at the bottom and looked for matches as you typed, turning red when you had no match. IE had no tabs, no RSS functionality, searchbars only via third-party extensions, and a find dialogue that required a click on “OK” to start looking and a click on “OK” to clear the “Not found” error message. A clear and inarguable demonstration of an open-source application achieving success by being better, and being better by being different. Had FF been an IE clone, it would have vanished into obscurity. And had Linux been a Windows clone, the same would have happened.

So the solution to problem #1: Remember that where Linux is familiar and the same as what you’re used to, it isn’t new & improved. Welcome the places where things are different, because only here does it have a chance to shine.

Look out this page for some more problems…

Many a times it may happen that the Master Boot Record (MBR) of the system gets corrupted or for the PCs with GRUB (GRand Unified Bootloader), the critical ‘boot.cfg’ file located in ‘/boot/grub/’ gets damaged or deleted. It may also happen that if Windows is installed after Linux* then it overwrites the MBR so that the Linux partitions get hidden and cannot be accessed. These problems can be solved by installing ‘grub’ without reinstalling Linux.

CHROOT method reinstalling grub 2:

This method of installation uses the chroot command to gain access to the broken system’s files. Once the chroot command is issued, the LiveCD treats the broken system’s / (root) as its own. Commands run in a chroot environment will affect the broken systems filesystems and not those of the LiveCD.

1. Boot to the LiveCD Desktop (Ubuntu 9.10 or later).

(Click to get it here: http://www.ubuntu.com/start-download?distro=desktop&bits=32&release=latest

2. Open Terminal (Applications -> Accessories -> Terminal) or alternatively press Ctrl+Alt+T.

3. Determine your normal system partition – (the switch is a lowercase “L”)

sudo fdisk -l

If you aren’t sure, run

df -Th

(Look for the correct disk size and ext3 or ext4 format.)

4. Mount your normal system partition substituting the correct partition: sda5, sdb2, etc

sudo mount /dev/sdXX /mnt

(Example: sudo mount /dev/sda5 /mnt)

5. Only if you have a separate boot partition and ‘sdYY’ is the ‘/boot’ partition designation (for example sda6)

sudo mount /dev/sdYY /mnt/boot

6. Now mount the critical virtual filesystems:

sudo mount –bind /dev /mnt/dev

sudo mount –bind /proc /mnt/proc

sudo mount –bind /sys /mnt/sys

7. To ensure that only the grub utilities from the LiveCD get executed, mount ‘/usr’ by

sudo mount –bind /usr/ /mnt/usr

8. Chroot into your normal system device:

sudo chroot /mnt

9. If there is no ‘/boot/grub/grub.cfg’ or it’s not correct, create one using

update-grub

10. Reinstall GRUB 2 by substituting the correct device – sda, sdb, etc without specifying a partition number.

grub-install /dev/sdX

11. Verify the install (use the correct device, for example sda. Do not specify a partition):

sudo grub-install –recheck /dev/sdX

12. Exit chroot by pressing Ctrl+D on the keyboard

13. Unmount virtual filesystems:

sudo umount /mnt/dev
sudo umount /mnt/proc
sudo umount /mnt/sys

Only if you mounted a separate ‘/boot’ partition:

sudo umount /mnt/boot

14. Unmount the LiveCD’s /usr directory:

sudo umount /mnt/usr

15. Unmount last device:

sudo umount /mnt

16. Reboot your system.

sudo reboot

* In the article, the GNU/Linux OS is referred under the catch-all name of “Linux”.

Linux Commands

Posted: March 5, 2012 by Vaibhav in FOSS
Tags: , , , , , , , , , , ,

LINUX

<Tab>

(In a text or X terminal) Autocomplete the command if there is only one option, or else show all the available options. On newer systems you may need to press <Tab><Tab>. THIS SHORTCUT IS GREAT, it can truely save you lots of time.

<ArrowUp>

(In a text or X terminal) Scroll and edit the command history. Press <Enter> to execute a historical command (to save on typing). <ArrowDown> scrolls back.

exit
Logout. I can also use logout for the same effect. (If you have started a second shell, e.g., using bash, this command will make you exit the second shell, and you will be back in the first shell, not logged out. Then use another exit to logout.)

<Ctrl>d
(pressed at the beginning of an empty line) Log out from the current terminal. See also the next command.

<Ctrl>d

Send [End-of-File] to the current process. Don’t press it twice else you also log out (see the previous command).

<MiddleMouseButton>

Paste the text which is currently highlighted somewhere else. This is the normal “copy-paste” operation in Linux. It a fast and powerful supplement to the widely-known GUI “copy-paste” menu-based operation. (It doesn’t work inside older versions of Netscape which use the Mac/MS Windows-style “copy-paste” exclusively. It does work in the text terminal if you enabled “gpm” service using “setup”. It also works inside any dialog boxes, etc.–really convenient!) It is best used with a Linux-ready 3-button mouse (Logitech or similar) or else set “3-mouse button emulation”. The <MiddleMouseButton> is normally emulated on a 2-button mouse by pressing both mouse buttons simultanously.

ls

List the content of the current directory. Under Linux, the command “dir” is an alias to ls. Many users have “ls” to be an alias to “ls –color”.

cd <directory_name>

Change directory. Using “cd” without the directory name will take you to your home directory. “cd -” will take you to your previous directory and is a convenient way to toggle between two directories. “cd ..” will take you one directory up.

<Shift><PgUp>

Scroll terminal output up. This works also at the login prompt, so you can scroll through your bootup messages. The amount/usage of your video memory determines how far back you can scroll the display. <Shift><PgDown> scrolls the terminal output down.

sudo <command_name>

Perform any command by becoming a super user. Just like running any application as an Administrator in Windows

cp source destination

Copy files. E.g., cp /home/stan/existing_file_name . will copy a file to my current working directory. Use the “-r” option (for recursive) to copy the contents of whole directories, e.g. , cp -r my_existing/dir/ ~ will copy a subdirectory under my current working directory to my home directory.

mv source destination

Move or rename files. The same command is used for moving and renaming files and directories.

rm files

Remove (delete) files. You must own the file in order to be able to remove it. On many systems, you will be asked or confirmation of deleation, if you don’t want this, use the “-f” (=force) option, e.g., rm -f * will remove all files in my current working directory, no questions asked.

rm -r files <Not Recommended>

(recursive remove) Remove files, directories, and their subdirectories. Careful with this command as root–you can easily remove all files on the system with such a command executed on the top of your directory tree, and there is no undelete in Linux (yet). But if you really wanted to do it (reconsider), here is how (as root): rm -rf /*

halt
reboot

(as root, two commands) Halt or reboot the machine. Used for remote shutdown, simpler to type than the previous command.

mount

See here for details on mounting drives. Examples are shown in the next commands.

mount -t auto /dev/fd0 /mnt/floppy
(as root) Mount the floppy. The directory /mnt/floppy must exist, be empty and NOT be your current directory.

mount -t auto /dev/cdrom /mnt/cdrom
(as root) Mount the CD. You may need to create/modify the /dev/cdrom file depending where your CDROM is. The directory /mnt/cdrom must exist, be empty and NOT be your current directory.

mount /mnt/floppy
(as user or root) Mount a floppy as user. The file /etc/fstab must be set up to do this. The directory /mnt/floppy must not be your current directory.

mount /mnt/cdrom
(as user or root) Mount a CD as user. The file /etc/fstab must be set up to do this. The directory /mnt/cdrom must not be your current directory.

umount /mnt/floppy
Unmount the floppy. The directory /mnt/floppy must not be your (or anybody else’s) current working directory. Depending on your setup, you might not be able to unmount a drive that you didn’t mount.

More Coming up Soon!

It was just a few weeks ago that planning began on Ubuntu 12.04, or “Precise Pangolin,” but already key details about the upcoming version of Canonical’s popular Linux distribution are beginning to emerge.                                                                                                                                                                                            A number of decisions about the new software were made at the Ubuntu Developer Summit last week. Ready for a rundown? Here’s what we’ve learned so far.                  
 
1. Too Big for CDs
One of the more notable developments is that it looks like developers are planning to target a 750 MB ISO image for Ubuntu 12.04, meaning that the software will no longer fit on a CD, according to a report on The H. Instead, users will need either DVDs or USB drives to install it. The change may seem shocking, but it’s actually an increase of only 50 MB.
 
2. Back to Rhythmbox?                                                                                                                            Numerous reports are suggesting that the Banshee music player–which was only just recently added to Ubuntu–may be replaced by Rhythmbox once again. Problems cited with Banshee include poor maintenance and also potential incompatibilities with ARM, according to a post-Summit blog post by Banshee developer Joseph Michael Shields, who disputes both assertions. No final decision appears to have been made on this question, however, and it’s currently being discussed in a thread on the Ubuntu-Desktop mailing list.
 
3. No More Mono?                                                                                                        Closely linked with the question of removing Banshee is the possibility of removing Mono from Ubuntu as well. Banshee is one of the few applications left in the software that still depend on Mono, which is an open source implementation of Microsoft’s .NET framework. Ubuntu Community Manager Jono Bacon weighed in with a blog entry on Tuesday stressing that neither the Banshee nor the Mono decisions have been finalized.
 
4. 64-Bit by Default                                                                                                                                           Also notable in Ubuntu 12.04 is that users will be offered the 64-bit version by default, though the 32-bit version will still be available. Version 3.2 of the Linux Kernel, meanwhile, will serve as the heart of Ubuntu 12.04, according to a report on Phoronix.
 
5. A Wayland Preview                                                                                                                        While Ubuntu 12.04 will still depend on X.Org as its main server, an experimental Wayland preview running an X11 server may be available as well, Phoronix reports.
 
6. Some GNOME 3.4 Packages                                                                                                                       The bulk of the GNOME packages in Ubuntu 12.04 LTS will be GNOME 3.2 packages, but a few GNOME 3.4 packages will reportedly be included as well, including GTK+ 3.4, GNOME Games, GEdit, Gcalctool, Evince, and Yelp.
 
7. A Speedier Software Center                                                                                                                      Finally, developers hope to speed startup of the Ubuntu Software Centre from 11 seconds to less than two seconds, according to The H. Due in April, Ubuntu 12.04 will be a Long-Term Support (LTS) version of the free and open source operating system, with support for a full five years. I’ll be watching closely as new details emerge.
 
Source: Katherine Noyes, PCWorld

Truth Happens

Posted: December 11, 2011 by Vaibhav in Uncategorized

An excellent video based on  LINUX and Free Open Source Software…

Visit this page to get the latest articles and videos on open source, intellectual property, transparency, and more. See how openness and collaboration are transforming how we learn, share, and play.

truthhappens.redhat.com

Direct link for the video in other formats: