unix operating system
why? Choose an operating system according to user needs
Individual users: windows
Enterprise users: do server-side (website) development
Server-side requirements :
1) Security (windows not satisfied)
2) Stability (no shutdown) (windows not satisfied)
3) High efficiency (windows not satisfied)
So choose unix or unix-like The system meets the requirements of the server side
what? is an operating system
how? command
Development phase: select the operating system project according to habits
Deployment phase: must be deployed to Unix system server
The development history of Unix
Unix has developed into two series: BSD genre and System V genre
linux (linux is not Unix, just a copy of Unix)
Learning objectives:
1) Remote login and remote logout of the Solaris system
2) File system
3) Create files and directories and modify their permissions
4) Operate text files, use vi Text editor
5) Configure environment variables
1. Components of OS
Computer composition: hardware and software (system software and applications such as that)
System software: operation System
Application software: download different software according to different operating systems
The composition of the operating system: Hardware (hardware), Kernel (operating system kernel, control hardware), Shell (operation), File System (File system)
1) Kernel system kernel is the core of OS
Management hardware
Management memory allocation memory is used to save running data, power failure is destroyed
Management process (process Scheduling, process switching)
Program: static, no memory space allocated
Process: dynamic, memory space must be allocated
One program can start multiple processes
Process started The key: whether to allocate enough memory space
Play a control function (drive) between the system program and the system hardware
Manage the swap space (virtual memory, open up a swap space in the hard disk, place idle processes, satisfy The startup of other processes, swap-in and swap-out operations to achieve limited resources and unlimited operations)
Management wizard process (background process, daemon process, the process that runs automatically at startup, and does not end until shutdown)
Manage file system ( Create files, etc.)
2) Shell enables the interface (interface) between the user and the Kernel
to explain and translate Translator’s function (explained to Kernel and translated to user, 01 code)
Ordinary user: $ username: zhangsan lisi briup multiple
super user: # username: root 1
p>
The first time you use a super user, set a password for the super user:
sudo passwd root
Password for briup:
Enter a new unix password:
Re-enter a new unix password:
passwd: To successfully update the password
Ordinary user switch to super user: su or su-(switch super user home directory)
Super user switch to ordinary user: exit
< p> Home directory: each user has his own home directory
/home/zhangsan (home directory of ordinary users)
/root (home directory of super user)
whoami: view current user (super user) Or ordinary user)
pwd: Display the absolute path of the current path
3) File system: All hardware will be mapped into a file
Directory file: /
executable File: *
Text file: (none)
ls /: View all files in the root directory
The path name is used to uniquely distinguish between files and directories.
Path names can be used Relative road strength and absolute road strength
Relative road strength: Do not start with “/”
Relative point: Current path, will change
Absolute road strength: Start with “/”
Relative point: Root Path, will not change
2. Command
Command format: command option [] (preceded with -) parameter []
whoami
ls /
df -k View System partition situation
Partition mount point
/dev/sda1 (partition name)
/dev/sda2 /
clear: clear screen
pwd: display the absolute of the current directory Path
cd: switch directory (switch directly to the home directory without adding the path, switch to the added path with the path)
..: return to the parent directory
.: current path
~: home directory< /p>
ls: Display the list of files and directories in the current directory
ls -a: Display all files, including information about hidden files (hidden files start with .)
ls -R: Iteratively display file information (display all files, if there are folders, continue to iterate until all files are traversed)
ls -t: sort according to the last modification time
ls -l: display detailed file information (d On behalf of the directory,-on behalf of the file; rwx owner permissions , Rx permissions of the same group, rx permissions of others, link number, owner,
owning group, size, last modification time, file name)
ls -d: display file information
ls -F: Display file type (directory file/, executable file*, link file@, text file do not add anything)
Options can be combined, abbreviated: ls -ld /etc
ls path: display specified List of files and directories of the path
file File name: View the file type according to the content of the file
chmod owner permissions|same group permissions|others permissions file name: modify permissions
Permission: r read permission
w write permission, for directories, can generate files and subdirectories or delete files and subdirectories
x execute permission, for directories. You can find the contents in this directory
-no permission
rw- r– r–(owner, person in the same group, other people)
u owner-the person who logged in when generating the file, with the highest authority
g People in the same group-one or several people in the same group assigned by the system administrator
o Others-people except the owner, people in the same group
a Everyone-including the owner and the same group People and others
= set access permissions
-remove access permissions
+ grant access permissions
For example: chmod gr file1
chmod u+x,go+r file1 (different types of people To set the same permissions, you need to add “,” to separate)
chmod a=rw file1
Digital mode setting permissions:
4 Read
2 Write
1 Execute
/p>
7 rwx(4+2+1)
6 rw –
5 r-x
4 r–
3-wx
2-w –
1–x
0—
For example: chmod 555 dante (owner, the same group, others are rx)
touch File name: create and update files
mkdir relative path or absolute path: create a single-level directory
mkdir -p relative path or absolute path: create a multi-level directory
cp: Copy files
-i prompt message
cp -r source directory target directory
cp source file target directory
cp source file target file
mv: move or rename< br>-i There is a prompt message
mv source file target file
mv source file target directory
mv source directory target directory
rm: delete file
rmdir: delete directory ( Only empty directories can be deleted)
rm -r: delete non-empty directories
man: help commands (and ls –help, info ls)