Linux first day 1. Virtual machine Install Linux (CentOS 32bit) 1.1 Virtual machine preparation for pre-installation work, such as memory. Hard disk. CPU allocation. Image download, such as 1.2 installation (graphical interface or command line recommended graphical interface direct return) 1.3 installation process by default, such as the default language, keyboard, etc. 1.4 installation partition 1.4.1 Delete all partitions on the selected disk 1.4.2 remove the Linux partition on the selected drive 1.4.3 Use free space on selected drive 1.4.4 custom partition 1.4.4.1 Linux disk represents 1.4.4.1.1 IDE disk HD (disk prefix) HDA (disk 1) HDB (disk 2) hda1 (disk 1 of 1 partitions) HDB1 (1 partition of Disk 2) 1.4.4.1.2 SATA disk SD (disk prefix) SDA (disk 1) SDB (disk 2) SDA1 (1 partition of Disk 1) SDC6 (3 partition of disk 6) 1.4.4.2 Linux partition represents a 1.4.4.2.1 mount point that is all points The root 1.4.4.2.2 file system type of the zone is the partition storage format 1.4.4.2.3 partition size 1.4.4.2.4 swap partition (swap is virtual memory under Windows) 1.5 network configuration (IP, gateway, subnet mask, hostname, DNS, etc.) 1.6 time zone, User password Settings 1.7 default package installation 1.8 Reboot the system after installation 1.9 system initialization settings (firewall, create user, SELinux, etc.) 1.10 if it's a multi-system, install Windows and reload Linux first. Because the installation of Windows overrides the boot file 2. Familiar with the system graphical Interface 2.1 folder tab open mode display (edit, preferences inside settings) 2.2 Hidden file view (preferences set to. start files or folders are hidden files/folders) 2.3 Standard toolbar Use 2.4 Support for 7 terminals (the first 6 are command after 1 for the graphics shortcut to ctrl+alt+ f1~f7) 3. Command 3.1 command Format 3.1.1 command-Options .... Parameter 3.2 common Command 3.2.1 LS command displays the current directory file information ls-l Display directory full information = "Llls-i display directory all files, including hidden files ls-s display file size ls--help display options about LS Help information ls-lis equivalent Ls-l-i-s3.2.2 pwd command displays current directory name 3.2.3 Clear command (ctrl+l) clear Screen 3.2.4 Date command displays current time date 3.2.5 CalCommand Display Calendar cal 12 2012 View December 2012 Calendar Note Year of year Cal 2012 View 2012 All month calendar 3.2.6 BC command Calculator scale=4 (4 digits after decimal point, the number after the decimal point is not retained by default) 1/3 3.2.7 hi The story command executes a collection of commands (1000 duplicates) history!22 (executes the 22nd command) 3.3 command case sensitivity 4. hotkeys and shortcut Keys 4.1 tab Hotkey ———— Auto-completion command if the only one is automatically padded, If not the only need to press two times to load all the possibilities 4.2 up and down hotkeys ———— perform a historical command switch 4.3 ctrl+i/home ———— command line cursor quickly switch to the beginning of the Bank 4.4 ctrl+e/end ———— command line cursor quickly switch to the end of the bank 4.5 ctrl+u- ——— Remove the 4.6 ctrl+k from the current cursor and remove the 4.7 Ctrl + C ———— abort the input command to execute 4.8 ctrl+shift+t ————— multiple open terminal 4.9 ctrl+d ———— close Terminal 5. Help Information 5.1 The Whatis command ———— view the command function Whatis ls5.2 ls--help ———— The common options for this command are the 5.3 Man command ———— view the specific details of the command man lsman-k clock ———— View all commands that contain the Clock keyword man host.allow ———— view the file configuration description Enter/+ keyword to highlight the keyword using m/n to go up and down (or up down) to exit the q5.4 Info command ———— usage is the same as man. Man can replace 6. Compiler 6.1 nano6.2 gedit6.3 vi7. Some use tips 7.1 data sync problem sync command ———— sync memory data to hard Disk 7.2 switch command 7.2.1 shutdown command 7.2.2 reboot command 7.2.3 Poweroff command 7.2.4 Halt command 7.3 runlevel 7.3.1 level (7) 0: Shutdown Mode 1: Single user mode 2: Multiuser mode (no NFS) 3: Multi-user mode (with NFS) 4: System reserved 5: GUI 6: System shutdown and restart 7.3 .2 Init command ———— switch run level init 3 switch to 3 level init 0 switch to Level 0 shutdown init 6 switch to Level 6 Restart 7.4 Forget root password 1. Press the E key when booting to enter the optional entry 2. Go in.Compilation mode 3. Hit 1 press ENTER, press B to go to compile 4. After compiling, enter passwd change Password 5. Then restart to use the new password to login 8. File permissions and directory configuration 8.1 file permissions 8.1.1 permission description drwxr-xr-x. 2 root root 4096 Oct 23:53 desktopdrwxr-xr-x: File/folder permissions first bit: D for folder-for file B for device (block) u disk, hard disk etc. c for device (character) keyboard, mouse, etc. l for Soft Connect (shortcut) Other bits: R Read W Write X run the first three bits for owner rights (U) in the middle three bits for all group permissions (g) after three bits for other people rights (O).: Is hidden file root: File/folder owner root: File/Folder All groups 4096: File/File size Oct 23 23:53: Creation Time/ Modified Time Desktop: File/folder name 8.1.2 default permissions 1.umask command ———— file default permissions 2.chattr/lsattr command ———— file hidden property 3. Suid/sgid/sbit command ———— file special Permissions 4.file command ———— file type 8.2 Change file/folder permissions 8.2.1 chmod command ———— modify file/folder read and Write permissions The first way: chmod u+x,g+r,o+r XYZ (Does not change sub-file permissions) The second way (recommended): Chmod 766 xyz (Does not change sub-file permissions) R:4 w:2 x:1 7:rwx6:rw5:rx3:wx chmod-r 766 xyz (will change sub-file permissions) 8.2.2 Ch Own command ———— can modify owner and all group permissions chown Hadoop xyz/Change the owner of XYZ to Hadoop user chown-r hadoop:root xyz/change all file owners under XYZ to Hadoop users. All groups change to the root8.2.3 chgrp command ———— only changes all groups Chgrp root xyz/change all groups of XYZ to root8.3 file directory structure bin ———— can run program boot ———— system boot file, kernel initializes dev ———— Device files etc ———— profile Home ———— user's home directory lib ———— link library file lost+found ———— default media ———— mount point, Auto misc ———— default mnt ———— mount point, Manual net ———— Network file opt ———— install the directory proc ———— kernel parameters when using the source installation package,No disk size root ———— root user's home directory sbin ———— like bin, System Administrator's command selinux ———— selinux file directory SRV ———— sys ———— system configuration file tmp ———— temp file usr ———— Install software default path var ———— log file, cache file, data file 8.4 absolute path and relative path to the current directory. Top level directory: 8.5 Basic View Command 1.uname command ———— return system type name UNAME-A View system All information 2.lsb_release command 9. File and directory Management 9.1 directory and file-related Operations 1.CD command ———— switch directories cd:change directory~: A variable that represents the current user home directory CD-The last directory (note not the top level of the directory) 2.mkdir ———— add directory mkdir xx yy zz Create three directories for xx yy zzmkdir-p Xx/yy (if the parent folder does not exist create Parent folder) 3.rmdir ———— Delete directory (cannot delete non-empty directory) rmdir xx yy zzrmdir-p xx/yy (if there is only one file in the parent folder, the parent folder is deleted) 4.rm ———— Delete the file rm-rf XX (delete all files in xx) 5.cp ———— copy files 1.cp xx/yy xx1/yy1 If yy is a file and Yy1 is a folder, copy yy to Yy1 if yy is a file, and yy1 is a file or does not exist, The yy is copied to xx1 and renamed to YY12.CP-RF Xx/yy Xx1/yy1yy is the folder will be yy all files copied to xx1 under YY1 (not copied permission property information) 3.CP-RFP Xx/yy Xx1/yy1yy is the folder will yy all the text Copy to xx1 under YY1 (Replication permission attribute information) 6.mv ———— moving files (consistent with CP usage) 7. View File Contents 1.cat ———— order display, only see the last screen content suitable for viewing small files cat-n xx line number 2.TAC ———— reverse display 3 . NL ———— equivalent to Cat-n4.head ———— view files first few lines head-5 xx before the five elements (default header 10 lines) 5.tail ———— View the file after a few lines tail-5 xx after five lines (default tail 10 line) 6.more ———— split screen view more XX (carriage return line a line of space one screen a screen can only look back, can't look forward) 7.less-——— split screen view content less XX (can go forward) 8.od ———— view binaries 8.touch ———— Create a file touch Xx9.whereis/locate/find ———— Find Files Whereis xxlocate xx (not in time , in the database to find, if necessary in a timely manner, to update the database updatedb) Find Directory-Property property value (do not specify directory in the current directory lookup) Properties: permissions, size, time, etc. 9.2 path variable $path1. Variable Assignment $path= ".:/ Usr/local/hadoop/bin:/usr/local/jdk/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin "2. Output print variable value echo $PATH
Linux No. 01 Day