Tuesday, May 6, 2008

Telnet Commands

COMMAND: pwd
USAGE: The pwd command tells you what the current working directory you are in on your Virtual Server. EXAMPLE: Simply type "pwd" at a telnet command prompt and it will return something like "/usr/home/vserver/etc"

COMMAND: ls
USAGE: The ls command lists the files and subdirectories of the current directory you are in. You can also add some arguments to the ls command to make it more meaningful. "ls -F" will append a forward slash to the subdirectory names so you can easily distinguish them from file names. "ls -a" will show all hidden files such as .htaccess files. "ls -l" will show detailed information about each file and directory, including permissions, owners, size, and when the file was last modified.
EXAMPLE: Type "ls -al" at a telnet command prompt and it will return your file names including hidden files, and a forward slash will be inserted in front of subdirectories.

COMMAND: mkdir
USAGE: The mkdir command makes a new directory. Type the command "mkdir directory" at a telnet command prompt and replace directory with the name of the directory you want to create.
EXAMPLE: Type "mkdir temp" at a telnet command prompt to create a new directory called temp.

COMMAND: rmdir
USAGE: The rmdir command deletes (removes) a directory. Simply type "rmdir directory" at a telnet command prompt and replace directory with the name of the directory you want to delete.
EXAMPLE: Type "rmdir temp" at a telnet command prompt to remove a directory called temp.

COMMAND: cp
USAGE: The cp command copies a file to a new location or filename. Simply type "cp filename copyname" at a telnet command prompt and replace filename with the name of the file you want to copy, and copyname with the name of the new copy. You can also add a directory structure if you want to copy the file to a completely new location. Simply type "cp filename directory/copyname" and replace directory with the name of the directory in which you want the new copy placed.
EXAMPLE: Type "cp home.htm index.html" at a telnet command prompt to copy a file called home.htm to a file called index.html

COMMAND: mv
USAGE: The mv command renames a file or moves it to a new location. Type "mv oldfile newfile" at a telnet command prompt and replace oldfile with the name of the file you want to rename or move, and newfile with the new name of the new file. You can also add a directory structure if you want to move the file to a completely new location. Simply type "mv oldfile directory/newfile" and replace directory with the name of the directory in which you want the file moved.
EXAMPLE: Type "mv test.conf test.old.conf" at a telnet command prompt to move a file called test.conf to a file called test.old.conf

COMMAND: rm
USAGE: The rm command deletes (removes) a file. Type "rm filename" at a telnet command prompt and replace filename with the name of the file you want to delete.
EXAMPLE: Type "rm test.html" at a telnet command prompt to remove a file called test.html.

COMMAND: grep
USAGE: The grep command finds lines in files that match specified text patterns. Type "grep "text" filenames" at a telnet command prompt and replace "text" with the word or phrase you want to search for, and replace filenames with the files you want to search in. To search all files in the current directory, simply replace filenames with "*" .
EXAMPLE: Type "grep "for sale" *" at a telnet command prompt to find any files in the current directory that contain the text "for sale" in them.

COMMAND: passwd
USAGE: The passwd command changes your Unix password. This affects your Unix e-mail account, and your FTP and Telnet access. If you have web-mail, this will not affect your web-mail passwords. If you have a FrontPage account, this will not affect your FrontPage authoring. To change your password, simply Telnet into your account, and type: passwd.
EXAMPLE [usr80@unix18 usr80]$ passwd Changing password for usr80 (current) UNIX password: New UNIX password: Retype new UNIX password: passwd: all authentication tokens updated successfully [usr80@unix18 usr80]$ _ Note: Your password is not echoed on the screen at all, not even with asterisks (*).

COMMAND: chmod
USAGE: The chmod command sets the permissions of a file or directory. In Unix files and directories have three sets of permissions: owner, group, and other (everybody else). You are the owner. Of course you want to be able to read your own files, make changes, and run scripts. The read, write, and execute permissions control this. The group and other permissions are next. Normally, you don't want anyone else to make changes to your Web site! By default, this is set to read-only. People can go into your directories, but cannot change anything, or upload files there. The most frequent reason to use this command is to make cgi scripts executable. Do this by typing chmod 750 filename at the command line. The 7 means read, write, and execute for the owner (you), while the 5 means read and execute, but not write, for the group. Others (other Web site owners on the server) have no access to your files.

No comments: