Web Stuff


Custom PC's



Onsite Diagnostics

Back Up/Storage

Sponsor & Affiliates Info




Past Sponsors






Message Board

Affiliate News



 Marns CDA

PC News

RSS to JavaScript


Local Gamming 

LAN Party Sites





Marns CDA Reference & Resources


Linux / Unix Commands and tools

Getting around on the command line

with unix/linux the directory structure uses forward slashes unlike Dos and windows but the same basic mentality of directory movement and file handling are used across platforms.

cd = change directory
       cd.. = move back one directions
       To move to a specific location use cd /directory(foldername)/dir/.....  
ls = list files and folders in the current directory
       Using the same principles as cd you can list files in a directory you are not currently located in by using the ls /directory path/directory path/desired ls directory
       there are a bunch of sub sorts that can be used when attempting to list a directory (ls) here are a few and how to use them.
       -s = size
       -t = sort by time
       -v = sort by version
       -r = sort in reverse order
       -a = all including hidden directories and files
       -l = use long list format or detailed listing
               Note: these can be used together in any combination.
               example: I want to list the files in the directory I am in and sort by size / the time they where made and in revers order. so the command I would use is ls -str.
for more information or commands you can see usage of these by typing ls - - help this will display a complete list of ls attributes you can use.

So what do you do when you want to look at a file well you have a few choices must common is either using the more command or using view/vi editor

more = displaying a file one page at a time to view the contents
       Using the space bare and the up/down arrows allows you to scroll threw the file. This command can be used like most other commands specifying the file directory path and name of the file desired to be opened.
       Example: more /dir path/file name

       There are also a set of commands that can be used to navigate the file you have opened. After opening the file using more (file name) use the following X controls to  move thorough the file.

               h or ? = help to get the list of command.
               SPACE = moves one line of text
               RETURN / ENTER = Displays next line of text
               q or Q = Exit or Quit
               s = skip forward next line
               f = skip to the next full screen or display the next page of the document.
               b or B = moves you backward
               (=) = displays the current line number
               /(pattern or string  desired to search) = allows you to search the document for a specific string of characters.
               . = allows you to repeat a command
       Note: there are more commands but these are the basics for more info do a # man more. oh by the way any time you see a # symbol that means a command prompt.

The next file manipulation tool for the command line is vi editor or if you just want to look use view.

Bellow is a pretty basic listing of commands to navigate and manipulate a file using vi. Also note view will not allow the user to change any part of a file so if you want to learn how to navigate within the vi editor try using view first then you don't need to worry about messing up the file you are looking at.



Commands for vi

man vi

at the unix/Linux prompt.

Starting an Editing Session

vi filename

where filename is the name of the file to be edited.

Undo Command
u = undo the last command.

Screen Commands

Reprints current screen.
Exposes one more line at top of screen.
Exposes one more line at bottom of screen.
Pages forward one screen.
Pages back one screen.
Pages down half screen.
Pages up half screen.

Cursor Positioning Commands


j = Moves cursor down one line, same column.

k = Moves cursor up one line, same column.

h = Moves cursor back one character.

l = Moves cursor forward one character.

RET = Moves cursor to beginning of next line.

0 = Moves cursor to beginning of current line.

$ = Moves cursor to end of current line.

SPACE = Moves cursor forward one character.

G = Moves cursor to beginning of line n. Default is last line of file.

0 = Moves the cursor to the first character of the line.

:n = Moves cursor to beginning of line n.

b = Moves the cursor backward to the beginning of the previous word.

e = Moves the cursor backward to the end of the previous word.

w = Moves the cursor forward to the next word.

Moves cursor forward to next occurrence of pattern.
Moves cursor backward to next occurrence of pattern.
Repeats last / or ? pattern search.


Text Insertion Commands

Appends text after cursor. Terminated by escape key.
Appends text at the end of the line. Terminated the escape key.
Inserts text before cursor. Terminated by the escape key.
Inserts text at the beginning of the line. Terminated by the escape key.
Opens new line below the current line for text insertion. Terminated by the escape key.
Opens new line above the current line for text insertion. Terminated by the escape key.
Overwrites last character during text insertion.
Stops text insertion. The escape key on the DECstations is the F11 key.


Text Deletion Commands

