Linux (Centos 6.3) Learning Notes

Source: Internet
Author: User
Tags clear screen

First, the system partition
1, Disk partitioning
Use the partition editor (partition editor) to divide several logical parts on disk. Once a disc is divided into several partitions, different directories and files can be stored in separate partitions.
2, Partition type
Primary partition: There can be up to 4.
Extended partitions: There can be up to 1. There are up to 4 primary partitions and extended partitions. Data cannot be written, only logical partitions can be included.
Logical Partitioning
3, Format (advanced format)
It refers to the file system selected by the user (e.g. FAT16,FAT32,NTFS,EXT2,EXT3,EXT4, etc.),
Writes data to a specific area of the disk, dividing a partition into a disk space for file allocation tables, directory tables, and so on for file management.
4,inode No.
The inode contains meta information for the file, specifically the following:
* Number of bytes in the file
* User ID of the owner of the file
* The group ID of the file
* file read, write, execute permissions
* File timestamp, total three: CTime refers to the time when the inode was last changed, mtime refers to the time when the file content was last changed, atime refers to the time when the file was last opened.
* Number of links, that is, how many filenames point to this inode
* Location of File data block
5, Hardware Device file name
In Linux, each hardware corresponds to a device file name
6, Mount
1, must be partitioned
Root partition
Swap partition (swap partition, memory twice times, no more than 2GB)
2, recommended partitioning
/boot (boot partition 200MB)

Second, Linux system installation
1,

Set the IP address of Linux ifconfig eth0 192.168.233.2

Iv. Common Linux Commands
4.1.1 command format and directory processing command ls
Ls-a can see hidden files (with.)
LS-L Long format display
LS-LH long format humanized display (automatic conversion of file size units)

LS-LD/ETC View detailed information for a specified directory
Ls-i Viewing inode nodes

File type:-normal file D directory l soft link
R belongs to the person G belongs to group O other people
File permissions R Read W write X Execute
4.1.2 Directory processing commands
mkdir Creating a Directory
Mkdir/tmp/zhongshan can create multiple directories at the same time
Mkdir-p/tmp/zhongshan/liu Create/liu directory when/zhongshan directory does not exist

CD directory name change directory switch directories
Cd.. Return to the top level directory
PWD Print working directory displays the current working directory

RmDir Remove Empty Directory
CP-RP [Original file or directory] [target directory] can change file name during copy
-R Copy Directory
-P Preserve file attributes (modification time, etc.)
MV [original file or directory] [target directory] cut file, rename, move
RM-RF [file or directory]
-R Delete Directory
-F Forced Execution (false)
CTRL + C terminate command, ctrl+l clear screen
4.1.3 File processing commands
touch [filename] Creates a file name that allows the use of most characters except '/'
Cat Display file contents
Cat-n Display Line numbers
The TAC file appears backwards
More display long file, use space or F page, (enter) line break, Q exit
Less is similar to more, displaying long files. Press (page UP) to page forward and press (^) to flip up. '/' + keyword can search keywords, at this time you can press ' n ' to find the next highlight
Head/tail-n 20/etc/services View the first (last) 20 lines of the file, if you do not specify the number of rows, the first 10 rows are displayed by default
tail-f [FileName] dynamically displays the contents of the end of the file, CTRL + C terminate command
4.1.4 Link command
ln-s [Original file] [destination file] Create soft links, soft links feature similar to Windows shortcuts, its permissions do not affect the original file permissions, soft links can cross partitions, can be used for the directory
ln [Original file] [destination file] Creates a hard link, hard links cannot span partitions, two files can be updated synchronously, and their I nodes are the same, they cannot be used for the directory
4.2.1 Rights Management Commands
chmod (Change the permissions mode of file)
chmod [{ugoa}{+-=}{rwx}][file name]
[421] FileName
-R recursive modification, changing permissions for its subdirectories
-------------------permissions have an inheritance relationship----------------------------------------------
Directory R:ls
W:touch/mkdir/rmdir/rm
X:CD (General R and X in pairs appear)
4.2.2 Other Rights Management commands
Chown (change file ownership) changes the owner (only root can be changed)
CHGRP (change file group ownership) changes the owning group (only root can be changed)
Umask-s View default permissions for new files (none of the newly created files have x executable)
Umask 023 can change the default permissions for the current new file
4.3.1 File Search Command
Find [Search scope] [match condition]
Find/etc-name init find files in/etc directory init, accurate search
Find/etc-name *init* Find files containing init in/etc directory, fuzzy search
Find/etc-name Init??? Matches a file that starts with Init and has a 3-character back
(Ctrl+q to solve the problem of SECURECRT suspended animation)
Find/etc-iname Init??? Ignore file name capitalization
Find/-size +n search for files with file size greater than N (one chunk is 0.5kb)
Find/home-user Zhongshan Find the file owner is Zhongshan
Find/home-group to find files belonging to the group
Find/etc-cmin-(+) 5 in/etc in Find files and directories that have been modified in 5 minutes (outside)
-amin Accessing Time Access
-mmin File Contents Modify
-O--->or-a---->and
Find/etc-size +163840-a-size-204800 (and) find files larger than 80M and less than 100M
-O or OR
-type find f files According to file type D directory l soft link file
Find/etc-name inittab-exec ls-l {} \; Find the Inittab file in/etc and display its details
Find/etc-name inittab-ok ls-l {} \; Find the Inittab file under/etc and display its details asking for confirmation

