User Tools

Site Tools


opus:fall2012:escoute1:unixpart1

File Types

The Regular, Directory, and Special File Types

Definition

Unlike most keywords, this one isn't just one simple keyword. A file type is a vague term that represents files, and in order to really know what one is, they should be defined, SUCH AS:

  1. A regular file type: A regular file is the most common file type there is, this file type represents the text files, compressed files, binary files,and “file files.”(not a real file, I just like the word. Basically any file that you would send as an email attachment is considered a regular file, within reason.
  2. A directory file type: A directory file isn't commonly known as a file, but it is. The common folk would call this a “folder”. You put all types of files within a directory file, even another directory file. What a directory file does is points you in the direction of more files, usually more than one. A symbolic link(which is a file) would fall into this category for that reason, which could point to a specific file or a directory. (A file that points to a directory; which points to more files.)
  3. A special file type: A special file is the most uncommon file type. These files define the system devices and temporary files created by processes. There are 4 basic types of files that are considered “special” and they are FIFO (First in, first out) which are also known as pipes, which allow communication between processes temporarily, then there's block and character devices which define devices.

An important consideration when we're talking files is that each file has permissions for them that determine which users can Read, Write, or Execute a file. These are formally known as access modes. These access modes are often represented in this format: Eg. drwxrwxr– or srwxr—–

References

ls

Definition

ls is a command for directory listing. What this mean is it lists all the contents of the directory in a curt manner. Usually just the names of the directories, files, and their file types by color coordination.

  • -l changes how ls operates and causes the command to do a long/detailed listing, revealing the file type and permissions.
  • -al causes a formatted listing with hidden files.

References

  • From the LAIR computer desktop.

unix Keyword 1 Phase 2

Home Directory

Definition

The Home Directory is basically the place that all of a user's files and folders are stored. From the home directory, one may be able to access all of their files, or just access specifically places files. The user is able to completely customize their home directory. When files and folders are in a home directory (including readable, writable, and executable files), they are only able to be accessed by the user or any other administrator on the system. That can be changed at any point, however.

References

Demonstration

Demonstration of the Home Directory

Firstly, we identify where the home directory is. When you log in, you should be able to use the pwd command and boom, you it shows the absolute path of your home directory. Another way to ensure that it is YOUR home directory, you can use pwd $USER and the same result should display. Try that in another relative directory and you will get the same result every time, because $USER represents your username, which is mainly used to identify your home directory.

We can also change directory or cd to your home directory using an absolute path or a relative path if you are in the /home directory.

The home directory is the one directory where it's not recommended to even consider changing the Owner access controls.

One of the most useful things you can do related to your home directory is usage of the cd command in order to quickly return to it, from anywhere in the file system, including finding your way into another user's home directory, you can easily change back to yours with simply cd

And finally you can use ls to see what it looks like to verify that they are your directories.

Assume your username is rabidrabbit

Back to back demonstration..

lab46:~$ pwd
/home/rabidrabbit
lab46:~$ pwd $USER
/home/rabidrabbit
lab46:~$ cd /
lab46:/$ cd /home/$USER
lab46:~$ pwd
/home/rabidrabbit
lab46:~/src/submit$ cd
lab46:~$ pwd
/home/rabidrabbit
lab46:~$ cd /home/tmong
lab46:/home/tmong$ cd
lab46:~$ pwd
/home/rabidrabbit
lab46:~$ ls
Desktop    Downloads  Music     Public     Videos    closet  file.txt     src
Documents  Maildir    Pictures  Templates  archives  data    public_html
opus/fall2012/escoute1/unixpart1.txt · Last modified: 2012/09/28 17:15 by escoute1