Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
labs:unix_basics [2012/01/03 16:51] – [Directory Access/Manipulation] adminlabs:unix_basics [2017/03/15 16:07] (current) – [Move or Rename Files] admin
Line 21: Line 21:
 | ''-r'' | reverse order | | ''-r'' | reverse order |
 | ''-t'' | sort by creation time | | ''-t'' | sort by creation time |
 +
 +Example: ''ls -lrt'' lists the files in the current directory by creation time, from most recent to least recent, and lists all the information about the files
  
  
Line 28: Line 30:
 ==== Copy Files and Directories ==== ==== Copy Files and Directories ====
  
-  * ''cp <source> <destination>'' - copy files +To make a copy of a file (''source'') and name it ''destination'':  
-   To copy the contents of a directory, use the ''-r'' option.  For example, + 
 +  cp <source> <destination> 
 +   
 +For example 
 + 
 +  cp myfile.txt myfilecopy.txt 
 + 
 +To copy a directory and its contents, use the ''-r'' option.  ''-r'' means //recursively//.  For example, 
  
-  cp -r <source> <destination>+  cp -r my_src_directory destination_directory
  
 ==== Move or Rename Files ==== ==== Move or Rename Files ====
  
-  * ''mv <source> <destination>'' move or rename files+Use the ''mv'' command to move or rename files:
  
 +  * ''mv <source> <destination>''
 +
 +If the destination is a directory, then the file(s) are moved into that directory.
 +
 +For example, to rename ''myfile.txt'' to ''newname.txt'', run
 +
 +  mv myfile.txt newname.txt
 ==== Delete Files ==== ==== Delete Files ====
  
-  * ''rm <file>''delete files+  * ''rm <file>''deletes ''file''
  
 ==== View contents of Files ==== ==== View contents of Files ====
Line 81: Line 97:
 ===== Printing Files ===== ===== Printing Files =====
  
-To print from the command-line, you can use the ''lpr'' command.  **Do not try to print PDF files or images this way.**  The syntax of the print command is ''lpr -P<printername> filename''.  For example:+To print from the command-line, you can use the ''lpr'' command.  **Do not try to print PDF files or images this way.**  The syntax of the print command is  
 + 
 +  lpr -P<printername> filename 
 + 
 +For example:
   lpr -Pcslab test.py   lpr -Pcslab test.py
 +  
 +The printer name is ''cslab'' when you're in P405 or ''advlab'' if you're in P413.
 +
 +The command ''lpr'' means to print the file. The option 'P' says which printer to use (one of the CS lab printers), and the argument says which file to print--in this case ''test.py''.
 +
 +
 +===== Creating Printable Files =====
 +
 +To create a condensed, printable file of your lab, use the ''printLab.sh'' command.
 +
 +The syntax of the command is
 +
 +  printLab.sh <path_to_lab_directory>
 +  
 +For example, if you're in your ''labs'' directory, to print lab1, you'd write
 +
 +  printLab.sh lab1
 +  
 +  
 +===== Changing Your Password =====
 +
 +To change your password, use the ''passwd'' command.
 +
 +An example run will look something like:
 +
 +  > passwd
 +  Changing password for username.
 +  Old Password:
 +  New Password:
 +  Retype new password: 
 +  passwd: all authentication tokens updated successfully.
 +
 +Note that what you type for the passwords does not show up on the screen for your security.
 +
 +
labs/unix_basics.1325609492.txt.gz · Last modified: 2012/01/03 16:51 by admin
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0