Tuesday, May 26, 2009

I have to sleep!!!

I really need to sleep man. This nettech is beating the hell out of me. But I must admit, its fun. We are configuring routers, DNS servers, DHCP servers and a lot of other things. I was using Linux as my primary OS since past two semesters but now I am actually seeing the innards of the system. Half of my class time is spent with /etc directory. Its great man. Santu sir says that if you can read the /etc completely then you will master the Linux. I have started, though the directory is really huge. Me and Avinash are actully topping the Swapan sir's troubleshooting class. A couple of days before some girls asked me "What do you eat? You have answer for every question." Now how to answer such a question. I am planning to buy a domain name. I think I'll have it by the mid of june. See you on my domain later. :)

Sunday, May 24, 2009

Linux Tricks

Here are a few tricks which I have learnt in past from different sources.
  • Create two file with same name : Have you ever seen two files with same name in same folder???.... Well I don't think so...Here is how to make two file with same name. Create the folder where you want to make these files. cd to this folder. Now type this $ touch "aditya" and $ touch "aditya ". Obviously most of the people are not able to notice the space after aditya and will definately bang their head on wall or complain that there is a bug in Linux.
  • Allow root to do remote login : If you have done telnet then perhaps you must be aware that root cannot telnet directly. He has to login as a normal user and then type $ su - then the password. But if you want root to login directly from login screen then edit the file securetty present in /etc and add the pts/x terminal from where you want to login, here x is the terminal number.
  • Change the Pre-Login message : To change the message displayed on the login screen of command line login, go to /etc and edit the issue file. Just type the message you want and restart the computer.
  • Change the post-login message : If you want to display a message just after the user logs in then just edit the motd file present in the /etc directory.
  • Do not allow any users to login : If you do not want any user to login in your server then just change the permission of passwd file present in /etc by typing # chmod 700 /etc/passwd. Alternatively you can also edit the passwd file but be extremely careful. You can also create a file called nologin.txt in /etc folder. Just type the message you want the users to get when they try to login.
  • Do not allow specific users to login : You can change the permission or owner of the home directory and the victim user will never be able to login.



The commands in this post are dangerous. You should backup all your data first.


Most of the commands will require you to be the root of the system. If you are not root then first take the permission from the root and do tell him/her your intentions
.

Run the commands at your risk. Author is not responsible for any harm done to the system.

Files are written in orange and commands in blue.

Linux commands for beginners

