20180325 Lecture Notes

Source: Internet
Author: User
Tags aliases manual exception handling mkdir parent directory
Kernel: The kernel is the most basic part of the operating system. It is part of the software that provides secure access to computer hardware for many applications, and this access is limited, and the kernel determines when a program will operate on a part of the hardware for how long. The kernel classification can be divided into single-core and dual-core and micro-kernel. Strictly speaking, the kernel is not a necessary part of a computer system. 1. Process Management 2. Memory Management 3. File System Management 4. Drive Management Library: a binary file that performs programming by means of a system call: statically compiled dynamically linked Linux function calls with the GLIBC call process: terminal-related process with terminal-independent processes (operating system startup) Operating System components: Kernel application components: 1. binary files 2. library files 3. configuration file 4. Help document filesystem------hierarchy uses the FHS structure. Filesystem Hierarchy Standard (file system hierarchy standards) abbreviation, most Linux version adopts this kind of file organization form, similar to the file directory of C disk in Windows operating system, FHS uses the tree structure organization file. FHS defines the purpose of each region in the system, the minimum required composition of the files and directories, and also gives the exception handling and contradictory processing. FHS/: Root directory/bin: Basic command files available to all users/sbin: Some tools for system Management/boot: Boot load must use static files, Kernerl Grub/dev: Device files and storage file device files: Character files, Block device files,/etc: System program configuration file, static file/home: The central location of the general user's house/home/username/lib: Provide shared libraries for system startup or applications on the root file system, and some kernel modules modules: for storing Kernel Module directory/lib64:64-bit operating system shared library file/media: mount point of portable device cdram/mnt: Temporary mount point/opt: Installation location of attached application, optional path/srv:date for services Prov IDed by this system/tmp: For those who can generate temporary files to provide a directory for temporary files, ordinary users can write operations, with special permissions/usr: Global shared read-only data path Bin,sbin lib,lib64 share: Share src : Source code/usr/local: let System ManagementInstallation of local applications, usually also for third-party programs/var: storage of frequently changing data directories/proc: Memory-based file systems that store information for processes and processes, most of which place kernel parameters,/sys:
Http://www.pathname.com/fhs/pub/fhs-2.3.html Http://www.ibm.com./developerworks/cn.linux
File types on Linux-rw-r--r--. 1 root root 10023 March 15:54 keyword lrwxrwxrwx. 1 root root 7 March 22:31 Lib--usr/lib dr-xr-xr-x. 5 root root 4096 March 22:42 boot

-: Regular file F d:directory directory file B: Block device file C: Character device file L: Symbolic link File P: Named pipe s: Socket file
Command type external command inline command type contact commands can have aliases, aliases can be the same as the original name, if you run the former command, use \command
Command alias: # alias definition alias: alias alias = original command-------valid only for the current shell, invalid revocation alias after exit:-------Unalias + alias--------aliases
Which:shows the full path of commands displays the file path--skip-alias: Ignores aliases, shows only the path--read-alias whereis:locate the binary, SOURC E, and manual page files for a command-b: just search the binary path, similar to which-m: Just search the user manual path w:show who's logged on and what they am DOI Ng-------------Show who's logged in and what's done who:show who's logged on-----------show who logged-on B: The time the system started-R: The system runs at the level of Bash's underlying features: command history: Histsize:shell the number of command history that the process can keep Histflie: The file path for persisting command history each user has one, default in their home directory. Bash_history history Usage:-C: Empty memory record- D: Specify to delete a day record-R: reads the command history from the file into the memory History list-W: Writes the current history memory content to the command in the histfiles invocation command list. #:。 12 Execute the 12th command of the history list again: : Executes the previous command. String: Once again, a command that starts with the most recent string in the command history list invokes the last parameter shortcut key for the previous command: ESC. String:!$ controls how the command history is recorded Histcontrol
Ignoredups: Ignore duplicate commands------echo $HISTCONTROL ignoredups ignorespace: Ignores commands that start with whitespace characters------ignoreboth: Both take effect-------
Modify the value of the variable: name= ' value '------------echo $HISTCONTROL va= ' value ' histcontrol=ignorespace------------command completion: The shell program receives a command request from the user, and after the analysis is completed, the leftmost morning string is treated as a command-command lookup mechanism: find the inline command according to the directory set in the current PATH environment variable, from left to right to search the directory under the file name if given the beginning of the string, Ability to uniquely identify a program file, click the TAB key if it is not unique, you need to double-tap the TAB key to give the list path completion under the given starting path. Each file path is matched by a string that starts at the corresponding Path tab if the identity is unique, direct tab completion if the identity is not unique, Double-click the TAB key to give the list directory Management Class command mkdir, rmdir mkdir make directories mkdir [OPTION] ... Directory ...-P: Automatically create a directory on Demand-V: Show create detailed procedure-m: Direct given permissions exercise:/tmp/gentoo/file1 file2 mkdir-p/tmp/gentoo/file1 ls ls-ln Gentoo mk Dir-pv/tmp/gentoo/file2
RmDir remove empty directories-p: After you delete a directory, if you find that the parent directory is also empty, delete-V: Show Procedure bash basic features: Command line expansion ~: Home Directory {}: can host a comma-delimited list of paths and be able to expand them to multiple paths # R M-RF *---------Clear the execution result of the directory command----------Echo $? Execution status result of the command succeeded: 0 Failed: 0-125 When the command execution is complete, its status return value is saved in a special variable in bash $? Reference Strong reference: ' Weak reference: ' ' Command reference: • Anti-single-quote bash basic features: Shortcut CTRL + A: Jump to the command line beginning ctrl+e: Skip to command line end Ctrl+l: Clear ctrl+u: Remove all characters from the beginning of the line to the position of the cursor CTRL + K: Remove all characters from the cursor position to the end of the line
Tree display hierarchy directory clears the currently established directory file: command-----RM-RF *


Exercise:/tmp/mylinux/|--bin |--etc | |-sysconfig | |--network-scripts |--sbin |--usr | |--bin | |--sbin | |--lib | |--lib64 | |--local | | |--bin | | |--etc | | |--lib | | |--sbin | |--var |--cache |--log |--run

[Root@wxq ~]# Mkdir-pv/tmp/mylinux/{bin,etc/sysconfig/network-scripts,sbin,usr/{bin,lib,lib64,local/{bin,etc,lib , Sbin},sbin},var/{cache,log,run}}



[Root@wxq tmp]# Mkdir-pv/tmp/x/{y1/{a,b},y2} mkdir: Directory Created "/tmp/x" mkdir: Created directory "/tmp/x/y1" mkdir: Directory Created "/tmp/x/y1/a" M Kdir: Created directory "/tmp/x/y1/b" mkdir: Directory "/tmp/x/y2" created
[Root@wxq tmp]# mkdir-v {b} {c,d} mkdir: Created directory "a" mkdir: directory "B" mkdir: Created directory "C" mkdir: Directory "D" created
File View Class command: Cat TAC tail head more less
More less tail View the last n rows of a file N #-#-F: View the end of the file without exiting, follow the new row monitoring log new use useful head to view the first n rows of a file N #-# Stat command: Display file or file s Ystem Status display file or file system Status Stat ...

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.