Linux study Note 1

Source: Internet
Author: User
Linux study Note 1-Linux general technology-Linux programming and kernel information. The following is a detailed description. Today, I started a non-graphic linux learning process. Although I mentioned earlier that I want to learn how to install related programs and configure application software in the graphic interface. However, I only installed a Vitual machine workstation on windows, and loaded the debian created by my senior brother.
Detailed description of linux and win partition formats
There are three common partition formats for win: FAT16, FAT32, and NTFS. In Linux, there are four formats: Ext2, Ext3, Linux swap, and VFAT.
FAT16:
As a File name, FAT (File Allocation Table, File Allocation Table) has become a computer term since its publication in 1981. For reasons of the times, most operating systems, including Windows, MacOS, and a variety of Unix versions, support FAT.
This is the disk partition format used in the MS-DOS and earlier Windows 95 operating systems. It uses a 16-bit File Allocation Table, which is currently the most supported disk partition format by the operating system. Almost all operating systems support this partition format, from DOS, Windows 95, Windows OSR2 to Windows 98, Windows Me, Windows NT, Windows 2000, and Windows XP, FAT16 is supported, however, supporting only 2 GB hard disk partitions has become a major disadvantage. Another drawback of the FAT16 partition format is that the disk utilization efficiency is low (for detailed technical details, refer to relevant materials ). To solve this problem, Microsoft launched a new disk partition format-FAT32 in Windows 95 OSR2.
FAT32:
This format uses a 32-bit File Allocation Table, which greatly enhances the disk management capability and breaks through the limit of 2 GB for each partition in FAT16. Due to the current reduction in hard disk production costs, the capacity is getting bigger and bigger. After using the FAT32 partition format, we can define a large-capacity hard disk as a partition instead of Several partitions, this greatly facilitates disk management. In addition, compared with FAT16, FAT32 can greatly reduce disk waste and improve disk utilization. Currently, Windows 95 OSR2 and later operating systems support this partition format. However, this partition format also has its disadvantages. The first is a disk partitioned in the FAT32 format. As the File Allocation Table expands, the running speed is slower than that of a disk partitioned in the FAT16 format. In addition, since DOS and Windows 95 do not support this partition format, the DOS and Windows 95 systems cannot be used after this partition format is used.
NTFS:
To make up for the functional defects of FAT, Microsoft has created a file system technology called NTFS. It has excellent security and stability, and is not easy to generate file fragments during use. In addition, it can record user operations and impose strict restrictions on user permissions, so that each user can only perform operations according to the permissions granted by the system, fully protecting the security of the system and data. Windows 2000, Windows NT, and Windows XP all support this partition format.
Ext2:
Ext2 is a standard file system in GNU/Linux systems. This is the most widely used File System in Linux. It is specially designed for Linux and has extremely fast speed and extremely small CPU usage. Ext2 can be used for both standard block devices (such as hard disks) and Mobile storage devices such as floppy disks.
Ext3:
Ext3 is the next generation of Ext2, that is, the log function is added under the Ext2 format. Ext3 is a log File System. It records the write operations of the entire disk in a certain area of the disk, in order to trace back when necessary. When a process is interrupted, the system can directly trace and refresh the interrupted part based on these records, and the refresh speed is quite fast. This partition format is widely used in Linux.
Linux swap:
It is a swap file system used for partition swap in Linux. Linux uses this entire partition as the swap space. Generally, the swap partition in this swap format is twice the primary memory. When the memory is insufficient, Linux will write part of the data to the swap partition.
VFAT:
VFAT is called a long file name system. It is a Linux file system compatible with Windows systems. It supports long file names and can be used as partitions for switching files between Windows and Linux systems.

