Voltar's Newbie Webmaster Resource

Basic Telnet Help for the PC
by Barron


By now I am assuming that you've already selected a paid host. You have been told to make sure your web host set your account up on a Unix box (server). If you didn't do that, you going to wish you did. Your new web host asked if a Linux box is ok, yes it is. Most use the Apache web server, and that is what you are after. If not now, later you will be working with .htaccess, CGI, SSI, FTP and Telnet. The most often heard term from more experienced users is "Telnet in and do such and such". All good web hosts provide Telnet access. If not, consider changing your web hosts.

To understand how Telnet is going to help you and save you a great deal of time, you need to know some basics. Windows is a one user at a time operating system. That means when you start windows only one person at a time can be logged into that machine. That is not the same as being logged into the network, that is two different things. Linux and Unix are different in that many users can be logged it at once from the same computer.

That is possible because each user has its own shell. To understand the shell, right now, click start | programs | msdos prompt. A window will popup with a black screen, you are now in the DOS shell. It uses the command line only, there is no GUI (Graphical User Interface). Type exit at the prompt, the window will close.

Windows 95,98 and ME all have a Telnet program that loads as a default on install. To open the Telnet program click start | run | and type in telnet | click ok. A popup window will open.

On the server side, your web host, has a Telnet server running. BTW, for the very beginner, servers are software packages, not machines. Even though some machines a built specificly for running server software, you can turn your PC into a server by just loading the software. Telnet in it's basic form is a shell program that allows you to emulate (pretend) that you are actually sitting in front of the server, using its monitor, just as if you were physically at your web host place of business. The telnet server acts a translator for the linux operating system itself, handing off commands to the server. Telnet works and acts just like the MSDOS prompt. That is, there is no GUI (Graphic User Interface). It only uses the command line.

Open your Telnet program and lets get used to what you see. At the top of the window is the normal tool bar, and you have a cursor in the white area below that. Click file | remote system. There is a smaller popup that appears with three fields.

The first field asks you for the "Host Name" you want to connect to. Telnet will except either the IP address or a URL, 111.222.333.444 or telnet.foo.com. If you don't know this information, contact your web host, they will give it to you.

The next field asks for the port, but defaults to the option "telnet". Telnet uses the widely excepted port 23. The telnet program uses this as a default also, so don't change it unless your web host tells you to.

The next field asks for "Term type". This is the terminal language you want to use. The default is "vt100". This is widely excepted, don't change it unless your web host tells you to. Now click "connect".

Once connected, you may or not see on the first line the Host name you are connected to. Then you will see a prompt that asks for your username. Type that in and press enter. Then you will be asked for your password. Type that in and press enter. You will not see your password appear on the screen, so go slow and be accurate. WARNING: Linux is case sensitive. EVERYTHING is case sensitive including, usernames, passwords, files, directories and commands. Username, username, USERNAME are all different to Linux. The default for Linux is three tries to log in. If you don't succeed in three tries, the telnet server will disconnect you and you will need to re-connect. If you mess up and get disconnected several times you will look like a hacker and at some point web host might ban you. Afterwards, there will be a short pause while your being authenicated, then a prompt will appear.

Ok, now you are logged in and the fun really begins. The system administrators at the web hosts are very good at what they do, that is, you can't mess anything up but your own files, so don't be afraid to experiment.

The first thing you see is the prompt. It is also the first difference you see between DOS and linux. Every host is different but you will see something like "nix:user$" or you might only see a symbol "#". The part before the colon is you, or the name the webhost gave to you, it may not be your username. The part after the colon is the directory you are in, this may or not be your username. This is your default directory assigned to you. This may or may not be the "root" directory off your web pages. Again, if you don't know which directory your pages are served from, contact your web host. The symbol "$" means different things at different times to linux and programmers, but you will always see a symbol and means nothing to you and me as it relates to the prompt. DOS uses the ">", C:\windows>.

Here I should explain a little about the part after the colon and the directories. In DOS you will see the drive letter and the directory you are in: "c:\windows\>". Linux doesn't use the drive letter. Drive letters are named differently, and beyond the scope of this article. Also, Linux use the forward slash "/" for navigating the directories, unlike DOS that uses the back slash "\". You see: "nix:user$", the directory tree that linux sees is: /home/user. In DOS it would be: C:\home\user.

I assume at this point you have already uploaded some files to your web host. If not, go ahead and do so. We need them for the following examples.

All commands on linux, just like in DOS, come with some form of help built in. In DOS you would type in "dir /?". With linux you can use the man pages, "man <command>". Or, "<command> --help" (notice the space) and on some machines, "<command> info".

The first command we will work with is "ls". That is the same as "dir /w" in DOS. It lists the contents of the directory in columns. Everything will be in alphabetical order with the files and directories with capital letters first. My web host puts a "/" on the directories, this is not a default, your web host may not do that. Or may choose a different way of marking the directories for you.

If you are like most webmasters you will have a directory called "images". If you haven't uploaded any files yet, lets go ahead and make the directory. Type "mkdir images". That is the same as the DOS command.

