- Go to your home directory
cd
- Take a look at the file ~escobj/public/emacs
cat ~escobj/public/emacs
- Now copy the emacs file into your home directory.
A dot (.) is the current working directory which in this
case is your home directory
cp ~escobj/public/emacs .
- Now take a look at the files in your home directory and see if you
find the emacs file.
ls
- Among the other files and directories in your home directory, you
should see the emacs file. Take a look at this file.
cat emacs
- It should look the same as the ~escobj/public/emacs file. Now
rename the file. Call the new name mac.
mv emacs mac
- Did it work? How can you tell if it worked? (list the contents
of the directory and make sure that emacs is not there and that
mac is there.)
ls
- Now move the mac file into your public directory.
mv mac public
- Check to see if it worked. Make sure it's not in your home directory
then go into your public directory and see if it's there.
ls
cd public
ls
- Let's move the mac file back to your home directory. There
are a few ways of doing this - here is one.
mv mac ..
- Go back to your home directory and verify that
the mac file is back in your home directory (I'm not going to tell
you how to do it this time). Then make a new directory called
new_dir.
cd
mkdir new_dir
- List the contents again, but this time put a -F option on the
ls command and see what happens. (Note : If you type ls -l
and look at the output, you'll see a string something like
'drwxr-xr-x' next to the directories and something like '-rw-r-r-' next
to the files. The 'd' in that string tells you that the file is
actually a directory.)
ls -F
- You should see that the directories are followed by a slash (/),
normal files look the same, executables (we haven't talked about that yet) have
an asterisk (*), and links (haven't talked about this either) have an
at sign (@) at the end. You should have seen the directory you
just created, new_dir. Now, copy your mac file into the
new_dir directory.
cp mac new_dir
- Verify that this happened and then cd into the
new directory. (Try it on your own this time.)
- Copy the mac file to a file in the same directory. Name the
file junk.
cp mac junk
- Again, verify with the ls command. Now,
get rid of the mac file with the rm command and verify
that it's gone. ( From now on, I'm not going to ask you to verify
anything - just do it if you want to, else don't bother)
rm mac
- We are currently in the new_dir directory. Go back to your
home directory and TRY to remove the new_dir directory.
cd
rmdir new_dir
- You should have gotten an error message that said ``rmdir: junk:
File exists''. rmdir will only remove directories that are empty.
So, go back into the new_dir directory and remove the file called
junk, cd back to your home directory and try again to
remove the new_dir directory. It should work this time. (Note :
You can use rm -r new_dir to remove the directory and all the files
it contains)
cd new_dir
rm junk
cd ..
rmdir new_dir
- Now rename your first copy of mac to .emacs by using
the mv command. Don't forget the dot.
mv mac .emacs
- Now TRY to find the file be using ls.
- It's not there! To see
it, use the -a option. a for ALL.
ls -a
- What happened was the prefix . made the .emacs file into a
hidden file. You were probably surprised to see that you had a lot more
files than you had originally thought. These files are usually command
files for different programs and you usually don't want to fool around with
them unless you know what you're doing. The .emacs adds some cool
functionality to your original emacs program. What it does is colorize
C and C++ code. Try it by editing one of my old C++ files from
computing languages. It is in my public directory called sample.C.
First copy the file to your home directory.
cp ~escobj/public/sample.C .
emacs sample.C
- Now that you have emacs up, call me up to verify that it worked correctly.
I also want to copy down your USER ID so that I can make a link to your future
homepage on our Computer Science I web-site!
- Practice cutting and pasting in emacs by highlighting
text and using the cut and paste options from the Edit window.
- Finally, figure out how to use the cal command yourself by looking it up
in the manual pages.
man cal