Find.   -inum 130715-exec rm {} \; Locate the file in the current directory according to the I node and delete
4.4 Help Command-HELP command
Man's meaning is manual
Man ls to view the Help information for LS command
Man Services View configuration file Help information
1 Help for the command, 5 configuration file Help
Man 5 passwd View Help for passwd configuration files
Whatis ls Gets a short message for the LS command
Apropos Services View brief information about a configuration file
Touch--help options for viewing commands
Date 070222552015.00 Change System time
Info is similar to man
Help Umask Shell built-in command details (command not found at the command location)
4.5 File Search command-user management commands
Useradd User name add user (user name not too complex)
passwd User Name change user name password
Who view online login user information, TTY for local login, PTS indicates remote terminal
W Get more detailed login information
Uptime Viewing system usage
4.6 File Search command-compress unzip command
Compressed format:. gz. zip (Windows and Linux compatible)
gzip file name compressed files, only compressed files, non-compressible directories, do not retain the original file
Gunzip filename Extract File
TAR-CVF Japan.tar Japan packs The Japan catalog into Japan.tar file
TAR-ZCF Japan.tar.gz Japan Pack Compression one step complete
TAR-ZX (v) F Japan.tar.gz decompression command
Zip japan.zip Japan compresses Japan into Japan.zip
Unzip Japan.zip Extract Files
Bzip2-k Boduo compress files and keep original files
TAR-CJF Japan.tar.bz2 Japan Pack Compression one step complete
TAR-XJF JAPAN.TZ2 Decompression
4.7 Network Commands
Write user name send message to online user ctrl+d save end
Wall send messages to all online users
Ping option IP address-c specifies the number of times packet loss (packet loss rate)
Ifconfig view current NIC status
Mail [user name] view send e-mail
Mail view mail, serial number view message content, h View list, d+ serial number delete mail, q exit mail system
Last count all logged-in users and restart records of the computer
Lastlog to see when a particular user last logged on
Lastlog-u 520 Viewing the last logon time with a user ID of 502
Traceroute www.lampbrother.com Show the path of the packet to the host
netstat [options] Display network-related information
-T TCP protocol
-U UDP protocol
-L Monitoring
-R Routing
-N Display IP address and port number
Netstat-tlun querying the current native listening port
Netstat-an querying all network connections on this machine
Netstat-rn querying the native routing table
Setup Configuration Network (permanent)
Service Network restart Restart networking service
Mount-t iso9660/dev/sr0/mnt/cdrom/Mount Disc
Umount/dev/sr0 Uninstalling Discs
4.8 Power off Restart command
Shutdown-h now shuts down the machine
Shutdown-r now
Shutdown-c Cancel the previous shutdown command
Reboot restart
Init 6 Restart
RunLevel querying the current run level
Logout Sign Out
5.1 Vim common operation
VI FileName Entry
Press ESC to enter command mode
After entering command mode
A specifier insert in the word cursor
A at the end of the line where the cursor is inserted
I match either insert in the word cursor
I Insert at the beginning of the line where the cursor
o Insert a new line under the cursor
O insert a new line on the cursor
: Set Nu Sets line number
: Set Nonu Cancel line number
GG to First line
G to last line
NG to Nth row
: N to Nth row
$ move to end of line
0 move to the beginning of the line
X Delete the character at the cursor location
n delete n characters at cursor location
DD Delete Row of cursor, NDD delete n rows
DG deletes the line from the cursor to the end of the file
D Delete the content at the end of the file where the cursor is located
: n1,n2d Remove cursor Range Insider
YY copy when moving forward
Nyy Copy the current row following n rows
DD Cut when moving forward
NDD cuts the current row following n rows
P/p pasted at the current cursor row or line
U Cancel the previous action
R replaces the character at which the cursor is located
R replaces the character at the beginning of the cursor and presses ESC to end
Set IC is case insensitive
Set NOIC is case insensitive
/string specifying a search string
n searches for the next position of the specified string
:%s/old/new/g Full-Text search replaces the specified string
:%s/old/new/g Full-Text search replaces the specified string (asking for confirmation)
: n1,n2s/old/new/g searches within a certain range to replace a specified string
: W Save changes
: W new_filename Save as specified file
: Wq Save Exit
ZZ shortcut keys, save changes and exit
: q! Do not save changes to exit
: wq! Save changes and exit (file owner and root can be used)
5.2 Vim Usage Tips
: R file Name imports the contents of the file
: R! Command Import command Execution result
Defining shortcut keys
Map Shortcut Trigger command
: Map ^p (ctrl+v+p) i#<esc> ctrl+p set shortcut jump to the beginning of the line add #
: Map ^b 0x jumps to the beginning of the line to delete the first character
Continuous line Comment
: n1,n2s/^/#/g
: N1,n2s/^#//g Remove the beginning of the line #
: N1,n2s/^/\/\//g is escaped when replaced
: AB Zhongshan Zhongshanshanshanshan
/HOME/USERNAME/.VIMRC configuration related shortcut keys (permanent)
6.1 Package Management
Package Classification: Source Package (script installation package) and binary package (RPM package, system default package)



Linux (Centos 6.3) Learning Notes

Related Article

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.