UNIX Standard Commands

Navigating | Moving, Copying and Deleting Files | Creating, Moving, Copying and Deleting Directories |
Searching Files and Directories | File and Directory Permissions

SSH (Secure Shell/Telnet) is a program that enables you to log into a remote host/terminal securely as though that terminal were attached directly to our server. From Telnet, you can perform UNIX commands such as the ones below.

You will need to use a program supporting SSH to log into our server.

If you are using a Windows environment, there’s a freeware program called “Putty” that you can download from http://www.chiark.greenend.org.uk/~sgtatham/putty/latest/putty.exe.

If you are using a Mac, there’s a free program called “Nifty SSH” you can download from http://www.lysator.liu.se/~jonasw/freeware/niftyssh.

Within the program, make sure you select SSH. This will change the Port to 22. Your host name is your domain name (do not put "www" or "http://" in front of your domain name). Your username and password are the same as your FTP login.

Navigating UNIX:

/  (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 -alR  (lists filenames + information in all subdirectories)ls -alR | more (lists filenames + information in all subdirectories, pausing when the screen become full)
ls -alR > result.txt  (lists filenames + information in all subdirectories, and ouputs the results to a file instead of the screen)
ls *.html  (lists all files ending with .html)
ls -al /home/usr/bob/  (lists files + info for /home/usr/bob)

cd  (changes you to a new directory)
cd images
cd /  (changes you to the root directory)
cd /home/usr/images
cd ..  (this goes back one 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)
rm *  (delete all files in your current directory)
rm *.html  (delete all files ending in .html in your current directory)



Creating, 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)

rmdir [directoryname]  (remove a directory if it is empty)
rm -r [directoryname]  (remove a directory and all files in it)


Searching Files and Directories

find / -name [filename] -print  (search the whole server for a file)
find . -name [filename] -print  (search for a file starting with the current directory)
find / -name [directoryname] - type d -print  (search the whole server for a direcory)

grep [text] [filename]  (search for text within a file)

sed s/[oldtext]/[newtext]/g [filename]  (searches file and replaces all occurances of [oldtext]
with [newtext]


File and Directory Permissions

There are three levels of file permission: read, write and execute. In addition, there are three groups to which you can assign permission, the file owner, the user group, and everyone. The command chmod followed by three numbers is used to change permissons. The first number is the permission for the owner, the second for the group and the third for everyone. Here are how the levels of permission translate:

0 = --- (no permission)
1 = --x (execute only)
2 = -w- (write only)
3 = -wx (write and execute)
4 = r-- (read only)
5 = r-x (read and execute)
6 = rw- (read and write)
7 = rwx (read, write and execute)

Here are the most common file permissions used:

chmod 604 [filename] (minimum permission for www HTML file)
chmod 705 [directoryname] (minimum permission for www directories)
chmod 705 [filename] (minimum permission for www scripts & programs)
chmod 606 [filename] (permission for datafiles used by www scripts)
chmod 703 [directoryname] (write-only permission for public FTP uploading)
chmod 755 [filename] (permission for CGI scripts)



Call toll-free 1-877-903-2475

Web Hosting | Domain Names | Web Site Design | Marketing | Reseller Hosting
© Copyright 1998-2008 Identity Website Hosting, Inc. All rights reserved.
BBBOnLine Reliability Seal