16.3. Working with Files and Directories

. Working with Files and Directories The previous pages show you how to navigate your directories using Unix commands. Just perusing your directories isn't particularly productive, however. | . Working with Files and Directories The previous pages show you how to navigate your directories using Unix commands. Just perusing your directories isn t particularly productive however. This section shows you how to do something with the files you see listed copy move create and delete directories and files. Tip You re entering Serious Power territory where it s theoretically possible to delete a whole directory with a single typo. As a precaution consider working through this section with administrator privileges turned off for your account so that you won t be able to change anything outside your home directory or to be really safe create a new test account just for this exercise so even your personal files won t be at risk. . cp Copy Using the Unix command cp you can copy and rename a file in one move. Try that in the Finder The basic command goes like this cp pathl path2 where the path placeholders represent the original file and the copy respectively. . Copying in place To duplicate a file called you would type cp . That s just one space between the names. You don t have to call the copy Thesis2 you could call it anything you like. The point is that you wind up with two identical files in the same directory with different names. Just remember to add a backslash before a space if you want to name the copy with two words Thesis Backup for example . Tip If this command doesn t seem to work remember that you must type the full names of the files you re moving including their file name suffixes like .doc or .gif which Mac OS X usually hides. Using the ls command before a copy may help you find out what the correct full file names should be. Or you may just want to use the tab-completion feature making Terminal type the whole name for you. . Copying and renaming To copy the same file into say your Documents folder instead just change the last phrase so that it specifies the path like this cp -

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.