Using TelNet

Telnet is a fast and easy way to make changes to your files and folders located on your server. It comes in handy for several things including: Unzipping Files, Deleting Huge Folders, Changing File Permissions etc. This article will explain how to use telnet for unzipping a file on your server. You may want to download the Telnet Program PuTTy.exe it is a free download and it is very simple to use.  You will want to install PuTTy.exe and configure it for your server connection (like your FTP program).
See Also: PuTTy Documentation
Note: If you are unsure if you have telnet access or have never tried using telnet you may want to contact your hosting provider and ask if you have telnet access.

Unzipping Files On Your Server

This comes in handy when you have a huge file or an entire site that you want to upload via FTP. Some FTP programs take a long time to create the folders on the server and populate those folders with the appropriate files. Sites bigger than 5MB take awhile to upload, but that same 5MB site in a ZIP file is only around 1MB depending on the types of files included.

Instructions:

1. Add all the files in the ROOT of your directory structure (that you want to include) to a compressed file (ZIP Format) using WinZip or another program of your choice. Name the zip file “0.zip” (I like to choose small names for these files since I will be deleting them after they are unzipped).

2. Upload the file 0.zip to the ROOT of your domain.

3. Once the file is uploaded open your telnet program and navigate to the root of the domain that the 0.zip file is in.
Note: If you are logging in to a server you will be at the root of the “server” if you only have one domain you will be at the root of your domain so no navigation is necessary.

4. Type unzip 0.zip (HIT ENTER) – It may ask you if you want to continue, if so the answer is case sensitive.


Other Telnet Commands

Navigating

  • /
    • refers to the root directory on the server
  • ./
    • the current directory that you are in
  • ../
    • parent directory of your current directory
  • pwd
    • shows what your current directory is – giving the full path
  • ls
    • lists all the files in your current directory
  • ls -al
    • lists filenames + information
  • ls -aR
    • lists filenames + information in all subdirectories
  • ls -aR | more
    • lists filenames + information in all subdirectories, pausing when the screen becomes full
  • ls -alR > result.txt
    • lists filenames + information and outputs the results to a file
  • ls *.html
    • lists all files ending with .html
  • ls -al/home/usr/sam/
    • lists files + info for /home/usr/sam
  • cd
    • changes you to a new directory
  • cd /
    • changes you to the root directory

Moving, Copying, and Deleting Files

  • mv [old name] [new name]
    • move/rename a file
  • cp [filename] [new filename]
    • copy a file
  • rm [filename]
    • delete a file

Moving, Copying, and Deleting Directories

  • mkdir [directoryname]
    • creates a new directory
  • ls -d */
    • lists all directories within current directory
  • cp -r [directoryname] [new directoryname]
    • copy a directory and all files/directories in it
  • rm -r [directoryname]
    • remove a directory. You will be prompted to answer “Yes” or “No” for whether you would like to delete each file in the directory
  • rm -rf [directoryname]
    • remove a directory and all files and folders in it (no prompting).

Searching Files and Directories

  • find / -name [filename] 2>/dev/null
    • search the whole server for a file
  • find ./ -name [filename]
    • search for a file starting with the current directory
  • grep [text] [filename]
    • search for text within a file