Linux Kernel naming mechanism:
Num. num. num
The first digit indicates the primary version number, the second digit indicates the minor version number, and the third digit indicates the minor version number. if the minor version number is an even number, the kernel is a stable version. If the minor version number is an odd number, the kernel is a development version. the first two digits can be combined to describe the kernel series. for example, the stable version 2.6.0 is the kernel series of version 2.6.
In LINUX, there are a total of 7 running levels, which are described as follows:
0 downtime. Do not set the default system level to 0. Otherwise, the system cannot start normally.
1. User mode. It is used by the root user to maintain the system and does not allow other users to use the host.
2-user mode. NFS cannot be used in this mode.
3. Full multi-user mode. The host is usually used in this mode as a server.
4. Not allocated for use.
5. Multi-user graphical login mode. You can log on to the GUI in this mode.
6. Restart. Do not set the default system level to 6. Otherwise, the system cannot start normally.
What are installed in Linux directories?
I will run the ls-l (column directory command) in the Linux root directory)
/Bin
Bin is short for binary. This directory follows the structure of the UNIX System and stores the most frequently used commands. For example, cp, ls, and cat.
/Boot
Some core files used to start Linux are stored here.
/Dev
Dev is the abbreviation of device. This directory contains all Linux external devices. Its functions are similar to. sys under DOS and. vxd under Win. In Linux, devices and files are accessed in the same way. For example,/dev/hda represents the first physical IDE hard disk.
/Etc
This directory is used to store the configuration files and subdirectories required by the system management.
/Home
For example, if a user is named wang, the user's home directory is/home/wang ~ Wang.
/Lib
This directory stores the most basic dynamic link shared library of the system, which is similar to the. dll file in Windows. Almost all applications need to use these shared libraries.
/Lost + found
This directory is usually empty. When the system is not shut down normally, it becomes a shelter for some homeless files. By the way, it is a bit similar to the. chk file in DOS.
/Mnt
This directory is empty. The system provides this directory for users to temporarily Mount other file systems.
/Proc
This directory is a virtual directory, which is the ing of system memory. We can directly access this directory to obtain system information. That is to say, the contents of this directory are not on the hard disk but in the memory.
/Root
The main directory of the system administrator (also called a Super User. As the system owner, there is always some privilege! For example, you have a directory.
/Sbin
S indicates the Super User, that is, the management program used by the system administrator is stored here.
/Tmp
Needless to say, this directory must be used to store some temporary files.
/Usr
This is the largest directory. Almost all the applications and files we need are stored in this directory. It contains the following sub-directories;
/Usr/X11R6
Directory for storing X-Window;
/Usr/bin
Stores many applications;
/Usr/sbin
Here are some hyperuser management programs;
/Usr/doc
This is the base camp for Linux documents;
/Usr/include
Find the header files required for developing and compiling applications in Linux;
/Usr/lib
Stores frequently used dynamic link shared libraries and static archives;
/Usr/local
This is the/usr directory provided to general users. It is best to install the software here;
/Usr/man
Man is a synonym for help in Linux. Here is the directory where help documents are stored;
/Usr/src
This directory exists in the open source code of Linux!
/Var
This directory stores constantly expanding things, in order to protect them? The usr is relatively stable. directories that are frequently modified can be stored in this directory. In fact, many system administrators do this. The system log file is in the/var/log directory.

Three software installation methods in Linux
1. Use the RPM software package to install
When talking about RPM (REDHAT Package Management) standard software packages, everyone may think of the well-known REDHAT company. It is the release method of RPM software packages that makes installation of application software in Linux easy. If you want to install software released in RPM mode, simply enter the command "rpm-ivh xxx. rpm.

2.Tar.gz (Tgz) software package installation
A software package with the extension tar.gz is a package packaged with the Tar program and compressed with the Gzip program. To install such a software package, you must decompress the package first. You can use tar-zxfv filename.tar.gz to decompress the package. The extracted files are in the directory named Filename. Go to the directory to view the extracted files.
LINUX Startup Sequence
LINUN startup sequence:
Poweron -- BIOS self-check -- LILO/GRUB call -- KERNEL call -- INIT *** --- MIGGETTY--LOGIN
Init calls its configuration file/etc/inttab; inittab starts from top to bottom in order and calls rc. sysinit --- rc ?. D (rc ?. All files under d are init. d) --- there is an xinetd superprocess --- Call/etc/xinetd. conf configuration file --- read/etc/xinetd from the configuration file. d file ---- call Miggetty after the end

Introduction to several common Shells
Linux provides a variety of Shell options. Frequently used include Bourne Shell (sh), C-Shelll (csh), Korn Shell (ksh), And Bourne Again Shell (bash ).
Log out
Whether you are a root user or a common user, you can log out by simply executing the exit command.
Disable Machine
In Linux, normal users do not have the right to shut down the system! Only the root user can disable it. Of course, if you press the power-off button, do not repeat it. We can implement the following methods:
1) Press CTRL + ALT + DEL to restart the system!
2) execute the reboot command, and the system will restart!
3) execute the shutdown-h now command to shut down the computer!
4) run the halt command to shut down the computer.
Do not shut down the system by means of hard shutdown or restart, which will damage the Linux File System!
Virtual console
The choice of the virtual console can be achieved by pressing the ALT key plus the F1-F6 six function keys. For example, after a user logs on, press ALT + F2 to see the "login:" prompt, which is actually the second virtual console, then press ALT + F1 to return to the first virtual console.

