Sunday, August 17, 2008

To password protect a folder in Linux

Use the zip command:

zip -e -r "name of the new zip file" "path of the folder which has to be protected"

Eg:

If you want to protect a folder named "old" in your desktop. Just do it...

zip -e -r /home/dinesh/Desktop/new /home/dinesh/Desktop/old

[dinesh@LINUXPOINT ~]$ zip -e -r /home/dinesh/Desktop/new /home/dinesh/Desktop/old
Enter password:
Verify password:

This will create a zip file named "new.zip" in your desktop(new.zip). After that delete the folder "old".

Monday, March 10, 2008

SOME FAMOUS LINUX QUOTES



  1. "Avoid the Gates of Hell. Use Linux."
  2. “Software is like sex: it's better when it's free.”
  3. "Linux is addictive, I'm hooked!"
  4. "Linux is not user-friendly.It is user-friendly.It is not ignorant-friendly and idiot-friendly."
  5. "Microsoft is not the answer.Microsoft is the question.NO (or Linux) is the answer."
  6. "A Linux machine! Because a 486 is a terrible thing to waste!"
  7. "The nice thing about Windows is - It does not just crash, it displays a dialog box and lets you press 'OK' first."
  8. "If Microsoft ever does applications for Linux it means I've won.”
  9. "We all know Linux is great...it does infinite loops in 5 seconds."
  10. “People will realize that software is not a product; you use it to build a product,”
  11. “I don't expect the desktop to come quickly. It will take time,”
  12. “Intelligence is the ability to avoid doing work, yet getting the work done”
  13. “Microsoft isn't evil, they just make really crappy operating systems.”
  14. “My name is Linus, and I am your God.”
  15. “See, you not only have to be a good coder to create a system like Linux, you have to be a sneaky bastard too”
  16. “When you say "I wrote a program that crashed Windows," people just stare at you blankly and say "Hey, I got those with the system, for free."
  17. "The Linux philosophy is 'Laugh in the face of danger'. Oops. Wrong One. 'Do it yourself'. Yes, that's it."
  18. "Linux is for those who want to know why their computer works."







Saturday, March 8, 2008

Cpp programming in Linux

Before starting Cpp programming on Linux, you need to check the existence of some development tools.
Following example illustrates how to check existence of development tools. You should get a similar output.
All these commands were executed on my home PC which runs RHEL 5.

[root@SHADOWMAN ~]# which g++
/usr/bin/g++
[root@SHADOWMAN ~]# which c++
/usr/bin/c++

If you have afore-mentioned tools available, you are set to start.

C/C++ Compiler:
The C compiler on Linux is a part of compiler suite, known as GCC(GNU Compiler Collection). This suite offers compilers for several languages. Following is a list of typical ones offered.
• C
• C++
• Objective C
• Fortran

The name of C compiler program on Linux is gcc and C++ compiler is called as g++. You can find out the version of the compiler using –version option. This is the output produced on my home machine.

[root@SHADOWMAN ~]# gcc --version
gcc (GCC) 4.1.1 20070105 (Red Hat 4.1.1-52)
Copyright (C) 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Now just do it....
1) Create a new file with extension .cpp in your folder.
2) Open the file and write the program. Finish it by saving (for eg; 1.cpp here).
3) Right click on the desktop and open terminal
4) In the terminal, change into your folder by using cd command.
5) Type g++ 1.cpp OR c++ 1.cppand press enter. If there are errors, they will be listed here.
6) Successful compilation would lead to the creation of an executable file a.out . Run that by using the command ./a.out . The result will be displayed in the terminal.

Here is a simple Eg for a cpp program
#include
using namespace std;
int main()
{

cout<<"Hello World!\n";

}

NOTE:
You have to include "using namespace std;". Else compilation will show error messages like this:
1.cpp: In function ‘int main()’:
1.cpp:5: error: ‘cout’ was not declared in this scope







Wednesday, June 13, 2007

Kernel specific commands

* date – Print or set the system date and/or time
* dmesg – Print the kernel message ring buffer
* ipcrm – Remove a message queue, semaphore set or shared memory id
* ipcs – Provide information on IPC facilities
* uname – Print assorted system statistics

System management

