Linux Learning Notes

Source: Internet
Author: User

    • Linux boot
Cat/etc/inittabid:3:initdefault: Character start startx Toggle 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_27export 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:Installation Vim:sudo Apt-get install vim; ESC--The key in the upper-left corner (normal mode), enter a colon (command-line mode), Wq--w (write) write, Q (quit) exit,! (exclamation point) force I to insert (3) Vim split screen start: Use the uppercase O parameter to split the screen vertically. Vim-on file1 file2 ...? Use the lowercase o parameter to split the screen horizontally. vim-on file1 file2 ... Note: N is a number that is divided into several screens.
Start vim and split the screen horizontally. : Split vertical split screen. : Vsplit closes the current window by turning off the split screen. Ctrl+w c Closes the current window, leaving vim if only the last one is left. CTRL+W Q split screen up and down split the currently open file. Ctrl+w s? split up and down, and open a new file. : SP filename splits the currently open file left and right. Ctrl+w v. Split the left and right, and open a new file. : VSP filename Move cursor VI in the cursor key is H, J, K, L, to switch between the various screens, just need to first click Ctrl+w
Move the cursor to the right screen. Ctrl+w l MOVE the cursor to the left screen. Ctrl+w h Move the cursor to the top screen. CTRL+W k Move the cursor to the screen below. Ctrl+w J Move the cursor to the next screen. Ctrl+w W Mobile Sub-screen This feature also uses VIM's cursor keys, but all uppercase. Of course, if your split screen is very messy and complicated, this feature may have some very strange symptoms.
Move right. Ctrl+w l Move Left ctrl+w H move ctrl+w K Move Down ctrl+w J Screen size The following are some of the operations that change the size, mainly the height, you can use Ctrl+w < or for the width, but this may require the latest version to be supported.
Let all the screens have the same height. Ctrl+w =? Increase the height. Ctrl+w +? Reduce height. Ctrl+w-
(4) commonly used commands in normal mode: J: Move to the next line, K: Move to the previous line, L: Move to the right, H: Move DD to the left: cut the current line, 10DD: Cut from the current line 10 lines yy: Copy the current row, 10yy copy from the current row 10 lines p: Paste to the next line : Insert R: Replace the current character in the next line of the current row
FX: Moves the cursor to the next X at the current line. Obviously, X can be any one letter, and you can use it; To repeat your last F command. TX: Similar to the above command, but moves to the left of X. (This is really useful) Fx: Like FX, it's just looking backwards. W: The cursor moves forward one word. B: The cursor moves backwards by one word. 0: Move the cursor to the beginning of the current line. ^: Moves the cursor to the first letter position of the current line. $: Moves the cursor to the end of the line. ): Move the cursor to the next sentence. (: Move the cursor to the previous sentence.)
&LT;CTRL+F&GT: Move down one screen. <ctrl+b&gt: Move up one screen. G: To end of file NUMG: Moves the cursor to the specified line (num). (e.g. 10G is to line 10th) GG: To the top of the 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. #: Similar to the above, but looking in the opposite direction. /text: Searches for the string text from the current cursor and reaches the text where it appears. You must use carriage return to start this search command. If you want to repeat the last search, press N.? Text: Similar to the above, but in the opposite direction. MA: Marks a bookmark at the position of the current cursor, named A. The book signature can only be lowercase letters. You can't see the existence of a bookmark, but it's already there. ' A: Go to bookmark A. Note that this is not a single quote, it is generally on the left side of 1 of most keyboards. '.: To the place where you last edited the file. This command is useful, and you don't have to tag it yourself.
I: Insert the left side of the current character I: Insert a: At the beginning of the current character insert a: Insert a on the right side of the current line o: Insert a new line below the current line o: Insert a new line above the current line c{motion}: Deletes the character that the motion command crosses and enters insert mode. For example: C $, which removes the character from the cursor position to the end of the line and enters insert mode. Ct! , which removes from the cursor position to the next exclamation mark (but not included) and then into insert mode. The deleted characters are present in the Clipboard and can be pasted again. D{motion}: Same as above, but not into 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 the tag tag CD linux-2.6.30.4 in the linux-2.6.30.4 home directory to switch to the kernel home directory Ctags-rRecursively create tags for all functions in the kernel, this process takes a few minutes 3) after completing these two steps, you can use Ctags to help us search for kernel functions directly after the CD linux-2.6.30.4 must be in the kernel master directory to use Ctagsvim to open vim, in vim Enter the Ctags command to implement the function Lookup command description : Ta functionView functions named function : TnextView Next : TFirstView the first search : TS functionView functions named function, if there is more than one list Ctrl +] go to the function or struct definition where the cursor is located ctrl+o return to the last position GFGo to the File table where the cursor is located 4.4.1 View the operation of the kernel function for example, to find the structure definition of a platform_device, the process is as follows: 1) in the linux-2.6.30.4 directory, open Vim ", press:" Enter command line mode, enter: TS platfor M_DEVICE2) Press ENTER, you can see two results found, the 1th result is what we want to find, enter the number 1, and then enter 3) next you can see the definition of the PLATFORM_DEVICE structure
    • Linux View current folder size:
        Du-sh.
    • Linux Setup timed tasks:
1) in the command line input: Crontab-e then add the corresponding task, Wq save the disk to exit. 2) directly edit the/etc/crontab file, i.e. Vi/etc/crontab, add the corresponding task 9 * root RM-RF/MNT/FB--m h dom Mon Dow user comma nd hour/month user command
    • To see if the library is compiled correctly
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 two, with the Port scanner Nmap to check which ports are listening to the network to determine which ports are listening to TCP connections from the network is: nmap-st-o localhost
    • View File Trailer
     tail–f filename
    • Linux under Grab tcpdump bag
     TCPDUMP-S0-VVVX host 218.17.157.74 and Port 9015
    • View Core file dependencies
File core.110
    • Analysis of Linux under Core files
ulimit-a--view core familiar with ulimit-c 1024--set core generation size ulimit-c Unlimited --Set core file to produce unlimited
    • View File System size
Df-h View partition block size du-h--max-depth=1 [folder name] View the specified folder size
    • View Disk the use situation
df-h           File system capacity has been used with available% mount points
/dev/sda1 18G 6.9G 9.7G 42%/
Tmpfs 442M 0 442M 0%/dev/shm fdisk-lcan list the number of all disks in the machine, and also list all disk partitions     Cat/proc/partitionsView all disks and partitions in the current machine
    • View memory Size
parameter: Free [-m|g] Press MB,GB to display memory
    • View CPU
cat/proc/cpuinfo
just look at the number of CPUs grep "model name"/proc/cpuinfo | wc-l Only core number grep ' core ID '/proc/cpuinfo | Sort-u | Wc-l only look at thread data grep ' processor '/proc/cpuinfo | Sort-u | Wc-l
    • viewing system memory
cat/proc/meminfo
    • View the situation for each process
Ps-ef
    • View Load
w
uptime

    • To view the disk IO load:
iostat-x 1
    • View real-time memory usage
Top
    • View Folder size
du-h--max-depth=0 [dir] du-sh [dir]
    • View The size of each segment of the program
size./test
Text data BSS Dec hex filename 1252 292 8 1552 610./test
    • Linux authorizes all subfolders of a folder
chmod-r 777/var/home/userid/cc
    • Setup shortcuts under Linux:
Alias bin= "CD $SCS _root/bin"
    • Linux online Copy File command:
SCP [email protected]:p ath/filename.
    • Decompression and compression (bz2 file compression rate is better)
*.tar.bz2 File command, decompression: TAR-JXVF *.tar.bz2, Compression: TAR-JCVF *.tar.bz2 folder name *.tar.gz File command, extract: TAR-XVF *.tar.gz compression: TAR-CVF *. tar.gz folder name *.zip File command, unzip: Unzip file name, Compression: 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 CPUs
   Cat/proc/cpuinfo
    • Common commands to view memory
Cat/proc/meminfo
    • Common commands to see whether the CPU is 32-bit or 64-bit
getconf long_bit
    • Frequently used commands to view the current version of Linux
Cat/etc/redhat-release
    • Common commands to view kernel versions
uname-a
    • Frequently used commands to view the current time
     Date

Linux Learning Notes

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.