Thursday, September 13, 2012

UNIX file system cleanup




UNIX file system
UNIX from DOS file system organization, and the ways it can be manipulated to have been strongly influenced. For this reason, the two operating systems are very similar. Files using the most work, read, copy, move, erase and take a look at this chapter you will see.
Larger files included in the directory, and the directories will be included in the directory, they are larger and can be included in the directory. djEJs specific file when you want to work with the system must be aware of the order to go to find the file in the directory. At this time is one way to specify the order and the name of the file to the pathname of the directory. Necessity, very similar, the biggest difference to use the DOS path separated by a backslash (\) UNIX that use slave sh (/), and the pathname of the UNIX and DOS.

* File operations
Anyone who is familiar with DOS and UNIX called DOS file extension (suffix) that will be noticed. This DOS and Unix important distinction is that most of the files in the DOS extension, but Unix generally is not. Unix, of course, also you can create a file name with an extension. For example, the text file is displayed as a file to create or kim.txt or yang.txt kim.pm or yang.pm cigars that can show However, because I believe most Unix users to enter as little as possible would be good if there is no reason not to use the extension, preferably avoiding the side.

* File read: more command
Success in the log when the following command: Get hit.
more kimdh
So ... will be shown on the screen kimdh in the DOS command and type comparable to the Unix more command both the contents of the file on the screen shows. In general, the command format is as follows.
more filename

* Note: the word "print"
For DOS users will be the meaning of the word "print" on a piece of paper act. In the Unix world, however, often the word "print" a document on the screen indicating the process means. For example, the contents of the file that says "print" more. Most Unix systems have the ability to print on paper output. However, Unix, can work productively without the need to print on paper in a way that will help people. Studying Unix, so please note the word "print", "show" that

shell from hitting more kimdh shows the contents of the file if this file is very large at the bottom of the screen will display the message shown on the screen, the first 24 lines of the ---- More ---. Need to read the rest of the contents of the first screen, you can choose from three methods.
1 press enter, the more shows the next line of the file. Continuously pressing Enter displays the file line-by-line basis.
By pressing the space key more of the file shows the following 24 lines. Space behind a screen showing the file will show a screen-by-screen basis.
More 3.q Pressing is finished. Find what you want from the file when you do not need to see anymore, so if you are more if you do not press q after the last line of the file until the display is finished.
If multiple files at once to investigate the following manner.
more kimdh yang
Do this first kimdh show yang of sequential file shows few files any more you can display the contents of a file at any time by using the n you can move on to the next file. In addition, if you would like to see behind the content of the file, go back and press p for the previous shows. Skip forward or backward within a file number for which, for example, may be used to go back as much as a three-screen, -3, +2, the two screens are skipped.

* Cat command
documents stopped because a screen-by-screen basis, the more command to read the file most convenient way. However, the cat command is slightly slower than the more command and the contents of multiple files Ehms one screen tight driveway without stopping just passed discarded.

* Ls ​​command
a short list of the files in alphabetical order according ls align
Note: the difference between ls and DIR
1.ls results are lowercase. DIR's, on the other hand, the result is almost capitalized.
2.ls results in alphabetical order, but it is sort DIR does not.
Provides detailed information, including the file's size and creation date, etc. 3.DIR. However, ls only displays only the name.

* Copy of the file - cp command
DOS users will be familiar with the copy command to copy the file. Unix command similar to the cp that. For example, a
# Cp kimdh yang
The kimdh the yang of the file will be copied to the And kimdh file missing remains. So cp without erasing the original files that only new files Makes know itjiyo.
Reference
Typically, when the DOS copy command to copy the file shows the message as 1File (s) copied. cp to copy the file, no message would have noticed. Is that a minimum level of output that keep the philosophy of Unix.

