Note 2 Basic Linux knowledge

Source: Internet
Author: User
---------------------------------- Chapter 2 Basic Linux knowledge ------------------------------------------- understand the system structure and directory structure, common file operation commands are key functions for file operations. Understanding the information file operations on the hard disk used. command file searching. file comparison. File directory permissions. Hard connection and symbolic link redirection. Network main command file distribution format process: running Program Linux shutdown method init 0 shutdown init 6 restart shutdown-H Now shutdown-R now restart reboot fast restart (skip the sync process) linux system organization hardware --- kernel (main part is the device driver program), manipulate hardware) ----- shell (terminal) (command interpreter, you can write commands, send commands to the kernel) ---- files/bin/sbin/usr/bin/usr/sbin/usr/local/bin/boot kernel and other system startup files/OPT install large applications/tmp temporary files/lost + found files recovered during system repair/root super user's home directory/dev Device directory B -- block Device C -- character characters the file drive/dev/CDROM Drive/dev/fd0ls-s command corresponding to the hardware device Linux can view the device type, take a look at the first character. Start the Bootstrap program/etc/lilo in the directory where the B or C/etc configuration file is located. conf/etc/grub. conf // during multi-system boot, you can set the default startup mode for the system and so on./etc/inittab (graphical/text login) file System Configuration/etc/fastab/etc/profile to add environment variables (such as modifying path) for example, configure the Java/J2EE development environment/etc/FTP * FTP configuration file/etc/httpd Web server configuration file/etc/ssh * SSH configuration file/etc/inittab // modify the file to set the Linux Startup Mode (graphics, text) stop system init 0 halt poweroff restart system init 6 reboot text interface start init 3 graphical interface start init 5 single user mode init 1 init single/home user default home directory/home/username useradd username create new user passwb username add password/etc/passwd: the system can identify other user lists that display encrypted passwords in plain text. Common users can read/etc/shadow, the directory used to protect the security of the encrypted password/lib library file/library used by the Lib system, such as C library/lib/modules/2.4.20-8/kernel/drivers driver module/usr/lib/ the library used by the application, such as MySQL API/mnt optical drive Mount-T iso9660/dev/CDROM/mnt/cdrommount-T File Type Device File Mounting directory unount/mnt/CDROM use Mount-T fstype/dev/fd0/mnt/floppy/usr // user directory/usr/doc/usr/share/DOC help document man command to view the command manual page info command to view the command HELP command-help/usr/src/linux-2.4.20-8/Linux Source Code Learn the hard disk information used. Mount the mounted partition fdisk-L [/dev/hda] Hard Disk Partition status. df-H hard disk partition usage. Du-SH directory space occupied. uname-a Linux version. Linux common file operation commands mkdir create directory Rm-R (recursively Delete directory) -F (do not prompt) recursively delete directories without prompting rmdir to delete an empty directory PWD to view the current directory switch directory cd ls-> dir format: ls [parameter] [path or file name] parameter:-A is used to view all files in the current directory, including detailed information about the hidden file-l display file, by default, only file names are displayed.-R recursively displays all directories and files.-D does not recursively show more/less files: view the content of a value-added cat file. Mv [parameter] <SRC> <DST>-I-FCP format: CP [parameter] <SRC> <DST>-F Direct Overwrite-I indicates whether to overwrite-r recursive Linux File Type 1 normal file (ordinary files ): Text File and binary file 2 directory file (directory files) folder 3 special files character device file block device file (such as hard disk) Symbolic Link (symbolic links) hard Link (hard links) the soft link displays the corresponding color of the file type in different colors. The configuration file/etc/Dir-colors checks the file system. When the system shuts down abnormally, it may not be able to enter the system, in this case, you can execute fsck to fix the disk fsck [Option] <Device Name>-r recovery, and ask the user to confirm-P automatically fixes the problem of securely correcting and not causing data loss. fsck-p-t search for the ext2/dev/hda2 file 1 find path [Option] Find/etc-Name (passwd file name) -Size search by file size-type search by file type 2 grep [Option] search mode file name [file name...] grep [parameter] 'str' filelist-N display Match row number-I ignore case-r recursive search index node Linux File System uses index nodes to hard link and symbolic link: Use ln-s command to create the symbolic link of the file; A symbolic link is a special file in Linux. As a file, its data is the path name of the linked file, similar to the shortcut. Inode: ls-iln (Link) ln [parameter] <DST> <Link name> hard connection (hard link) the same file system cannot point to the destination file symbolic link of the directory file ln source file: common LLn-S source file target file ln-S/usr/local ----------------------------- Linux User Type --------------------------- System Administrator (Root) System Administrator (SA) the user who is mainly responsible for the smooth operation file of the Linux operating system and owns the file (u) to become the owner of the file group (g) can give a name to the user group, just like giving a user a name, other users (o) the user rwx R-x --- 111 101 750 000 7 5 0 chmod file/directory name authorization does not belong to a specific group. Change the file access permission symbol flag method chmod (ugoa) (+-=) (rwx) filename/filelistchmod G + W o-x/usr/local/* chmod 755/usr/local/* To find two text files differential diff [parameter] <File>-W ignore all space differences-I ignore case sensitivity CMP compare any two files CMP [para] <File> standard input of standard files the file keyboard becomes a standard input file in Linux, all open files, including standard files, are assigned the number of file descriptors, file descriptor 0 is assigned to standard input file standard output file monitor to standard output file descriptor 1 is assigned to standard output file standard error File Monitor and standard error file descriptor 2 is assigned to standard error file ----------------------------------- redirection changes to the allocation input redirection about standard input, output, and error: the following example shows how to use input redirection: CAT <test1 <enter> error redirection cat datafile 2> error-mesg <enter> output redirection: cat test1> Test2 network command ifconfig // ip address nic and other information Ping // test network connectivity command router-N // view Routing Status netstat // view network installation proposal in Linux application distribution format: packages // not packed, and compressed into. GZ format RPM package RedHat package Encapsulation Format example-1.2.3-1.i386.rpm // this package is applicable to the hardware platform for i386dpkg package Debian software storm pack format example-1.2.3-1.i386.deb ready RPM package rpm-IVH rpm package installation RPM package rpm-uvh RPM package upgrade RPM package rpm-e RPM package Delete RPM package rpm-Qi package name list information rpm-qf'which command 'display command package rpm- list of files with fixed QL package name: www.rpmfind.net [root @ lxt root] # first root: super User lxt: Linux host name second root: Current Directory PWD command to view the current absolute directory CD .. return to the useradd lxt008 directory at the previous level. // Add the passwd lxt008 user. // Add the password and enter the new password: in/home, The lxt008 file will be released. The root user places himself in the root directory, and the profile will set the environment variable more to view the file content.

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.