* fuser – Identify processes by files or sockets
* logger – Make entries in the system log
* newgrp (or sg) – Log in to a new group
* pathchk – Check the validity/portability of filenames

General user commands

* clear – Clear screen and home cursor
* echo – Print arguments to standard output
* env – Show environment variables; run a program with altered environment variables
* file – Determine the type of a file
* nohup – Run a command with immunity to hangups outputting to non-tty
* sh – The Bourne shell, the standard Unix shell
* uptime – Print how long the system has been running

[edit]

Common Unix commands

Widely used Unix commands include:

Directory and file creation and navigation: ls cd pwd mkdir rm rmdir cp find touch
File viewing and editing: more less ed vi emacs head tail
Text processing: echo cat grep sort uniq sed awk cut tr split printf
File comparison: comm cmp diff patch
Miscellaneous shell tools: yes test xargs
System administration: chmod chown ps su w who
Communication: mail telnet ftp finger ssh
Authentication: su login passwd

Vital components of UNIX system

The Unix system is composed of several components that are normally packaged together. By including — in addition to the kernel of an operating system — the development environment, libraries, documents, and the portable, modifiable source-code for all of these components, Unix was a self-contained software system. This was one of the key reasons it emerged into an important teaching and learning tool and had such a broad influence.

Inclusion of these components did not make the system large — the original V7 UNIX distribution, consisting of copies of all of the compiled binaries plus all of the source code and documentation occupied less than 10Mb, and arrived on a single 9-track magtape. The printed documentation, typeset from the on-line sources, was contained in two volumes.

The names and filesystem locations of the Unix components has changed substantially across the history of the system. Nonetheless, the V7 implementation is considered by many to have the canonical early structure:

Kernel — source code in /usr/sys, composed of several sub-components:
conf — configuration and machine-dependent parts, including boot code
dev — device drivers for control of hardware (and some pseudo-hardware)
sys — operating system "kernel", handling memory management, process scheduling, system calls, etc.
h — header files, defining key structures within the system and important system-specific invariables
Development Environment — Early versions of Unix contained a development environment sufficient to recreate the entire system from source code:
cc — C language compiler (first appeared in V3 Unix)
as — machine-language assembler for the machine
ld — linker, for combining object files
lib — object-code libraries (installed in /lib or /usr/lib) libc, the system library with C run-time support, was the primary library, but there have always been additional libraries for such things as mathematical functions (libm) or database access. V7 Unix introduced the first version of the modern "Standard I/O" library stdio as part of the system library. Later implementations increased the number of libraries significantly.
make - build manager (introduced in PWB/UNIX), for effectively automating the build process
include — header files for software development, defining standard interfaces and system invariants
Other languages — V7 Unix contained a Fortran-77 compiler, a programmable arbitrary-precision calculator (bc, dc), and the awk "scripting" language, and later versions and implementations contain many other language compilers and toolsets. Early BSD releases included Pascal tools, and many modern Unix systems also include the GNU Compiler Collection as well as or instead of a proprietary compiler system.
Other tools — including an object-code archive manager (ar), symbol-table lister (nm), compiler-development tools (e.g. lex & yacc), and debugging tools.
Commands — Unix makes little distinction between commands (user-level programs) for system operation and maintenance (e.g. cron), commands of general utility (e.g. grep), and more general-purpose applications such as the text formatting and typesetting package. Nonetheless, some major categories are:
sh — The "shell" programmable command-line interpreter, the primary user interface on Unix before window systems appeared, and even afterward (within a "command window").
Utilities — the core tool kit of the Unix command set, including cp, ls, grep, find and many others. Subcategories include:
System utilities — administrative tools such as mkfs, fsck, and many others
User utilities — environment management tools such as passwd, kill, and others.
Document formatting — Unix systems were used from the outset for document preparation and typesetting systems, and included many related programs such as nroff, troff, tbl, eqn, refer, and pic. Some modern Unix systems also include packages such as TeX and GhostScript.
Graphics — The plot subsystem provided facilities for producing simple vector plots in a device-independent format, with device-specific interpreters to display such files. Modern Unix systems also generally include X11 as a standard windowing system and GUI, and many support OpenGL.
Communications — Early Unix systems contained no inter-system communication, but did include the inter-user communication programs mail and write. V7 introduced the early inter-system communication system UUCP, and systems beginning with BSD release 4.1c included TCP/IP utilities.

