25 Reasons to use Ubuntu Linux instead of Windows

Technomania

Lots of people argue why I should use Linux (any distro, I prefer Ubuntu) when I am currently using Windows or Mac. Given a chance to select your choice of operating system (OS), people may prefer to use Linux than anything else. The other thing which prevents users using Linux is the hardware support which is not that good currently for Linux. But that is because we have been living in a world where Windows is being forced to everyone when they buy PC. That’s why hardware manufacturers are also forced to support Windows first than any other thing. But this support has increased tremendously over last couple of years. At the same time Linux community has developed itself in making Linux (Ubuntu in particular) more user friendly.
Anyways that is an ongoing debate whether you should use Linux or Windows or Mac. And at some point it is a…

View original post 678 more words

How to repair grub

Last time installing windows stopped my ubuntu from booting-up. After some trial and error I managed fixing the boot-loader with some commands. I thought it might be worth sharing for those who may face the same problem.
First of all, you need a live cd or bootable usb stick of any flavor of linux distribution. For example, Ubuntu, Mint or fedora can be used.
Boot to the live cd or usb that you have and open a terminal window(Ctrl + T) and type the following:

  1. sudo fdisk -l

The output will be like what’s on the following image.

grub 1

We are going to install our grub on the highlighted partition.

  1. sudo blkid : This is used to make sure you have selected the right device and its output will be(nowadays ext4 is the default file system used).
    grub 2

So now you are sure about where to install grub.

By default grub is installed in /boot/grub directory when you install Ubuntu or other linux distros. So you have to mount /dev/sda3 to a directory our preference. To do this, type the following:

sudo mount /dev/sda3 /mnt :- Where /mnt is any directory you need.

NOTE:- If you have a separate boot partition, skip the above command and mount the boot partition at /mnt/boot (sudo mount /dev/sdX /mnt/boot).

  1. sudo grub-install – – boot-directory=/mnt/boot /dev/sda :- Make sure that the last argument(/dev/sda) must be the device(hard disk), not some particular partition like /dev/sda3, that you need to install the boot loader on.
  1. Reboot your system and it should boot properly.

 

Basics of Linux iptables

iptables is a user-space application program that allows to configure the tables provided by the Linux kernel firewall and the chains and rules it stores(Wikipedia). Therefore, it is used to set up, maintain, and inspect the tables of IPv4 packet filter rules in the Linux kernel.

Each table contains a number of chains. These chains in turn contain a list of rules which can match a set of packets and each rule specifies what to do with a packet that matches.

When installing Linux flavor operating system, iptables exists inside the kernel. But, by default it allows all in-coming and out-going. Therefore, it is not recommended to use iptables with its default configuration.
iptables-l-v

The following are possible values for IPTABLES policies:

  1. ACCEPT:- Allow the connection..
  2. DROP:- Drop the connection, act like it never happened. This is best if you don’t want the source to realize your system exists.
  3. REJECT:- Don’t allow the connection, but send back an error. This is best if you don’t want a particular source to connect to your system, but you want them to know that your firewall blocked them.

Tables

Currently there are five independent tables (which tables are present at any time depends on the kernel configuration options and which modules are present). For the time being we will be looking at the basics of the mostly used tables (FILTER and NAT). Continue reading

Get Ubuntu kernel information

The Linux kernel is a core component of every Ubuntu system. It is primarily responsible for managing the system hardware. Having the ability to check what version you are running can be beneficial. From time to time there are vulnerabilities that affect specific kernel versions, and being able to verify whether or not you are affected can be helpful. Certain features and hardware support are tied to certain kernel versions as well. This post will outline how to discover your Ubuntu kernel version in two easy steps.

Discovering your Ubuntu kernel version can be done in just a few quick steps. I’ll outline these steps below.

  1. Open a Terminal window (Alt + Crtl + T)

    Ubuntu Terminal
    Ubuntu Terminal
  2. Type the following command:
man 1 uname
This displays documentation about uname command. There you can see different options including:
 -a, -s, -n, -r, -v, -m, -p, -i, -o. This options have their own advantages, for example,
