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