Most of us are afraid of Linux commands, so here is my post to help those people. Although most of the things can be done using GUI now a days but knowing commands help a lot, specially when something goes wrong with your GUI. If you are in a fix about some command then there are two ways to get out of the problem.
  • help : "$ command-name --help ". It shows the syntax and some basic explaination of the command.
  • man : "$ man command-name ". It shows more details about the command.
  1. cd : Everything in Linux lies in a directory like thing called " / " or the root or the mount point of the file system. cd command is just like the cd used in windows i.e. it is used to navigate among the folders or directories. For example to go to a directory "/home/adimania" type $ cd /home/adimania and there you are.
  2. ls : To check the contents of a particular folder type $ ls . It will show the list of the files and folders present in the directory. Thats not all there is a lot more to ls than this. Use $ ls -al to view details about the file including the hidden ones!!! If you dont want to see the hidden files then simply do $ ls -l
  3. cat : This command is used to read the contents of a file or to write/append it. For example to read a file named adimania simply write $ cat adimania . Or to append it write $ cat > adimania . This will overwrite the file adimania. To append it you should write $ cat >> adimania. Two important point worth noting here are that your present working directory should be the one where the file to be read/append is present and that you cannot completely edit the file by cat command. Most probably you will end up overwriting it, so use cat for reading and avoid writing with cat command
  4. pwd : This command simply tells us about the present working dirctory of the user firing it. For example user adimania upon login will go to /home/adimania by default. so immidiately on login if you write $ pwd then output will be /home/adimania .
  5. mkdir : This command is used to create directories provided you have permission to do it. For example if you want to create a directory on /home/adimania you can do so by writing either $ mkdir /home/adimania/aditya or $ mkdir aditya . Can you tell me the difference? .... First command will run from anywhere, you just need the permission, while the second will work only if you are present in /home/adimania. In other words former is the absolute path and latter is the relative path.
  6. rmdir : This command is used to remove or delete an empty directory. Mind it, the directory should be empty. To delete aditya created by previous command you should type $ rmdir aditya. If the directory is not empty then an error message will flash.
  7. rm : This command will come to rescue when the directory is not empty. rm command basically deletes the files present in the directory. If there exists a file called friends in aditya directory then you should first delete the file friends by writing $ rm friends or you can also write $ rm /home/adimania/aditya/friends. You can also delete all the files in one go by writing $ rm *. The rm command can be used to delete a non empty folder just by writing $ rm -r /home/adimania/aditya. Here -r stands for recursively.
  8. mv : Ths command is used for moving a file or a folder from one place to another. To execute this command you need to write $ mv /home/adimania /home/adimania/aditya. Here first path is the source from which the folder/file is to be moved and the second one is destination where the moved file will ultimately reach. You can also use this command to rename any file or folder.
  9. cp : This command is used to copy a file or a folder from one place to another. The command format is similar to mv command. To execute this command you need to write $ cp /home/adimania /home/adimania/aditya. Here first path is the source from which the folder/file is to be copied and the second one is destination where the copied file will ultimately reach.
  10. touch : This command changes the time stamp of the files. If the file does not exist it will create an empty file. It is typed as $ touch aditya.
  11. echo : This command displays a text or a value contained in a variable. It can also be used to to write the output in a file by using '>' or to append use '>>'. For example $ echo hello will give output as hello. To write "Hi how are u?" in a file hello.txt you can execute $ echo Hi how are u? > hello.txt and you will get desired result. Most wide use of echo command is in getting the values of variables. For example to know the value stored in PATH environmental variable simply write $ echo $PATH.
more commands to be added soon. watchout for this space ;-)

Tuesday, May 19, 2009

Five days in Nettech

Well five days just came and went away. These were perhaps some of the most hectic days of my life after Bansal Classes, Kota. Swapan is simply superb and so are rest of his faculty members. That guy can actually make the most boring subject the most interesting with is weird yet simple examples. Now at least I can say that I can design a basic network. "Think like a chor and act like a police." is what is says to us.
Santu sir is teaching us Linux. I had never explored /etc so much. He says that if you can edit /etc on your own without any one's help then perhaps you are the best Linux engineer possible. And I am trying my best on that ;)
More on it later. I'll publish some basic Linux commands very soon. Keep waiting :)

Saturday, May 16, 2009

Linux : The so called "Geek's OS"

Linux, since a long time, is well known as a geek's operating system. An OS with commad line interface, where one has to remember all “so complicated” commands wih a handful of arguments and options and all that stuff. I remember when I tried Linux first time some six years ago. I was frustrated in a couple of hours. I wasn't able to access my windows drives (FAT32). Applications were hard to find and harder to install. I switched back to windows within a couple of weeks.


But with changing scenerio and time Linux has emerged as not only one of the most powerful operating system but also more user friendly than one can ever imagine. Think about it, an OS which costs you nothing, provides a mind blowing GUI, with tons of options for customising the desktop and its own behaviour. Yes, this is today's modern Linux. Its user friendliness beats that of windows in some aspects (actually in most of the aspects, if you ask me). Its repositories are huge and contains so many application programmes than your computer can possibly support (unless you are running a supercomputer in a top research facility ;] ). No more learning those nitty-gritty commands is required. A double click of standard usb or ps2 mouse is more then enough. Just install a Linux and have fun. You can access your files just by clicking them. Linux comes preloaded with most of the drivers, so you need not to install them separately. Like the touchpad scroll and other media keys of my laptop do not work with windows unless I install all the drivers individually from diffeent cds but this is not an issue with Linux, Everything works fine without installing any more drivers.