The 'man' command can display a 'man page' for every command on the system, including itself.
The 'man' command can display a 'man page' for every command on the system, including itself.

Documentation — Unix was the first operating system to include all of its documentation online in machine-readable form. The documentation included:
man — manual pages for each command, library component, system call, header file, etc.
doc — longer documents detailing major subsystems, such as the C language and troff

Standards

Beginning in the late 1980s, an open operating system standardization effort now known as POSIX provided a common baseline for all operating systems; IEEE based POSIX around the common structure of the major competing variants of the Unix system, publishing the first POSIX standard in 1988. In the early 1990s a separate but very similar effort was started by an industry consortium, the Common Open Software Environment (COSE) initiative, which eventually became the Single UNIX Specification administered by The Open Group). Starting in 1998 the Open Group and IEEE started the Austin Group, to provide a common definition of POSIX and the Single UNIX Specification.

In an effort towards compatibility, in 1999 several Unix system vendors agreed on SVR4's Executable and Linkable Format (ELF) as the standard for binary and object code files. The common format allows substantial binary compatibility among Unix systems operating on the same CPU architecture.

The Filesystem Hierarchy Standard was created to provide a reference directory layout for Unix-like operating systems, particularly Linux. This type of standard however is controversial, and even within the Linux community its adoption is far from universal.

Brief history

In the 1960s, the Massachusetts Institute of Technology, AT&T Bell Labs, and General Electric worked on an experimental operating system called Multics (Multiplexed Information and Computing Service), which was designed to run on the GE-645 mainframe computer. The aim was the creation of a commercial product, although this was never a great success. Multics was an interactive operating system with many novel capabilities, including enhanced security. The project did develop production releases, but initially these releases performed poorly.

AT&T Bell Labs pulled out and deployed its resources elsewhere. One of the developers on the Bell Labs team, Ken Thompson, continued to develop for the GE-645 mainframe, and wrote a game for that computer called Space Travel. However, he found that the game was too slow on the GE machine and was expensive, costing $75 per execution in scarce computing time.

Thompson thus re-wrote the game in assembly language for Digital Equipment Corporation's PDP-7 with help from Dennis Ritchie. This experience, combined with his work on the Multics project, led Thompson to start a new operating system for the PDP-7. Thompson and Ritchie led a team of developers, including Rudd Canaday, at Bell Labs developing a file system as well as the new multi-tasking operating system itself. They included a command line interpreter and some small utility programs.

an overview

Unix operating systems are widely used in both servers and workstations. The Unix environment and the client-server program model were essential elements in the development of the Internet and the reshaping of computing as centered in networks rather than in individual computers.

Both Unix and the C programming language were developed by AT&T and distributed to government and academic institutions, causing both to be ported to a wider variety of machine families than any other operating system. As a result, Unix became synonymous with "open systems".

Unix was designed to be portable, multi-tasking and multi-user in a time-sharing configuration. Unix systems are characterized by various concepts: the use of plain text for storing data; a hierarchical file system; treating devices and certain types of inter-process communication (IPC) as files; and the use of a large number of small programs that can be strung together through a command line interpreter using pipes, as opposed to using a single monolithic program that includes all of the same functionality. These concepts are known as the Unix philosophy.

Under Unix, the "operating system" consists of many of these utilities along with the master control program, the kernel. The kernel provides services to start and stop programs, handle the file system and other common "low level" tasks that most programs share, and, perhaps most importantly, schedules access to hardware to avoid conflicts if two programs try to access the same resource or device simultaneously. To mediate such access, the kernel was given special rights on the system and led to the division between user-space and kernel-space.

The microkernel tried to reverse the growing size of kernels and return to a system in which most tasks were completed by smaller utilities. In an era when a "normal" computer consisted of a hard disk for storage and a data terminal for input and output (I/O), the Unix file model worked quite well as most I/O was "linear". However, modern systems include networking and other new devices. Describing a graphical user interface driven by mouse control in an "event driven" fashion didn't work well under the old model. Work on systems supporting these new devices in the 1980s led to facilities for non-blocking I/O, forms of inter-process communications other than just pipes, as well as moving functionality such as network protocols out of the kernel.

About UNIX