* Of deleted files - rm
Using the DOS DEL command to delete the file, remove abbreviation rm is used in Unix. For example, the
# Rm kimdh
You will get a message stating that the hydrothermal input file "kimdh" If so, the files will be erased. Kimdh the file is gone to make sure that "more kimdh" haebomyeon. This is because it has cleared the file that is Or, you can use the ls command to check is gone
Note: DOS DEL command and the differences between the Unix rm
DEL ignore everything except the first argument. For example,
# DEL kim kim1
Ten thousand kim do this does not erase erase kim1 Kim, kim1 "rm" command geureorh but is not clear.

* Move the file - mv command
Role of Unix mv command to move files. In DOS to think, is similar to the rename command. For example, a
# Mv kim kim1
Kim is doing so all will be moved to a file called kim1. However, "more kim" If you do not have a file will come out. Contrast this with the cp command, mv the new file, the original file is lost, Makes is. As a result, only the name of the file is changed.


**** **** Files and directories

Perhaps directory called DOS users will be familiar with the concept. DOS or UNIX directory'd concept is a way to organize the file contains. Quickly and easily find the files you want, wiha tying together over a similar type or purpose of the file is a directory.

* The root directory
/ U / jeon / hea / mylife
There is a directory name with a simple slash only of the things you can see above, this directory is called the root directory, all the Unix file system must have the root directory. To put it in more detail, the root directory of the file system can be described as a basic. All of the files in the file system must be included in one of the root directory or some subdirectory of the root.

* Pathname
Pathname is a way to specify the location of the file you want to work with. Is the full pathname to specify the pathname file system, such as wood and therefore Iran. In other words, until the end I place the file you want to start from the root note.
/ U / jeon / mylife
Above to view the full pathname can be here, there are a few components.
# The first element in the name of the start / This path must start from the root that means.
# The second element of the u. Are u looking for the fact that u is a directory in the root directory of the system you will find. Therefore, the path to the directory will be changed to u.
# The following elements jeon is to find u in the directory (/ jeon between u and only to distinguish between the elements.) System jeon Jeon directory that will know. So, again, jeon will go into the directory path.
# Last element is mylife. System mylife jeon find in the directory. Is the end of this path.
In other words, the path name or file until it reaches the desired directory into a hierarchy of consecutive directory, such as a map to guide.

* The current directory, specify the
"Pwd (print working directory)" If you want to know where his working directory as the current directory name shows. When you log in, the system automatically set the directory to the home directory called directory.

* Cd command
cd command will change the directory. kguswo And almost similar to the DOS CD command to write cd command without any arguments, then you will change the current directory to your home directory.

* Create a directory - mkdir command
mkdir command to create a new directory. As follows.
# Mkdir newdir
It under their current directory, create a directory named newdir.
Note: distinguish between files and directories
I thought maybe you'd have thought the file name and directory name looks a bit like a. File and directory names, and apparently it is because there is no difference. This is how to distinguish certain the name of the file or directory How do I know that you can use the ls-p. The ls-p option to display the directory name / character.

* Relative vs. absolute pathname pathname
Here's a general rule. If the pathname begins with a slash (/), the foot from the start it is the absolute pathname slash, if you start from the current directory pathname is relative to the start.

* Remove directory - rmdir command
rmdir command clears the directory.
# Rmdir newdir
This command eliminates the newdir directory.

* Common Directory
Most Unix systems have the following directory under the root directory.
# / Bin ---> in the system, this has a lot of utilities and programs viable. is an abbreviation of the bin is a binary file, binary utility is almost always a binary file.
# / Dev ---> device file, this has
# / Etc ----> used for any other purpose file system management, and has For example, / etc / passwd file has a name, typically all authorized users of their passwords and other kinds of personal information.
# / Tmp ---> save the temporary file to the user or program. For example, to align the contents of a file in Unix sort command, sometimes temporarily storing the partial alignment of the contents of the file disk space is required. If so, when you sort the / tmp partially finished working to create a file under / tmp from the temporary file clears.
# / U ----> form of user directory system has Files and directories that can be stored under the directory for technical reasons, there is no limit to the number of Therefore, with those used by many Unix systems form in the directory / u do not all fit in the other directories may be required. Riga Is seen overflowing for users home directory that stores such as / usr, / u1, / u2 of the directory name.