Let us compare some usual windows applications wih Linux applications and see the result:-


  • Multimedia applications : While Windows is bundled with Windows Media Player, Linux comes loaded with Movie Player and Rythm Box (GNOME desltop environment) or Dragon Player and Amarock (K desktop environment or kde). While both the desktop envirnment players are bundled with many more codecs than Windows Media Player, KDE players are more powerful than GNOME's although GNOME provide a more simple user interface. People using players other than Windows Media Player will be glad to know that players like vlc and real player are also available for Linux and that too free of cost. Although vlc player is loaded with most of the codec you will use in your entire lifetime but still if something is missing then Codina will come to rescue. Codina auto detect the missing codec, search it (both free and proprietry) and will install it on your wish (by wish I mean to say a mouse click).

  • Office Suite : Most of the Linux distros are bundled with Sun's OpenOffice. It's a complete office suite providing a lot more than MS-Office. MS Word is replaced by OpenOffice Writer. Powerpoint is replaced by Impress. Excel is substituted by Calc and Access by Base. You can do a lot more than usual MS-Office work with these applications. There is no need to install a pdf converter sepearately, it is integrated with these applications, you just need to click a button. The default file extention is not the same as that of MS-Office but it completely supports MS-office formats (upto office 2003, 2007 is on the way). Yes!! you can save your document in the format you want. Save it as .doc or .odt (the default OpenOffice format) or as .pdf or as any other given choices. Now try that with MS-Office!!!

  • Internet Applications : Most of the Linux uses Mozilla Firefox as its default web browser although other browsers like Konqurer (KDE) and Epiphany (GNOME) are also available. Most of the users find firefox good enough so there is no need to install another web browser. Infact many of the Windows user use Firefox instead of Internet Explorer. Now lets talk about chat clients. Well there is an extensive list of such clients which are powerful and yet so simple that its a child's play to configure them. I am currently using Pidgin for gtalk. It supports gtalk, yahoo messenger, aim, msn, myspace, irc and a lot more than I can remember. So there is no need to install different clients for gtalk and yahoo messenger one single client will suffice. And yes, it looks coolt. Alternatively you can use Kopete (KDE default) which also support a lot of protocols. IRC clients like Xchat are already well known to most of the users hanging on irc. Evolution is also present as a subsitute to Outlook. Also one can always install Mozilla Seamonkey suite which is a complete internet applicaion suite.

  • File System Browser : Just like Windows have Explorer Linux also has file system browser like Dolphin (KDE) and File Browser (GNOME). It is needless to say thet they are powerful, more than Explorer. Ofcourse it is loaded with all the usual features but one feature which I like most is that that you can open more than one location within same window in tabs or even partition the the window and see two or more locations simultaneously. Isn't that way ahead than Windows Explorer!!

  • Other Utilities : Linux comes loaded with lots of softwares like cd/dvd burning tool, a basic text editor, a tool for taking screen shots, encryption utilities and a lot of other “this and thats”. Lets talk a bit more about these application tools. Linux comes with K3B (KDE) or Brasero (GNOME) bundled with the distros so you need not to install any burning software explicitly. Linux editors are the substitutes for notepad but way useful. They are a lot helpful for programmers than notepad because of features like highlighting and color coding the programming language keywords and is also helpful in customising the indents for sensitive languages like python. Unlike Windows, Linux provides a screnn shot tool which can be used to click entire screen or a window or you can simply specifiy the area you want to be clicked. Ofcourse Linux' security is something well known. Just let me tell you this, its really difficult to hack a Linux and Linux also has so less number of viruses that there is practically no need of an anti virus.


To conclude this article I will just say that being open source doesn't mean that software is weak in any sense. So what are you waiting for?? Try a linux distro now. Its completely free of cost and trust me you will love it.

Friday, May 15, 2009

The First Post On the Second Day

Phew!! This is my second day on the training and seriously its hell tiring. I have classes from 9:00am up till 8:30pm. Oh by the way I am doing my training on "Networking and Ethical Hacking". Its fun, requires hard work though but I must say Nettech and Swapan has made it interesting. For the first time I saw an actual router in my hand and an optical fibre cable and an NIC card and lots of other things. Although this tight schedule is keeping me away from python and mandriva, but of course I can always get back to them whenever I want and seriously I think its worth it. More on my training later. I am writing an article about Linux. I have to finish it first.