To change to the directory type "cd images". Exactly the same as in DOS. Notice the cursor, it will look like: "nix:images$". Remember, in DOS it would look like: "C:\home\user\images>". Like DOS, you can "jump" to different directories by typing in the full path. This can throw you off a little at first. Remember, the directory tree is different than what you see. The full path in linux includes "/home/user". So the full path to your image directory is "/home/user/images". If you want to "jump" to that directory you would type, "cd /home/user/images". Its possible that your web host has a different way of handling where your default directory and web pages are at. If the above command doesn't work for you, call your web host for the full directory path.

Now, lets go back to your home directory, type "cd .." (notice the space). In DOS the command is "cd.." (no space).

We made a directory, now lets make a simple text file. For this you will need a text program. Commonly known as a text editor. In DOS you would use is "edit". The linux equivalent of edit is a program called "pico". There are others but I use this one because it was the first one I ever tried and I am used to it. In my version of Unix I use "vi".

Linux doesn't use the extension .exe like DOS. If fact, it isn't required to use the restriction of three character extensions, like ".htaccess", or use the dot, "mydoc" is permissible. Mostly linux uses the part after the dot for description of the file, not associations like Windows. Windows uses .ini, linux uses .conf.

Pico allows you to name the file while you opening the program. Or you can name it later. Lets name it later in this example, type pico. The text editor will open and fill the screen. Type in something simple, "This is my first time using telnet.". The cursor will be just to the right of the word "telnet". Now take your mouse and place the cursor anywhere in the word "first". Notice it didn't work. That's because the Telnet server cannot interrupt the mouse movement on your computer, instead you have to use your arrow keys to move the cursor around. You can play with the commands for pico listed at the bottom of the screen later. For now, press control+x and close pico. At the bottom of your screen you are prompted with the question, "do you want to save changes in buffer?", the answer is yes. Then you will get a prompt to name the file. Name it "mydoc" with no extension, and press enter. You should be at the prompt.

Now lets pretend that you have a html page that needs one little correction. Up until now you opened your html editor, or notepad, made the change then saved the file, then opened your FTP program, and made the upload. Whew, that is a lot of steps. Instead, you can "Telnet in", type "pico mydoc" and make the change.

So lets do that. Type "pico mydoc". Make any change, press control+x, answer yes to save the buffer. But now, notice the question asks if you want to save to "mydoc". You can do two things here, save it as "mydoc" or save it as a different file name, i.e. "mydoc2". If you save it as a different file name, just like DOS, the original file will remain without the changes you made.

Lets pretend that you have the file "mydoc" in the wrong directory and want to move it. There are two commands to do this with. The first is "cp", just like the DOS "copy" command. Type "cp mydoc /home/user/images". That will copy the file to the images directory and leave a copy of the file in the original location.

Or, you can use the "mv" command. Short for "move". This does the same thing as "cp" but you can rename the file during the move. Type "mv mydoc /home/user/images/mydoc3".

Pretty simple so far isn't it. There are some more basic commands though. Lets go to the image directory and work with a with a couple of them. Type "cd images". Type "ls". You should see two files, mydoc and mydoc3. Lets delete mydoc. The DOS command would be "del mydoc", but in linux its "rm". Type "rm mydoc". If you want to check that is really gone, type "ls".

There may come a time when you want to rename a file. In DOS you use "ren <old filename newfilename>". In the linux you use a command you already know, the "mv" command. Thats right, you guessed it, just "mv" the file to the same directory, just don't use the path, Type "mv mydoc3 mydoc".

Now lets erase everything you see on the screen. The DOS command is "cls", the linux command is "clear". Type clear, and poof, everything is gone except the prompt. Is this cool or what. Like DOS, if you want to see the time and date, type "date".

We have typed enough commands now that I want to show you something else that is cool and will save you a lot of typing. Lets say you want jump to a different directory, so you typed in something like "cd /home/user/amateur/sponsor/fpa1/nograhic". Then, you get and error that says "no such directory". Instead of typing the whole line over again, press your up arrow key. Linux will show you all the previous commands lines you have typed in. The DOS equivelant is "doskey", but its a program (utility) you have to type in at the dos prompt at the very beginning of your session or have it load at boot time. When you press the up arrow, re-read the line, you will find out that you misspelled, you typed in "nograhic" and it should have been "nographic". Just make the correction and press enter. Isn't that cool!

As you can see, the path names can get very long, and you can only see the current directory in the prompt. So, if you get confused, or lost, and cant remember where you are at exactly type "pwd". In DOS you would type "chdir".

Ok, now you get to play. Clean up all the files called mydoc, that is delete them. When your through, end your telnet session. Type "exit", just like in DOS. That will disconnect you from the web host. Btw, you don't have to be in any certain directory, you can do it anytime. The next time you "telnet in", you will go straight to the default directory.

If you want more help with commands, remember the "man <command>". Also do a search on Unix or Linux.



Written and contributed
by Barron


More Webmaster Resources Click Here

Back To VNWR