Deletes current character.
Deletes current line.
Deletes the current word.
Deletes the rest of the current sentence.
D, d$
Deletes from cursor to end of line.
Puts back text from the previous delete.


Changing Commands

Changes characters of current word until stopped with escape key.
Changes text up to the end of the line.
C, cc
Changes remaining text on current line until stopped by pressing the escape key.

Changes case of current character.
Transposes current and following characters.
Joins current line with next line.
Deletes the current character and goes into the insertion mode.
Replaces current character with x.
Replaces the following characters until terminated with the escape key.


Cut and Paste Commands

Puts the current line in a buffer. Does not delete the line from its current position.
Places the line in the buffer after the current position of the cursor.


Appending Files into Current File

:R filename
Inserts the file filename where the cursor was before the ``:'' was typed.
Exiting vi

Exits vi and saves changes.
Writes changes to current file and quits edit session.
Quits edit session (no changes made).




Another very powerful tool you can use to sort or manipulate just about any other command is grep.

grep, egrep, fgrep = is defined as print lines matching a pattern. usage of the command is similar to many other commands but you can string this command with other commands to make it more powerful. Another way of explaining grep is a search for a pattern or name within a input file or directory allowing for a detailed search.

Lets start with the basics

       String usage
               grep [option] Desired Pattern] [file or directory]
               grep [option] [-e Desired Pattern] [-f file or directory]
                       You may be wondering what option means the option is the variable you are trying to search like i want the list in order or only the last 10 line. Bellow is a list of Options available with grep.

               -A (numb) = Print the number of lines of trailing context after matching lines. or display the (numb) of lines after the grep search has found a match.
               -a, - -text =  Process a binary file as if it were text. or read a non text file and display results as text.
               -B = similar to A but instead this displays the line before the match or pattern.
               -b = Display the number of byte offset within the input file before each line of input.
               -c = count Suppress normal output instead display a count of matches
               -i = ignore case sensitivity or search for both lower and upper case naming
               -l = Suppress normal output and only display files that match
There are a bunch more you can use and different ways of using this command once you feel comfortable and want more information on just how you can add functionality to this string take a look at the man or manual pages on by using # man grep on a command line these manuals are great after you understand the fundamentals.

While we are on the subject of sorting a searching there are other ways to find files bellow are a few more commands you can use to make navigating and search a bit easier.

       locate = locate all files or directories
               to use just type locate and the file you are looking for.

       find = very similar to locate in usage and results for more details use find - -help

Well that is our first installment of basic commands for Unix/Linux if you have any questions or would like use to highlight any other topics for these platforms feel free to contact us via e-mail or the message board.




Command Glossary

  Unix command   Description Details
  ALIAS   Create abbreviations (aliases) for commands alias abbreviation=command
Displays a list of all aliases, standard arguments can be used (-a, -l, etc.). To cancel the alias use the
unalias command. F.e. alias my_command='ls -al'.
  ARCHIE   Change the current directory archie filename
Search the Archie database for a file on a FTP site.
  AT   Execute a command at a specified time at [-filename][-m] time
 - Read the command(s) from the file specified.
-m =
Notify the user by mail when the job is completed.
 = The time when the commands are going to be executed.
  BC   Use the calculator bc
To use decimals, type
scale = number (of decimal digits). End the calculator with Ctrl-D.
  BG   Execute processes in the background bg [%n]
%n =
Without this parameter it displays the jobs that are currently executed in the background. With a number the process with the given number is executed in the background.
& =
At the end of a command starts the process in the background.
  CAL   Display the calendar of the current month cal [month][year]
  CANCEL   Cancel requests for printing cancel [ -u user] print-request
Requests can be cancelled by using the printer-id or by specifying the printer name.

-u user
= Cancel print jobs that are queued for the specified user.
  CAT   Display one or more files cat [-sn] [filenames]
If more than one filename is supplied, it is added at the end of the previous file and displayed.

 = Display numbers in ascending order in front of each line.
 = Do not comment about nonexistent files.
filenames =
The filename(s) in the order that you want them to be displayed.
  CD   Change the current directory cd [pathname]
Change the current directory to
pathname or to root directory if no pathname is given.
  CHGRP   Change group name  chgrp groupname filename(s) | directory name(s)