Linux shell refers to a program in which you can input commands on the keyboard to operate the computer. Shell executes the command entered by the user and displays the execution result on the display. This type of interaction is based on text.
Basic shell command rules
General Format: command name [Option] [parameter] [parameter]...
How to Get Command help:
1. Command-h or command-h
2. man command
3. info is a GNU hypertext help system.
4. help Command


Directory Access
List sub-objects in the current directory in ls short format
Ls? A short format lists the sub-objects in the current directory, including ".", "."
Ls? L list sub-objects in the current directory in long format
Ls? F. List the sub-objects in the current directory and use symbols to indicate different file types.
Ls? R recursively lists all sub-objects
View the disk capacity occupied by the Directory
Du directory name

Change the working directory:
Cd
Cd ~ User to user's home directory
Cd .. to the parent directory of the current working directory
Create a file
Touch file name
Directory Creation
Midir directory name
Rmdir or rm interpretation-f and? R Option
Access files:
Find command
Find .? Name "*. c"
Cat list file content (not displayed on pages)
More points are also displayed. You can flip down but not flip up.
The less score is also displayed. You can flip down but up, And the q key is out of reading status.
Copy command
Cp fiel1 file2

Move or rename
Mv

Delete a file or directory
Rm f
View the number of rows in a file
Wc-l usr. bin
View the number of bytes in a file
Wc-c usr. bin
View the content of a text file
Cat usr. bin
More: The split screen displays more 1.c.