-a means display all information about your system. 

  Now, type uname -r

That is all, you will an output like: 3.13.0-32-generic

How to disable Ubuntus global menu bar

Ubuntu 14.04 has recently been released and they now include a setting for enabling the local menus, allowing you to easily move the menu bar for each program to that program’s window rather than displaying the menu bar at the top of the screen.

To enable the local menus on ubuntu 14.04, click the System Settings icon on the Unity bar.

System Settings

From the System Settings box, click the Appearance icon in the Personal section.

Appearance

From this window, select the “Behaviour” tab

behaviour

Then, under the “Show the menus for a window” section there is a radio button saying “In the window’s title bar”, select it.

Now you are all set, you will get the menus on the title bar of each window opened.

final

Now that you have the menus on the windows you open. Enjoy using Ubuntu.

5.8. Invoking the C Preprocessor

Most often when you use the C preprocessor you will not have to invoke it explicitly: the C compiler will do so automatically. However, the preprocessor is sometimes useful on its own.

The C preprocessor expects two file names as arguments, infile and outfile. The preprocessor reads infile together with any other files it specifies with `#include’. All the output generated by the combined input files is written in outfile.

Either infile or outfile may be `-‘, which as infile means to read from standard input and as outfile means to write to standard output. Also, if outfile or both file names are omitted, the standard output and standard input are used for the omitted file names.

Here is a table of command options accepted by the C preprocessor. These options can also be given when compiling a C program; they are passed along automatically to the preprocessor when it is invoked by the compiler.

`-P’

Inhibit generation of `#’-lines with line-number information in the output from the preprocessor . This might be useful when running the preprocessor on something that is not C code and will be sent to a program which might be confused by the `#’-lines.

`-C’

Do not discard comments: pass them through to the output file. Comments appearing in arguments of a macro call will be copied to the output before the expansion of the macro call.

`-traditional’

Try to imitate the behavior of old-fashioned C, as opposed to ANSI C.

  • Traditional macro expansion pays no attention to singlequote or doublequote characters; macro argument symbols are replaced by the argument values even when they appear within apparent string or character constants.
  • Traditionally, it is permissible for a macro expansion to end in the middle of a string or character constant. The constant continues into the text surrounding the macro call.
  • However, traditionally the end of the line terminates a string or character constant, with no error.
  • In traditional C, a comment is equivalent to no text at all. (In ANSI C, a comment counts as whitespace.)
  • Traditional C does not have the concept of a “preprocessing number”. It considers`1.0e+4′ to be three tokens: `1.0e’, `+’, and `4′.
  • A macro is not suppressed within its own definition, in traditional C. Thus, any macro that is used recursively inevitably causes an error.
  • The character`#’ has no special meaning within a macro definition in traditional C.
  • In traditional C, the text at the end of a macro expansion can run together with the text after the macro call, to produce a single token. (This is impossible in ANSI C.)
  • Traditionally,`\’ inside a macro argument suppresses the syntactic significance of the following character.

`-trigraphs’

Process ANSI standard trigraph sequences. These are three-character sequences, all starting with `??’, that are defined by ANSI C to stand for single characters. For example, `??/’ stands for `\’, so `’??/n”is a character constant for a newline. Strictly speaking, the GNU C preprocessor does not support all programs in ANSI Standard C unless `-trigraphs’ is used, but if you ever notice the difference it will be with relief. You don’t want to know any more about trigraphs.

`-pedantic’

Issue warnings required by the ANSI C standard in certain cases such as when text other than a comment follows `#else’ or `#endif’.

`-pedantic-errors’

Like `-pedantic’, except that errors are produced rather than warnings.

`-Wtrigraphs’

Warn if any trigraphs are encountered (assuming they are enabled).

`-Wcomment’

Warn whenever a comment-start sequence `/*’ appears in a `/*’ comment, or whenever a Backslash-Newline appears in a `//’ comment.

`-Wall’ Continue reading