Unix (officially trademarked as UNIX®) is a computer operating system originally developed in the 1960s and 1970s by a group of AT&T employees at Bell Labs including Ken Thompson, Dennis Ritchie and Douglas McIlroy. Today's Unix systems are split into various branches, developed over time by AT&T as well as various commercial vendors and non-profit organizations.

As of 2007, the owner of the trademark UNIX® is The Open Group, an industry standards consortium. Only systems fully compliant with and certified to the Single UNIX Specification qualify as "UNIX®" (others are called "Unix system-like" or "Unix-like").

During the late 1970s and early 1980s, Unix's influence in academic circles led to large-scale adoption of Unix (particularly of the BSD variant, originating from the University of California, Berkeley) by commercial startups, the most notable of which is Sun Microsystems. Today, in addition to certified Unix systems, Unix-like operating systems such as Linux, Mac OS X and BSD derivatives are commonly encountered.

Sometimes, "traditional Unix" may be used to describe a Unix or an operating system that has the characteristics of either Version 7 Unix or UNIX System V.

Sunday, May 27, 2007

The Road to KDE 4: Konsole Gets an Overhaul

Again, after a delay , we return to bring you updates on the state of Konsole, KDE's UNIX terminal program. Konsole has been a staple of KDE since KDE 1.0, as has been showing signs of a little bit of clutter and wear. So, Robert Knight ,the authority in charge has stepped in to clean up the program's code, and more than anything else, fix a cluttered and difficult interface.

When the KDE 4 development series commenced, Robert Knight took over maintainership of Konsole. The end result is a Konsole for KDE 4 that is visually very similar, functionally improved and with a settings system you can actually stomach. The screenshot shows that the main window has not changed too much. .The once-intimidating settings menu now becomes very simple. It may look like the configuration options are gone, but they are still all available in a sanely organized fashion.

And lastly, the appearance people will appreciate this dialog: its implementation is effective and its use becomes obvious. Additionally, Robert has implemented style previews in an intuitive manner. As you mouse over the style, the Konsole window in the background automatically applies that style in an active preview. So you can very rapidly look through and appreciate the styles just by hovering over the list.Side-by-side comparisons aside, Konsole also offers a number of other improvements. Among them, split-view mode, faster scrolling (thanks to a smarter line redrawing scheme), hotkeys and more.

Saturday, May 26, 2007

Wubi makes Linux on Windows simple

Computer giant Dell made big news yesterday when it began shipping desktops and laptops pre-installed with Ubuntu, a popular Linux distribution. In terms of prepackaged operating systems, users have basically been stuck for a long time with the solitary choice of Windows vs. Mac. The fact that consumers can now purchase a Linux machine with support from the distributor certainly validates the open-source movement and Ubuntu in particular.

Yet if you're curious about Linux or Ubuntu, it hasn't been very simple to install it on your Windows machine. Up until recently, the process has usually involved partitioning your hard drive for the Linux install and creating a boot CD from a downloaded ISO file.

Luckily, for those of us who are Linux-curious and either too lazy or too inexperienced to install a distro on our own, beta software called Wubi literally takes all of the hassle out of running Ubuntu on your Windows machine, and it can be removed from your system as easily as any other Windows application. All it takes to run Wubi is a recommended 1GHz CPU, 128MB RAM, and 3GB of disk space for the initial Ubuntu installation.

Monday, May 21, 2007

VISTA, FACTS OVERMINED....

After the much anticipated release of “the safest version of Windows ever”, Windows Vista, both business and home users alike --were amazed by the striking similarities between the Windows desktop client and Apple’s Mac OS X. And what followed corroborated that this was not a mere concurrence.

1GHz 32bit(x86) or 64bit(X64) processor, minimum 1GB RAM, DirectX 9 supported WDDM driver graphics card with at least a graphics memory of 256MB --if you ever fancy playing games. And not to mention the demanding system memory speed of 1800meg per second. In short, be ready to get your system up-upgraded and ruin yourself.

WHAT VISTA OFFERS:

Aero, the much touted 3D user interface experience with translucent icons,looks cool, but it cannot be the reason to invest so large in Vista for home users. The business and tech-savvy users who are interested in how-stuffs-work cannot be impressed by such flashy appearances. Vista will reduce to Windows Vista Basic mode, without Aero, unless you get an advanced graphics card installed.

