User Tools

Site Tools


keckcaves:copying_files_in_unix

Some very basic UNIX commands to copy files and directories

First, open a terminal window by double clicking on the desktop icon that says “terminal” or the square icon that looks vaguely like a computer monitor at the top of the real screen. Type UNIX commands in this window. You can select text with the mouse, but you can only move the cursor by using the arrow keys and you can only type in the last line. To recall a command you typed in earlier, use the up arrow key until that command appears at the prompt.

Some Commands Include:

  • ls = list the contents of your current directory
101}ls                                                                  
Desktop                 Library                 Pictures
Documents               Movies                  Public
Downloads               Music                   Sites
IASViewer               Opera 7 Preferences.new pyth
102}
  • cd <path> = change directory with the <path> replaced with the name of the directory you want to go to.
102}cd pyth
103}ls
Analysis Goals                  ToySnakes
Analysis Goals & thoughts       diveintopython-5.4
FlexibleLineBugs                examples & info
I_Otests.py                     old test
LineBugs alias                  test files
LinearLineBugs                 
104}
  • <path> can include a directory in your current directory as in the example above, “..” which sends you up one directory (cd ..), or a path all the way from the computer hard drive, e.g. /share/Data/VolumeData. The initial “/” indicates that the path to the directory you want starts at the hard drive level.
  • To make a directory, use the command “mkdir <directory name>” as in
114}ls
Desktop                 Library                 Pictures
Documents               Movies                  Public
Downloads               Music                   Sites
IASViewer               Opera 7 Preferences.new pyth
115}mkdir A_test_dir
116}ls
A_test_dir              Library                 Public
Desktop                 Movies                  Sites
Documents               Music                   pyth
Downloads               Opera 7 Preferences.new
IASViewer               Pictures
117}
  • To copy a file, use “cp <file name> <path and new file name>”.
  • To copy a bunch of files to a directory, you can use the wild card “*”. To copy files from a local directory to a remote directory, this is one format: cp *.* <path> and an example:
117}cd A_test_dir/
118}ls
119}cd ../Public/
120}ls
1630_0_merged_1181572397.pdf    Environment.py
Collision_v3.py                 LineBugs_tm_v3c.py
Drop Box                        Snake_Classes.py
121}cp *.* ../A_test_dir/
122}cd ../A_test_dir/
123}ls
1630_0_merged_1181572397.pdf    LineBugs_tm_v3c.py
Collision_v3.py                 Snake_Classes.py
Environment.py
124}

Note that the directory “Drop Box” was not copied.

keckcaves/copying_files_in_unix.txt · Last modified: 2009/05/02 17:20 by sumner