Characteristics of the file **** ****

* File Permissions File Permissions
Unix files are three kinds of permissions is as follows.
The owner of the file
On Unix systems, all users assigned a unique user id number, called number received does. Will be licensed to use the system it is assigned automatically when Belongs to the owner of the owner of the file permissions. For example, if you are the only one who can not read or write any file because you can set the permissions of the files that are owned.
Unix group of users
Unix system administrator can create a group on the system. For example, a system administrator to use the computer for each project, or create a group separate from the company each department to create a group. System administrator, you can go in either group Which group is the primary group is determined.
3 other licensed
Did not own the file or the file permissions to all people who do not belong to the group. For example, to use the system, so that everyone can read, you can set up a file.

File permissions *
There are three types of file permissions.
r> to read the file permissions
w -> write permission on the file
x -> paeul the permission to run, for example, any executable program file, then x permission to run the program you need.
The kind permission of the file owner, group, and can be assigned to all users by separating. They always rwx's in the order listed. For example, a
rw-r - r-w
Above, the first three letters of the owner's permission rw-means to write, to think, but can not run. The following three letters means the group permissions. r - read permission, write, and execute permissions, but not the meaning. The last three letters of the other rights. r - read books one and execute permissions, but not write permission means.

Permissions on the directory *
r ---> permission to read any directory on the file that contains the directory and western, only just be able to read only the name. Diary of the file itself will need permission to read the contents of the file.
w -----> any directory permission to create new files and subdirectories under the
This is weaker than r x -----> Navigate to the directory where the rights, privileges. Particular file or sub-directory to determine if there are. when r you do not have permission to know the names of the x permission, which, if you can access the file or subdirectory. , However, not be able to traverse the directory in order to find out the names contained in the directory.

* File attributes --- ls-l
the format of the ls command to show the attributes of the file or directory. Try the following:
ls-l jeon
Dash (-l lowercase l.) The output of this command is as follows.
-Rwxrwxrwx 1 suo93 0 707 Feb 17 10:00 jeon
Your computer and coming up in this way, however, will not be exactly the same. Well, one of the results we'll briefly look up the meaning.
Dash ---> the first character of the file is a directory, d will
means rwxrwxrwx ---> to the file permissions for owner, group, and all users have full access to files that shows
1 ------> Link to file number.
suo93 ---> The user ID of the file's owner. This is a Unix / information imported from the file and stored in the etc directory. And the file name for the first time in less regarded as the person who owns all the files on your computer.
0 ----> group of files. This also Unix because DOS is taken from the files and information stored in the / etc group always has a value of 0.
707 ---> the size of the file. Still be displayed in bytes.
Feb 17 10:00 ---> This is the date and time the file was last changed. Directory, the directory is created, the date and time.
jeon ---> is the name of the file or directory.

* Chmod command
chmod command to set permissions for the file or directory. general format of this command is as follows:
chmod perms name
perms point to the desired permission must be set to the name of the authority is the name of the file or directory. perms argument can have many forms, but are mainly used as follows:
To set permissions for who want to use one or more letters. Owns man u, group g, o, for everything a use.
+, Otherwise that would like to give permission for use.
That represent the permissions you want to use or do not want, you must use one or more letters. Need to use the letters r, w, x.
Example As an
chmod a-rwx file
chmod u + rwx file
chmod g+ r file
The first command, then the owner's permission to abems and limit the rights of all users of all allowed in the final group for the diary privileges allowed. A result giti users are not able to do anything to the file, the group has only read-only, and the owner will have the right to do everything.

* Null device (Null Device)
Under many Unix systems, / dev / dev / null is a special file called. Very common in a Unix file. Any data whatever wrote to / dev / null, it will be lost for ever. So why this feature needs is wondering is. It is also what users want to ignore the results of the program is that / Dev / ull simply the result in such cases is simply send Will receive them immediately as soon as the file has reached the end of the message when trying to read something from / dev / null. / Dev / null, so you empty file or a file called. Outgoing data is never coming here is that there is no law.

No comments:

Post a Comment