[Next] [Previous] [Up] [Top] [Contents]

CHAPTER 3 Getting Started

3.7 File Maintenance Commands


To create, copy, remove and change permissions on files you can use the following commands.

File Maintenance Commands
Command/SyntaxWhat it will do
chgrp [options] group filechange the group of the file
chmod [options] filechange file or directory access permissions
chown [options] owner filechange the ownership of a file; can only be done by the superuser
cp [options] file1 file2copy file1 into file2; file2 shouldn't already exist. This command creates or overwrites file2.
mv [options] file1 file2move file1 into file2
rm [options] fileremove (delete) a file or directory (-r recursively deletes the directory and its contents) (-i prompts before removing files)

If you're familiar with DOS the following table comparing similar commands might help to provide the proper reference frame.

Unix vs DOS File Maintenance Commands
CommandUnixDOS
copy filecpcopy
move filemvmove (not supported on all versions of DOS)
rename filemvrename & ren
delete (remove) filermerase & del
display file to screen

entire file

one page at a time

 

cat

more, less, pg

 

type

type/p (not supported on all versions of DOS)

3.7.1 - cp - copy a file
3.7.2 - mv - move a file
3.7.3 - rm - remove a file
3.7.4 - File Permissions
3.7.5 - chmod - change file permissions
3.7.6 - chown - change ownership
3.7.7 - chgrp - change group

Introduction to Unix - 14 AUG 1996
[Next] [Previous] [Up] [Top] [Contents]