Change group of the named file or directory.
  CHMOD   Set file access permissions chmod [ugo,+-,rwx] filename | directory name
Change mode permissions of the named file(s) or directory(ies).
File permissions for detailed information.
  CHOWN   Change owner chown username filename | directoryname
Change the owner of a file or directory.
  CHSH   Change shell chsh
Change the Unix shell you log into.
  CLEAR   Clears display clear
Clears the display. Only the prompt is displayed.
  CMP   Compare files cmp filename filename
Compares the named files. If they are equal nothing is returned, otherwise it returns the first character and line where the two files differ.
  COMPRESS   Compress file compress [-v] filename
Compress the named file. The compressed file gets .Z appended to the filename.

 = Ask for verification after compressing the file.
  CP   Copy a file cp oldname newname [-r][-i] pathname (cp index.html index1.html)
cp command allows you to copy files to new files, or copy files and directories to new directories. The command line cp index.html otherdir will copy the file index.html to the directory otherdir.
-i =
Ask before updating a file or directory that exists in the destination with the same name.
= To copy a directory including its contents to a new directory, recursive.
  CRONTAB   Scheduled files crontab filename [-r][-l][-e] pathname
crontab command allows you to run, delete or edit scheduled tasks.
-l =
lists your currently scheduled tasks.
= deletes all currently scheduled tasks.
= edit your scheduled tasks.
  DATE   List current date and time date
  DF   Disk space info df [-k] [filesystem]
Shows disk space available on the system.

= Use 1024 byte blocks instead of the default 512.
= If omitted displays the amount of disk space used and available on all mounted filesystems.
  DU   Disk space info du [-aks] [filename | directoryname]
Shows how much disk space is being used up by folders.

 = Shows counts for all files encountered, not only directories.
 = Use 1024 byte blocks instead of the default 512.
= Don't display space usage of subdirectories.
  DIFF   Display the differences between two text files diff textfile1 textfile2
  ECHO   Output string echo characterstring
Displays the character string to the standard output device.
  EXIT   Exit system exit
Exit the system or logout.
  FG   Execute processes in the foreground fg [%n]
%n =
Without this parameter it restarts the job that is currently executed in the background. With a number the process with the given number is restarted in the foreground.
& =
At the end of a command starts the process in the foreground.
  FILE   File classification file filename(s)
Shows information about the file type of the filename(s).
  FIND   Search command find directorypath(s) searchpattern action(s)
Search the specified directorie(s) for files that satisfy the search pattern and act on them according to the action(s) parameter.

-name filename =
search for files with the specified filename.
- size n =
search for files of n blocks (usually 512 or 1024 bytes).
- links n =
search for files with n links.
- atime n =
search for files that have been last accessed before n days.
- mtime n =
search for files that have been last modified before n days.
- newer filename =
search for files that have been modified more recently than the specified file.

- print =
display the path(s) of the files found.
- exec command =
run command for each file found
- ok command =
as exec, but it asks for approval before the action.

Search patterns can be combined.

! =
-o =
logical OR
One or more search patterns are combined using logical AND.

(  )
or \  \ = these can be used to define groups of search patterns.
  FINGER   User info finger emailaddress
Shows more information about a user.
  FTP   FTP to a site ftp hostname (or IP address)
Connects to a FTP site.
  GCC   Compile source code gcc option filename
Compile source code into a file.
  GOPHER   Connect to Gopher gopher
Use the Gopher database browser.
  GREP   Search in a file grep [-c,-n,-i,-v,-w,-y] pattern [filename(s)]
Search for a string in a file or files.

-c =
 displays only the number of lines that match.
-n =
 displays the line number in front of every displayed line.
-i =
 ignore case.
-v =
 displays all other lines except those lines that match.
-w =
 matches whole words only.
-y =
 case independent pattern matching, lower case letters in pattern will also match upper case letters in the input.
  GZIP   Compress a file gzip filename
Compress a file.
  HEAD   Display head of a file head [-n] filename(s)
Display the first
n lines of the named file(s). If no number is given the first 10 lines are displayed.
-n =
 the number of lines to display from the top of the file.
  HOSTNAME   Display hostname hostname
Display the name of the host machine.
  IRC   Connect to IRC irc hostname (or IP address)
