

|
 |
UNIX - Command-line Access
Certain advanced functions require a command line. This section can be used as a reference for using UNIX. If you are not already familiar with issuing commands directly through
a command line, we recommend that you do not attempt to use this functionality.
Note:
In this section, when something is specified in brackets, such as [command] or [filename], it indicates that you must input your own information. Do not include the brackets in your command.
Note:
UNIX is case sensitive. For example "index.html" and "Index.html" are different files.
On this page:
UNIX Commands:
Connecting to UNIX
- To use UNIX functions, you must first access a command prompt by connect to your account using SSH.
- After you have connected, you will see a command line prompt like this one from PuTTY.

This is where you enter your commands.
TOP
Getting Help - UNIX Man (manual) Pages
To save space on your account, we did not include the UNIX man pages (manual). For a PHP version of this document, go to: http://www.linuxpakistan.net/man.html
TOP
Navigating in UNIX
pwd
Shows the full path of the current directory
ls
Lists all the files in the current directory
ls -al
Lists all files and information
ls -alr
Lists all files and information in all sub-directories
ls -alr | more
Same as "ls–alr" pausing when screen becomes full
ls -alr >[ file.txt]
Same as "ls–alr" outputs the results to a file
ls -al /home/usr/[name]/
Lists files and information for /home/usr/[name]
ls *.html
Lists all files ending with .html
cd [directory name]
Changes to a new directory
cd ..
Changes to directory above current one
TOP
Moving, Copying, and Deleting Files
mv [old filename] [new filename]
Move/rename a file
cp [filename] [new filename]
Copies a file
rm [filename]
Deletes a file
rm *
Deletes all files in current directory
rm *.html
Deletes all files ending in .html
TOP
Creating, Moving, Copying and Deleting Directories
mkdir [directory name]
Creates a new directory
ls -d */
Lists all directories within current directory
cp -r [directory] [new directory]
Copies a directory and all files/directories in it
rmdir [directory name]
Removes a directory if it is empty
rm -r [directory name]
Removes a directory and all files in it
TOP
Searching
find . -name [filename] -print
Searches for a file starting with current directory
grep [text] [filename]
Searches for text within a file
TOP
Editing Text
There may be times when you wish to edit the contents of a file directly on the server. VIM is a popular text editor which will allow you to do this.
To start VIM, enter "vi [filename]" at the prompt.
TOP
|