Getting Started with Unix OS and basics

Source: Internet
Author: User

Http://dev2dev.cnblogs.com/archive/2005/10/10/251894.aspx

Getting Started with Unix OS and basics

Unlike the familiar Windows user interface and usage habits, UNIX is often used command run, very flexible operating system, the current products are mainly Ibm-aix, Sun-solaris, Hp-unix and so on. Initial exposure to UNIX operating systems, the following problems are almost always encountered: from the graphical interface operations to the command line operation of the unaccustomed, in the short term to grasp the difficulties of all commands, for the same operation has a few commands difficult to select, different shell command format is easy to confuse, and so on. Some beginners may lose confidence that they will continue to learn. According to the above-mentioned situation, this article follows the principle of "avoiding the complexity, avoiding the abuse on the essence, not seeking exhaustive, only apply", and taking the process of the beginner on the machine as the thought, and trying to explain the basic contents of the operating system using the detailed slightly and proper interpretation, in order to achieve the purpose of convenient entry and faster refinement.

(i) UNIX Operating system overview

Unix operating system is a powerful multi-tasking, multi-user operating system. As early as the 60 's, Ken Thompson, Dennis Ritchie and other researchers at T-Bell Lab combined a multi-access computer system (multiplexed information and, in order to meet the needs of the research environment) Computing system) researched the many features of the project and developed the UNIX operating system. So far, the inherent portability of UNIX has enabled it to be used on any type of computer: microcomputers, workstations, small machines, multiprocessor and mainframe machines.
The UNIX operating system is typically divided into three main parts: the kernel (Kernel), the shell, and the file system.


Kernel is the core of Unix operating system, directly control the various resources of the computer, can effectively manage hardware equipment, memory space and process, so that the user program is not affected by the intricate details of hardware events.
The shell is the interface between the UNIX kernel and the user and is the UNIX command interpreter. The most common shells are Bourne shell (SH), Korn Shell (ksh), C Shell (CSH), and bourne-again Shell (bash), this article mainly takes CSH and bash as an example.
A file system is the organization of a file that is stored on a storage device, such as a hard disk, and is usually organized in a directory-level manner. Each directory can include multiple subdirectories and files, and the system will be the root directory. Common directories are/etc (often used to store system configuration and Management files),/dev (commonly used to store peripheral files),/usr (often used to store user-related files), etc.


(b) The basic operation of the machine explanation

Introduction UNIX operating system is to make the necessary knowledge foreshadowing, in order to avoid the beginning of the boring and the list of complex UNIX commands, parameters people feel fear and boredom, then let us on the machine to operate it!
For the first time using UNIX, the most common operation is to create a new directory, create a new file, enter the specified directory, display directory content, display the current path, view the contents of the file, copy files, move files, delete files, delete directories, view system help, and so on, then we will simulate these necessary procedures to practice the basic operation.
(1) First let's create two directories in the current directory Dir1,dir2:
mkdir dir1 DIR2//Enter the command and remember to hit ENTER:)
(2) Enter directory Dir1 to create the file File1,file2:
CD Dir1//Enter directory Dir1
Touch file1 file2//Create file File1,file2
(3) Re-enter the directory Dir2 to create the file file3,file4:
Cd.. Return to the top level directory
CD DIR2//Enter directory Dir2
Touch File3 file4//Create file File3,file4
(4) To view the files and subdirectories contained in the directory Dir2:
LS//This will see the screen showing 2 files in the directory Dir2 File3 and File4
(5) Write the information to the file File3 and copy it to the directory Dir1:
Cal 5 2005 > File3//The sentence will be explained in detail after this command, you can enter it here
CP File3. /dir1
(6) Return to the directory Dir1 to see the files and sub-directories included:
Cd..
CD Dir1
LS//This will see the screen showing 3 files in the directory Dir1 file1, file2, File3
(7) Review the contents of the file File3 and delete the file:
Cat File3//You'll see the May 2005 calendar on the screen
RM file3//delete file File3
(8) Move the file file1 to the directory Dir2, while viewing the directory Dir1, dir2 the files and sub-directories:
MV File1. /dir2
LS//You will see a screen showing 1 files in the directory Dir1 file2
Ls.. /DIR2//You will see a screen showing 3 files in the directory Dir2 file1, File3, file4
(9) Display the current path and delete the directory Dir1:
Pwd
Cd..
Rm–r Dir1
(10) System help showing the LS command:
Mans LS
After the 10th step operation, it will feel a flash, in addition to a bit similar to the "Matrix" feeling, the explanation of LS is not clearly read it? Yes, because we have not used the split screen display information, the use of the following command will make your eyes suddenly clear:
Man ls | More//For | More will be explained in detail after use, just know
The way to use the space bar is to go ahead and look at the help document

See here, presumably everyone on the use of UNIX operating system will have a certain perceptual knowledge, has basically used similar to the Windows operating system to create folders, create files, view file contents, copy files, cut files, delete files, delete folders and other operations. Can wait, then probably a friend asked: "Brother, I have not landed the system, how to carry out the above operation Ah?" "This is a good question, let's start with the landing system from scratch."
If you have a UNIX operating system installed on your computer, such as installing Sun-solaris, just start the system, and wait a moment to see the 1 interface.

(Fig. 1)

We mainly use the command line method to use Solaris, so click and hold the "Options" button, the Options menu appears, 2.