Connect to an Internet Relay Chat host.
  JOBS   Display active processes jobs
  KILL   Terminate process kill [-signr] process_ID
Terminate the process with the specified process ID.

-9 = s
end a definite kill signal.
  LOGOUT   Logs off the system logout
  lprint Print a file lprintd Abort a print job lprintq List the print queue      
  LS   List files in the current directory ls [-CFRR*acdglrstu] [list of filenames or directories]
The -
a switch will include hidden files (hidden files in UNIX begin with a dot (.)), the current directory and parent directory entries (. and .. respectively). You can combine switches by placing them one after the other (ls -la, etc..)
-C =
list entries in columns.
-F =
list directories with /.
-R =
list subdirectories as well.
-R* =
list subdirectories 2 levels below current directory.
-a =
list all entries, including files with a dot (.htaccess, etc..).
-c =
sort entries by last modified date.
-d =
list directories only.
-g =
list hidden files and directories.
-l =
list in long format (mode, no of links, owner, group, size, and modified date).
-r =
list in reverse order.
-s =
list size in 1024 byte blocks.
-t =
sort contents by time of last modified date.
-u =
use time of last access (not last modified date) for sorting (with -t) or printing onscreen (with -l).
  MAKE   Compile source code make command
Compile a source code.
  MAKEFILE   Compile source code file make filename
Compile a source code into a file.
  MAN   Read the help man command
Shows the help on the entered command, f.e.
man ls, man chmod, etc.
To search for some text, press the forward-slash (/) key and type the text you want to search for. If you want to run a program that's in your current directory, you'll need to put a dot-slash (./) in front of the program name.
  MKDIR   Create a directory mkdir directoryname, mkdir -i directoryname
To create a directory in the current directory, type
mkdir followed by the directory name. To delete a directory and all its contents, use rm -r directoryname. The -i parameter will make the system prompt you before deleting a file or directory. If the directory is empty, you can also delete it using the rmdir command.
  MORE   List a file more filename
View a file with a pause after every full screen.
  MV   Rename a file mv oldname newname
  PASSWORD   Change password password
Change the administrator password.
  PICO   Edit a file pico filename
An easy to use text editor.
  PINE   A mailer program pine
An easy to use mailer program.
  PWD   What is the current directory pwd
  RM   Delete/remove a file rm filename
To delete a single file, use rm filename.
  RMDIR   Remove a directory rmdir directoryname, rm -r directoryname ( to delete folders with its files).
  RZ   Receive a file rz
Receive a file using Zmodem.
  SZ   Send a file sz filename
Send a file using Zmodem.
  TAIL   Show last lines of a file tail filename
Show the last few lines of a file.
  TALK   Page user to chat talk username
Pages the user for a chat, the user is an e-mail address.
  TAR   Archive files tar filename
Create or extract multiple file archives. Other methods are lharc, lzh, and lha, but these methods may not be present on your system.
  TIN, TRN   Connect to Usenet tin, trn
Connect to Usenet newsgroups.
  TELNET   Connect telnet hostname (or IP address)
Connect to an Internet web site.
  DOS2UNIX   Conversion of text files dos2unix filename newname
Strips the carriage returns (CR) from the DOS text file.
  UNIX2DOS   Conversion of text files unix2dos filename newname
Adds the carriage returns (CR) to the Unix text file.
  WHO   Who is logged in? who
Shows who is logged into the local system.
  W   Who is logged in and what are they doing? w
Shows who is logged into the local system and what they are doing.
  WRITE   Write to a user write username
Write to a user on the local system (CTRL-C to end it).
  ZIP   Compress to zip zip username
Compress to zip for IBM files.



Detailed Listing of Test PC's & Equipment





Good Links

Other Good Links

Comp Tech Tutorial

Blue Drake

Sound Wave








Mod Sites & Guides





Want to Be an Affiliate? Click












Arctic Cooling












Soyo USA


[steel series]





Xtreme Gamer




ADSoft Web design Award




    Copyright 2004  Marns CDA
All other trademarks and copyrights on this site are owned by their respective owners. All Rights Reserved. Reproduction by permission only. General disclaimer: This website displays the personal opinions of authors and other contributors. Marns CDA assumes absolutely no liability for these opinions nor for any damages that may result from reading and/or implementing any material found on this website.