File storage control and access :

Many of these commands have already been covered and a few will revisited in more detail in a later module.

  • cp - copy the contents of a file to another file.

  • mv - move a filename to a different directory list or change its name.

  • rm - remove a filename from a directory list.

  • mkdir - create a new directory list.

  • rmdir - remove an empty directory.

  • ln - create a second name for a file.

  • ls - list contents of a directory list.

  • chmod - change access permissions to a file.

  • umask - set initial (default) maximum access permissions for any new file.

  • chown - change ownership of a file. This command usually can only be performed by the system administrator.

    chown user_id filelist

    User_id can be the name or numeric uid of the user of interest. The GNU version will also allow the group id to be changed at the same time.

  • chgrp - change the group association. This command is available to you as long as you owner of the file and are a member of the target group.

    chgrp group_id filelist

  • file - examines the file and attempt to describe the type of file it is. This command recognizes both the standard Unix classifications, (filetypes) and several of the more common file formats such as c source code or shell script. Read the man page on file to see it determines a file's type.

    find - search all subdirectories from a specified starting point for a file matching specified criteria. The following would search for all c source code files in all directories under your home directory.

    find $HOME -name "*.c"

    find will be covered in more detail in its own module.

    Exercise :

    #( Run the following command and look at the output. Lines in parenthesis are comments, don't enter them)

    #( List a character special file. This is the interface to the sound card and takes serial streaming data )

    ls -l /dev/audio file /dev/audio
    
    #( List a symbolic link file. This is the interface to the cd/dvd reader. Because it may be either, two symbolic links to the actual interface file were created. )

    file /dev/cdrom
    ls -l /dev/cdrom
    ls -l /dev/dvd
    

    #( List a block special file. This is the interface to one of the hard drives. )

    ls -l /dev/hda file /dev/hda 
    #( List a named pipe. A pipe is a special interface between running processes or programs that allow them to communicate with each other. init is the program that starts most other programs (children) and initctl is a named pipe interface that allows init and its children to communicate. )

    ls -l /dev/initctl
    file /dev/initctl
    
    #( List a directory file. )
    ls -ld /dev
    file /dev
    
    #( The following are all regular files but have formats or data specific to certain programs. )

    #( List some different regular files. )

    ls -l /etc/fstab
    file /etc/fstab
    
    file /etc/udev/udev.conf
    file /etc/YaST2/control.xml
    file /etc/X11/xkb/compat/complete
    file /etc/X11/lbxproxy/AtomControl
    file /etc/X11/rstart/commands/ListContexts
    file /etc/X11/xdm/pixmaps/xorg.xpm
    
    #( The filetypes found above are not comprehensive, just a sampling. You can see a comprehensive list with the following command. )

    less /usr/share/misc/magic
    

    Process commands
    Command list