Commands Associated with Files

  • Printing
  • Deleting
  • Moving
  • Copying
  • Grep
  • Redirecting
  • Return to Main Menu | File Organization Menu | DOWN







    lpr filename(s)
    prints filename(s) on the default printer; the default printer is usually a line print which excepts only text, so please send only text files

    Example:

    	lpr list.txt 
    

    Return to Main Menu | File Organization Menu | Associated Command Menu | UP | DOWN




    rm [-i,-r] filename(s)
    remove (delete) the specified file(s). With -i, the user is prompted before each file is deleted. With -r, if a directory is specified, the directory and all files in it are deleted.


    Example:

    	rm list.*  
    
    rm -r ~/temp
    Return to Main Menu | File Organization Menu | Associated Command Menu | UP | DOWN




    mv [-i,-r] <filename(s)> or <directoryname(s)>
    moves the specified files to the specified directory. Files created in the new directory have the same name as the original files. Existing files with the same name are overwritten. With -i, the user is prompted before each file is moved. The -r is used when moving directories. It means to recursively the directory and all of its nested subdirectories.

    mv [-i] file1 file2
    same as above, but moves a single file to a new filename. Complete or relative pathnames may be used.


    Example:

    	mv list.*  ~/temp
    
    mv -i lis?.txt ~/temp
    Return to Main Menu | File Organization Menu | Associated Command Menu | UP | DOWN




    cp [-i,-r] <filename(s)> or <directoryname(s)>
    copies the specified files to the specified directory. Files created in the new directory have the same name as the original files. Existing files with the same name are overwritten. With -i, the user is prompted before each file is copied. The -r is used when copying directories. It means to recursively copy or move the directory and all of its nested subdirectories.

    cp [-i] file1 file2
    ame as above, but copies a single file to a new filename. Complete or relative pathnames may be used.


    Example:

    	cp letter.doc  Mail/Jean/jan.10
    
    cp letter.txt newletter


    Return to Main Menu | File Organization Menu | Associated Command Menu | UP | DOWN




    Example:
    grep <any pattern> <file>


    Return to Main Menu | File Organization Menu | Associated Command Menu | UP | DOWN




    Click here for Examples
    Return to Main Menu | File Organization Menu | Associated Command Menu | UP






    Examples:

    ls > filelist
    Result:
    The listing of the current directory is placed in a file called filelist


    ls >> filelist
    Result:
    The listing of the current directory is Appended to the file called filelist


    Mail fred < hello
    Result:
    Mails a file called hello to the user fred


    ls -la | more
    Result:
    The listing of the current directory including dot files in long format one page at a time


    cat letter1 letter2 > letter3
    Result:
    Concatenates the two files called letter1 and letter2 and place the output into a file called letter3



    Return to Main Menu | File Organization Menu | Redirection Selection