(Fig. 2)
Move the mouse over the Command line Login item and bounce it off. Then, when the screen shown in 3 appears, strike the ENTER key.

(Fig. 3)
In this way, we can use the command line to manipulate the operating system. This will require the user to enter the user name and password, by default, the user name "root", password is empty to enter the system.
If the user is operating on the network on a host that is remotely equipped with a UNIX operating system, it can be accessed using Telnet. Assuming the IP address of the UNIX operating system host is 198.4.30.25, the user's operating system is windowsxp, you can enter the "DOS command Prompt" status, enter the following command:
Telnet 198.4.30.25
Login://Enter login user name
Password://Enter login password
If the user is using the Red Hat Linux system, you can right-click on the desktop, select the "New Terminal" item in the pop-up menu, and then do the same in the window that pops up. Usually if the user is logged in to a remote host for the first time, the Advanced line registration operation is required, depending on the description of the remote host operation.
Be aware that you must log out of the UNIX system every time you use it, to prevent others from entering the system through your account to ensure the integrity of the system. Enter the command "exit" to complete the logoff process.

(iii) Evolution of the knowledge involved in preview

After the previous machine operation, we should have a certain perceptual knowledge about how to use Unix system. For the next step to learn more about the UNIX system and the use of some of the skills, here to the relevant content to do a supplementary description and preparation.

First, about the shell
The shell, which has been briefly described above, has a slightly different command format from the shell, and the most commonly used shell is the C shell (CSH) and the Bourne-again Shell (bash). The shell can be nested, that is, in the C shell environment, enter the command:
Bash
Access to the Bourne-again shell environment. Similarly, in the Bourne-again shell environment, enter the command:
Csh
will be able to access the C shell environment. You can choose the appropriate shell according to your own usage habits.

Second, Unix command format
1. Unix Command Prompt
In the command-line operating environment, the UNIX system displays a prompt prompting the user to enter a line of commands after this prompt. Different shells have different default prompts, such as B Shell, Bourne-again Shell's default prompt is "$", and C Shell's default prompt is "%". However, when logged in as root, the system prompt defaults to "#".
2. Basic command format
The basic format for UNIX commands is as follows:
Command [option (s)] [argument (s)]
Unix commands consist of a command and 0 to multiple parameters. Unix commands are case-sensitive, and space is applied between the command and arguments, between parameters and parameters.

Third, UNIX file system
1. Unix File System classification
The UNIX operating system can be composed of several file systems that can be dynamically installed and disassembled. UNIX file systems are divided into two main categories: the root file system and the attached file system. The root file system is a file system that is at least a UNIX system that contains the programs and directories that make up the operating system, represented by a "/" symbol. The attached file system is a file system other than the root file system that must be hung (mount) to be used in a directory on the root file system. If there is no special statement in this article, it is for the root file system to be explained.

2. unix File types
The files in Unix are divided into four types:
(1) ordinary Documents (-): also divided into text files, binary files, data files;
(2) Catalogue file (d);
(3) Equipment file (l);
(4) Link file (b/c): can also be divided into block device files, character device files.
text files in ordinary files mainly include ASCII text files, English text files and some executable script files, and so on; the binaries are mainly 32-bit executables, etc.; data files are primarily files generated by applications running in the system.
The directory file is used to store the file directory.
The device file represents a device that is typically placed in the/dev directory. It is divided into block device files and character device files, block device files with chunks as input and output units, such as disk, character device files are characters as input and output units, such as serial port.
A linked file resembles a shortcut in a Windows system, pointing to a file that the linked file is linked to.
It is important to note that, unlike Windows systems, the directory itself is a file in the Unix system, and the file type is independent of the file's suffix name.
Different types of files have different file type identifiers (which can be viewed using the "ls-l" command), and they use the following symbols to represent the appropriate file types:
-Normal file
D catalog File
B-Block device files
C-Character device files
L Link File

3. UNIX directory structure
UNIX systems use a tree-based directory structure to organize files, and each directory may contain files and other directories. The structure is started down with the root directory "/", and each directory can have many subdirectories, but only one parent directory per directory.

4. unix File name
UNIX file names have a maximum length of 256 characters and are sensitive to case letters, such as FILE1 and File1, which represent two different files. To illustrate, if you use "." As the first letter of a file name, this file is an implied file, such as a ". CSHRC" file (which is described later in this document).
It is worth noting that when a directory or file is created, the name given to it is not its name. The full name of a directory is its complete pathname, and the full name of a file should consist of all directory names on the path from the root directory to the directory where the file is located, together with the name of the file, separated from each other by "/". If a file resume is in the directory/export/home/ray, the full name of the file should be:/export/home/ray/resume.
In addition, there are two concepts such as absolute path and relative path for path names. An absolute path is the full path name of a directory or file, which is the path starting with the root directory. The relative path starts with the user's current working directory, which is a file path relative to the user's working directory. Because the absolute path from the root directory to the user's home directory can be complex, a special character "~" can be used in CSH and bash to represent the absolute path name of the user's home directory. In addition, the "." Can be used to represent the current working directory, "..." Can be used to represent the parent directory of the current working directory.

Description

A working directory is a directory in which the user is currently operating.
The user home directory is the usage space assigned by the UNIX system administrator to each user, and the directory name is the same as the user login account. If the user is logged into the system with any account other than "root", the user's home directory is automatically logged in.

After mastering the above haulage content, the next step is to dive into the UNIX system command set and how to use it

Getting Started with Unix OS and basics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.