UNIX For Dummies [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

UNIX For Dummies [Electronic resources] - نسخه متنی

John Levine, Margaret Levine Young

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید






Roger, I Copy

You can make an exact duplicate of a file. To do it, you must know the name of the file you want to copy, and you must create a new name to give to the copy. If a file contains your January budget (called budget.jan , for example) and you want to make a copy of it to use for the February budget (to be called budget.feb , for example), type this line:


cp budget.jan budget.feb

The lazy typists strike again. Be sure to leave spaces after the cp command and between the existing and new filenames. This command doesn’t change the existing file (budget.jan ); it just creates a new file with a new name, and with the same contents.


A good way to lose some work


Warning What if a file named budget.feb already exists? Tough cookies! UNIX blows it away and replaces it with a copy of budget.jan . It truly is an excellent idea to use the ls command first to make sure that you don’t already have a file with the new name you have chosen.

In most versions of UNIX, however, you can use the -i option to ask cp to inform you whether a file with the new name already exists. If it does, the -i option asks you whether to proceed. Type cp -i rather than just cp to use this nifty little feature.
If all goes well and cp works correctly, it doesn’t show you any message. Blessed silence on the part of UNIX usually means that all is well. You should use the ls command to check that the new file really does exist, just in case.


What’s in a name?


When you create a file, you give it a name. UNIX has rules about what makes a good filename:



Filenames can be pretty long; they’re not limited to eight characters and a three-character extension. In older versions of UNIX, the limit is 14 characters for a filename; newer versions have a huge limit — in the hundreds of characters — so you can call a file Some_notes_I_plan_to_get_around_to_typing_up_eventually_if_I_live_that_long .



Don’t use weird characters that mean something special to UNIX or some shell you may encounter. Stay away from these characters when you name files:

< > ‘ " *
{ } ^ ! [ ] # | &
( ) $ ? ~
Stick mainly to letters and numbers.



Don’t put spaces in a filename. Although most programs let you put them in, spaces cause nothing but trouble because other programs simply cannot believe that a filename may contain a space, and because in shell commands, spaces separate filenames. Don’t borrow trouble. Most UNIX people use periods to string together words to make filenames, such as budget.jan.98 or pumpkin.soup . Underscores work, too.



UNIX considers uppercase and lowercase letters to be completely different. Budget , budget , BUDGET , and BuDgEt are all different filenames.



/ 213