Linux study notes, linux Study Notes pdf

Source: Internet
Author: User
Tags gz file zip folder

Linux study notes, linux Study Notes pdf

  • Linux Startup
Cat/etc/inittabid: 3: initdefault: character start startx switch X Window start id: 5: initdefault: X Window start

  • Windows hosts:
% SystemRoot % \ system32 \ drivers \ etc \

  • Linux jdk:
Export JAVA_HOME =/usr/java/jdk1.6.0 _ 27 export JAVA_BIN =/usr/java/jdk1.6.0 _ 27/binexport PATH = $ PATH: $ JAVA_HOME/binexport CLASSPATH =.: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jarexport JAVA_HOME JAVA_BIN PATH CLASSPATH
  • Ctags + vim
Vim:Install vim: sudo apt-get install vim; Esc key -- the key in the upper left corner (normal mode), enter colon (command line mode), and wq -- w (write) to write, q (quit) quit ,! (Exclamation point) force I to insert (3) Vim split screen start: Use uppercase O parameters for vertical split screen. Vim-On file1 file2 ...? Use the lower-case o parameter to split the screen horizontally. Vim-on file1 file2... note: n is a number, which indicates several screens.
Start Vim and split the screen horizontally. : Split vertical split screen. : Disable vsplit split to close the current window. Ctrl + W c close the current window. If only the last one is left, exit Vim. Ctrl + W q split up and down the currently opened files. Ctrl + W s? Split up and down, and open a new file. : Sp filename? Split the currently opened files left and right. Ctrl + W v? Split left and right, and open a new file. : Vsp filename: The cursor key in the move cursor Vi is h, j, k, l. to switch between screens, just press Ctrl + W.
Move the cursor to the right screen. Ctrl + W l move the cursor to the screen on the left. Ctrl + W h move the cursor to the screen above. Ctrl + W k move the cursor to the screen below. Ctrl + W j move the cursor to the next screen .. Ctrl + W w mobile split screen function still uses the Vim optical key, only in uppercase. Of course, if your split screen is messy and complicated, this function may have some very strange symptoms.
Move to the right. Ctrl + w l move Ctrl + w h move Ctrl + w k move Ctrl + w j move down the screen size below are some operations to change the size, mainly the height, you can use Ctrl + W <or> for the width, but this may be supported by the latest version.
Make all screens have the same height. Ctrl + W =? Increase the height. Ctrl + W +? Reduce height. Ctrl + W-
(4) Common commands in Normal Mode: j: Move to the next line, k: Move to the previous line, l: Move to the right, h: Move to the left dd: Cut the current line, 10dd: cut from the next 10 rows of the current row yy: copy the current row, 10yy copy from the next 10 rows of the current row p: paste to the next row of the current Row o: insert r in the next row of the current row: Replace the current character
Fx: move the cursor to the next x of the current row. Obviously, x can be any letter, and you can use; to repeat your previous f command. Tx: similar to the preceding command, but it is moved to the left of x. (This is really useful) Fx: similar to fx, It's just looking back. W: move the cursor forward to a word. B: Move a word behind the cursor. 0: move the cursor to the beginning of the current row. ^: Move the cursor to the first letter of the current row. $: Move the cursor to the end of the line .) : Move the cursor to the next sentence. (: Move the cursor to the previous sentence.
<Ctrl + F>: Move the screen down. <Ctrl + B>: Move the screen up. G: to the end of the file numG: move the cursor to the specified row (num ). (For example, 10 Gb is to 10th rows) gg: To the first file H: move the cursor to the top of the screen M: move the cursor to the middle of the screen L: move the cursor to the bottom of the screen *: read the string at the cursor and move the cursor to where it appears again. #: It is similar to the above, but it is looking in the opposite direction. /Text: search for the string text from the current cursor and reach the place where the text appears. You must press enter to start the search command. If you want to repeat the previous search, press n .? Text: similar to the above, but in the opposite direction. Ma: Mark a bookmark at the position of the current cursor. Its name is. Only lowercase letters are allowed. You can't see the existence of bookmarks, but it is already there. 'A: To bookmarks. Note that this is not a single quotation mark. It is generally located on the left of 1 of most keyboards. '.: The last time you edited the file. This command is useful, and you do not need to mark it yourself.
I: insert I to the left of the current character: Insert a to the beginning of the current line: Insert A to the right of the current character: insert o at the end of the current line: insert a new line O under the current line: Insert a new line c {motion} on the current line: Delete the character crossed by the motion command and enter the insertion mode. For example: c $, this will delete the characters from the cursor position to the end of the line and enter the insert mode. Ct !, This removes the exclamation point from the cursor position to the next one (but not included), and then enters the insert mode. The deleted character is stored in the clipboard and can be pasted out. D {motion}: similar to the above, but does not enter the insert mode.
Ctags:1) first, you need to install ctags. Enter the following command in the terminal to install ctags: Apt-get install ctags2) Next, you need to recursively create a tag under the linux- home directory to switch to the kernel home directory Ctags-RRecursively create tags for all functions in the kernel. This process takes several minutes. 3) after completing the preceding two steps, later we can directly use ctags to help us search for the kernel function cd linux- must be in the kernel main directory to use ctagsvim to open vim, in vim input ctags command to realize the function SEARCH Command description : Ta functionView a function named function : TnextView next : TfirstView the first searched item : Ts functionView the function named function. If there are multiple functions, press Ctrl +] to enter the function or struct where the cursor is located, and define Ctrl + o to return to the previous position. GfGo to the file table 4.4.1 where the cursor is located to view the operations of the kernel function, for example, to find the structure definition of platform_device, the process is as follows: 1) In the linux- directory, open vim ", Press: "Enter the command line mode, input: ts platform_device2) Press enter, we can see two results found, 1st results are what we want to find, enter the number 1, then press Enter 3) next we can see the definition of the platform_device struct.
  • Check the current folder size in linux:
  • Set scheduled tasks in Linux:
1) Enter crontab-e in the command line and add the corresponding task. The wq disk will exit. 2) directly edit the/etc/crontab file, that is, vi/etc/crontab, add the corresponding Task 10 13 25 9 * root rm-rf/mnt/fb -- m h dom mon dow user command minute hour day month week user command
  • Check whether the library is correctly compiled
Ldd-r lib. so // dynamic library nm libfirst. a | more // static library
  • View port status
Netstat-apn | grep port number lsof-I | grep Port Number 2. Use the port scanner nmap to check which ports are listening to the network and determine which ports are listening to TCP connections from the network: nmap-sT-O localhost
  • View the end of a file
Tail-f filename
  • Capture the tcpdump package in linux
Tcpdump-s0-vvvX host, and port 9015
  • View core File Dependencies
File core.110
  • Analysis of core files in Linux
Ulimit-a -- View core familiar with ulimit-c 1024 -- set the core generation size ulimit-c unlimited -- set the core file generation to be unrestricted
  • View File System size
Df-h view Partition Block Size du-h -- max-depth = 1 [Folder name] view specified folder size
  • View disk usage
Df-h file system capacity in use available % mount point
/Dev/sda1 18G 6.9G 9.7G 42%/
Tmpfs 442 M 0 442 M 0%/dev/shm fdisk-l can list the number of all disks on the machine, you can also list all disk partitions. cat/proc/partitions: view all disks and partitions on the current machine.
  • View memory size
Parameter: free [-m | g] memory display by MB, GB
  • View cpu
View cpu count only grep "model name"/proc/cpuinfo | wc-l only core count grep 'core id'/proc/cpuinfo | sort-u | wc-l only view threads data grep 'processor '/proc/cpuinfo | sort-u | wc-l
  • View system memory
  • View the status of each process
  • View Load

  • View disk I/O loads:
Iostat-x 1 10
  • View real-time memory usage
  • View the folder size
Du-h -- max-depth = 0 [dir] du-sh [dir]
  • View the size of each segment of the program
Text data bss dec hex filename 1252 292 8 1552 610./test
  • Linux authorizes all subfolders in a folder
Chmod-R 777/var/home/userid/cc
  • Set shortcuts in Linux:
Alias bin = "cd $ SCS_ROOT/bin"
  • Linux Online file copy command:
Scp username @ host: path/filename.
  • Decompress and compress (bz2 File compression rate is better)
Run the * .tar.bz2 FILE command, unzip: tar-jxvf * .tar.bz2, compress: tar-jcvf * .tar.bz2 folder name * .tar.gz FILE command, unzip: tar-xvf * .tar.gz compression: tar-cvf * .tar.gz folder name *. zip file command, decompress: unzip file name, compress: zip *. zip folder name
  • RPM installation package:
Rpm-qa | grep tcp
Rpm-ivh test. rpm Installation
Rpm-Uvh test. rpm upgrade
  • Enable ubuntu root User
Sudo passwd root
  • Input Terminator
EOF ctrl + d
  • Common commands to view cpu
  • Common commands to view memory
  • Common commands to check whether the cpu is 32-bit or 64-bit
Getconf LONG_BIT
  • Common commands to view the current linux version
  • Common commands
  • Common commands to view the current time

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: 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.