Another concerning aspect for all users is regarding security. Vista was released as the most secure Windows ever with features like Windows Defender, anti-spam and phishing filters and Parental Controls. Vista is first OS that the Redmond giant released assuming that it would be attacked. Vista boasts of not wanting any antivirus applications; with its built-in facilities like Automatic backups, Performance Self-Tuning, and built-in diagnostics that help you keep your data protected and your PC running smoothly. The claim was thwarted with the detection of bugs in Vista, immediately after its release. A serious error was discovered in Internet Explorer 7 which will be of aid to hackers. Windows admitted these security threats but still claimed the OS to be the most secure OS one can get.


Connecting to various networks is a key capability in today's OSes. Vista’s Network Center makes it effortless not only to create secure ad hoc wireless networks, multiple networks and wireless peripherals, but manage network connections in a resourceful way. Then again, all OSes in the market does all of these and Vista offers nothing to give it an edge over others. The Unix based Linux OS clearly have an upperhand over all operating systems since it was primarily developed for multiuser and multitasking capabilities and over the years it has proved its merit.

Internet Explorer has got a major version change since the release of IE 6.0 in 2001--thanks to the phenomenal incarnation of the Open Source lad Firefox, is now the integrated browser with Vista. . Vista has an Opt-in block for ActiveX and Firefox does not authenticate ActiveX at all. As far as security is concerned, Firefox uses Google’s database to inform you of sites of suspected forgery and has anti-phishing features as well. And for your kind information, IE7 is competing with the previous version, Firefox 2.0, of the Mozilla Foundation and according to its media release the latest version of the browser, Firefox 3.0, is due towards the end of this year.

The backup facilities of Windows has changed little in the past decade, when the Secondary data storage technology explored new grounds. On the event of a catastrophic virus infection or failed software installation, system restores these copies thereby protecting your valuable data. To be loud and clear, you will get a multitude of softwares that equips you with the same facilities for your XP system and these features are built-in for UNIX-based systems.

Vista claims to protect kids online through its centralized Parental Controls that permits to set browsing controls and thereby restricting access to inappropriate sites. You are aware that even XP has a Parental Control feature and that how ineffective it is in its purpose. The enhanced version in Vista too; relies on websites, forums and personal websites to implement the proprietary tags and rating systems. If you want real protection look for free/open source applications such as CensorNet that are actively developed by those with an incentive to do so, the same people who use them!

The Windows Collaboration module uses peer-to-peer technology to let Vista users work together in a shared workspace. You can form informal workgroups and jointly work on documents, present applications and share viruses too.

Whether you like it or not, Gates &Co will withdraw the XP version of Windows within two years. You can either commence the process of switching over to Vista or plunge into the world of Open Source .

Creating a Dial-Up Connection

In this age of broadband and wi-fi I know it is only those unlucky guys go for a dial-up one. Anyway Linux is meant for all and with that simple note let me begin, first explaining what is a dial-up connection. A dial-up connection requires your computer's modem to dial a phone number that connects to your Internet Service Provider (ISP). Your computer may have a modem built in, or you may have to use a modem card if your system is a laptop.

To create a new modem connection in a Red-Hat system:

1. From the Applications (the main menu on the panel) menu, choose System Tools => Internet Configuration Wizard.

2. A window opens requesting your root password. Enter it and click OK.

3. The Add new Device Type window opens.

4. The left pane lists each of the possible connections. Choose Modem connection and click the Forward button.

5. Red Hat Enterprise Linux probes for a working modem installed on your computer. If it does not find one, make sure that you have a hardware modem, and that it is installed correctly.

6. The next screen contains three drop-down boxes.

o Modem Device — This menu lists all modems installed on your system. Select the correct modem for this connection.

o Baud Rate — Select the speed of your modem. This list is in bytes: a 56.6K modem is listed as 56700.

o Flow Control — Select Hardware if your modem is a hardware device installed on your system.

When finished making your selections, click the Forward button.

7. The next screen requires information about your ISP. For users in the United States, type the correct information in each field:

o Prefix — Enter any prefix necessary to reach your access number. This might be "1" if the call is long distance, or "9" to reach an outside line.

o Area Code — Enter the area code of your access number, if necessary.