Whoami, whereis, which, id
// Whoami: confirm your identity.
// Whereis: queries the directory where the command is located and the directory where the help document is located.
// Which: query the directory where the command is located (similar to whereis)
// Id: print your UID and GID. (UID: Unique id of the user identity. GID: Unique id of the user group. Each user can only have one unique UID and GID .)
Eg: whoami // display your login user name
Whereis bin: the directory where the bin is located. The directory is/usr/local/bin.
Which bin
Grep, find grep: Text Content Search; find: file or directory name and permission owner matching search
Eg: grep success */* Find all files in the current directory that contain success characters
Kill can kill a running or dest process.
Eg; ps ax
Passwd can be used to set a password
Commands used by history users
Eg: history // displays the commands used by the user in the past.
Chmod command permission modification usage: chmod one-digit octal number filename
Eg: chmod u + x filenmame // you only want to run the command for yourself.
// The u table shows the file owner. g indicates the group in which the file is located. o indicates others. r table is readable, w table is writable, and x table can run.
Chmod g + x filename // the same group of people to execute
Clear, date command clear: clear screen, equivalent to cls in DOS; date: display the current time.
Mount to load a hardware device
Usage: mount [parameter] device load point to be loaded
Eg: mount/dev/cdrom
Cd/mnt/cdrom // enter the cd directory
Su switches to another identity without logging out.
Usage: su-l user name (if the user name defaults, the user name is switched to the root state)
Eg: su-l netseek (switch to the netseek user and the user will be prompted to enter the password)

User Management
Change your identity. If no user name is specified, the user identity is changed to root by default. You do not need a password to switch from the root identity to any other identity.
Su [username]
Add User
Example: adduser-c "MyW"-d/home/workman-g root workman
Set User Password
Example: passwd workman
Install and uninstall software
Install rpm Software
For example: rpm-Uvh kdevelope-3.1-1.i386.rpm
Uninstall rpm Software
Example: rpm-e kdevelope
Configure, compile, install, and uninstall software packages released by source code.
./Configure
Make
Make install
Make clean
Uninstall the Software Package released by source code
Make uninstall
Package and package 2
Decomtar package
Example: tar-xvzf gaim-0.77.tar.gz
Tar-jxvf XXX.tar.bz2
Eg: tar-zxvf nmap-3.45.tgz // extract this to the nmap-3.45 directory
Generate a tar package
Example: tar cvf-/etc | gzip-9c> backup.tar.gz
Generate rar package 3
Rar a test.rar file1.txt
Rar a test.rar dir1
Extract rar package
Rar x test.rar
Decomzip package
Unzip lumaqq_p3.zip

Basic commands:
Installation and logon commands: login, shutdown, halt, reboot, mount, umount, chsh
File Processing commands: file, mkdir, grep, dd, find, mv, ls, diff, cat, ln
System Management commands: df, top, free, quota, at, lp, adduser, groupadd kill, crontab, tar, unzip, gunzip, and last
Network Operation commands: ifconfig, ip, ping, netstat, telnet, ftp, route, rlogin rcp, finger, mail, nslookup
System security commands: passwd, su, umask, chgrp, chmod, chown, chattr, sudo, pswho
Learning direction:
I. kernel source code learning. I don't have time or energy to do things now. I used to read some UNIX source code in college. I think it is good for everyone to read it again even if you don't analyze it.
2. system management, SHELL interface, and graphical plug-ins. LINUX is very similar to UNIX in terms of system management, user management, and file management. Many Commands are similar to UNIX. At present, this is my learning direction.
3. Application Development. For now, in terms of ease of use and diversified application systems, there is still a gap between LINUX and its competitor WINDOWS, and the relationship between the nature of my work, basically, we do not try to develop applications on LINUX. It adopts the principle of getting and using it.
4. Application Integration. Based on your work environment, try to integrate some LINUX applications into your work, form a whole with other systems and applications in the company, and perform unified management. This is also my learning focus.
Basic Applications in vi command mode:
W filename
Save the file being edited as filename
Wq filename
Save the file being edited as filename and exit vi
Q!
Give up all modifications and exit vi (I Don't Know How To exit after entering vi)
Next learning:
The vi editor is a standard editor for all Unix and Linux systems,
1. Basic concepts of vi
Basically, vi can be divided into command mode and Insert mode.
Text input can be made only in insert mode. Press esc to Enter command mode from insert mode;
2. Basic operations of vi
A) Go to vi
After the system prompts you to enter the vi and file name, you will be taken to the full-screen vi editing screen. after entering the vi, it is in command mode. You must switch to Insert mode to enter the text.
B) switch to Insert mode to edit the file
In command mode, press the letter "I" to enter the Insert mode. In this case, you can start to enter the text.
C) Insert switchover
You are currently in Insert mode and can enter text all the time. If you find that you have entered an incorrect word, you want to move it back using the mouse key and delete the word, press ESC to go to command mode and then delete the text.
D) Exit vi and save the file
In command mode, click the colon key. For example:
  
: W filename (enter "w filename" to save the article with the specified filename)
  
: Wq (enter "wq" to save the disk and exit vi)
  
: Q! (Enter q !, Force exit vi without saving the disk)
Reply to the previous operation
"U": If you mistakenly execute a command, you can immediately press "u" to return to the previous operation. You can perform multiple replies Based on Multiple "u" requests.
From the insert mode to the command mode, click:, and then you can perform the following operations:
B) jump to a row in the file.
"#": "#" Indicates a number. Enter a number after the colon and press enter to jump to the row. For example, enter the number 15 and press Enter, this will jump to the second line of the article.
C) Search for characters
"/Keyword": First press the "/" key and then enter the character you want to search. If the first search keyword is not what you want, you can always press "n" until you find the keyword you want.
「? Keyword: First press 「?」 Enter the character you want to search for. If the keyword you want for the first time is not what you want, you can press "n" until you find the keyword you want.

Return to the command line mode from gdb: Enter quit
To use gdb for debugging, you must use the gcc-g-o filename. c command to compile the file;


This is what I did after I installed the virtual machine and the corresponding kernel. I learned a lot about basic operations.
Pai_^

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.