o Phone Number — Enter the access number for your ISP. Do not enter "dashes" in the number.

o Provider Name — Enter the name of your ISP.

o Login Name — Enter the login your ISP has given you.

o Password — Enter the password for your account.

Finally, click the Forward button.

8. On the next screen, select whether your system must automatically obtain your IP address settings or whether your system must use the same IP address every time you connect. To use the same address every time, enter the address your ISP gave you into the Manual IP Address Settings fields. Click the Forward button to continue.

9. The final screen is a summary of the values you have entered. Review them to be sure that all settings are correct. Click the Apply button to create your new connection.

10. The Network Configuration screen appears, showing your new connection along with a list of all other connections on your machine.

11. Test your new connection by clicking the Activate button. If your connection works, go to File => Save from the Network Configuration main toolbar, then exit the application. If your connection does not work, click the Edit button to change the settings.

To access your connection later, select Applications (the main menu on the panel) => System Settings => Network. The Network Configuration window opens. Select the appropriate connection and click Activate.

Sunday, May 20, 2007

WAT TO DO WHEN XWINDOW FREEZES

If your Xwindow freezes sometimes, here are two ways that you may try to kill your system. The first is the simple simple way of killing your X server the key combination: Ctrl+Alt+Backspace

The second way is a little more complicated, but it works most of the time. Hit Ctrl+Alt+F2 to startup a virtual console, then log in with your user name and password and run:

# ps -ax | grep startx

This will give you the PID of your Xserver. Then just kill it with:

# kill -9 PID_Number

To go back to your first console, just hit Alt-F1


Friday, May 18, 2007

C PROGRAMMING IN LINUX

If you are new to Linux, you will be in dilemma about how to code in C. Remember that Linux is fully coded in C !!!!!. and C is developed in an intention to develop UNIX !!!!. So coding in C is not a myriad task at all. The following steps will help you to achieve it.


1) Create a new file with extension .c in your folder.

2) Open the file and write the program. Finish it by saving (for eg; file1.c here).

3) Right click on the desktop and open terminal

4) In the terminal, change into your folder by using cd command.

5) Type gcc file1.c and press enter. If there are errors, they will be listed here.

6) Successful compilation would lead to the creation of an executable file a.out . Run that by using the command ./a.out . The result will be displayed in the terminal.


NOTE:- In Linux, header files like CONIO.H are not present. Including it in your program would cause compilation errors. Also main should return a value to the O.S.

THE SHELL INTERFACES


Common ways to get into a shell are

  • No GUI - if your system has no GUI, you must enter commands from shell.
  • Terminal - if GUI is loaded , open terminal by right clicking and selecting terminal

Default prompts:

  1. If you are a regular user ,while opening the terminal ,you will see a dolor sign as $
  2. If you are a root user ,you will see a hash prompt as #

The concept of virtual consoles:

In Linux there are six virtual terminals, in which you can log in .These terminals can be accessed by pressing CTRL+ALT+ (F1/F2/ ... F6). Your graphical window is a graphical shell (CTRL+ALT+F7). These virtual terminals can be useful when a GUI program hangs. In such occasions open any one of the virtual terminals and login as that user (GUI). Then run ps –e followed by kill command. You can login as the same user or any other user in any other terminal. The virtual console proves the concept of multi-user and multitasking. This is possible by running the same processes in more than one virtual terminal. Once in a virtual console, you can switch back to GUI by pressing ALT+F7. Or you can start a new GUI from any one of the virtual consoles.

BASIC LINUX COMMANDS

The following are the basic Linux commands, and are listed with their uses.

1) ls -: list the contents of the current directory. Only files that are not hidden are listed.

2) ls –la -: list the hidden files too, with sole permissions displayed

3) cd :- chage directory to the specified one . (eg: cd /tmp , where tmp is the specified directory)

4) cd.. :- change to the parent directory

5) pwd :- list the present working directory

6) ps –e :- list all the currently running processes with process numbers

7) kill :- kill a process ( eg : kill 4709 where 4709 is the process no)

8) mkdir :- make a new folder. ( eg: mkdir /new )

9) su :- if you are a regular user, typing su , then root password will give you permissions of root user.

10) df –h :- list the current usage status of all drives associated with your Linux system and the available free spaces.