Some of the Linux commands I use are also the most commonly used

Source: Internet
Author: User

I. Common MySQL database operations:
Mysql-uroot-p123456;
Mysql <./hostcache. SQL-uroot-p123456; execute the script
Mysql <E:/SQL/hostcache. SQL-uroot-p123456;
Show databases;
Use hostcache;
Show tables;
Desc hostcache;
Exit;

Select * From hostcache order by timestamp;
Select externalip, internalip from hostcache order by timestamp;
Delete from hostcache where isptype = 4;
Delete from hostcache;

Ii. Common Operations
CD ../home/tcast/natserver;
CD $ {ace_root}
Tail-F 2005-10-28.log: view files being modified by other processes
PS-
PS -?
PS-Ef | grep natserver Query Process
Killall-9 p2pserver kill Process
Kill-9 6499 end the process with ID 6499

Iii. Environment Variables
Env view environment variables
Locale view localization settings
Locale is stored in/usr/lib/locale.
Export lang = zh_cn: set local variables
Export lang = set this variable to null
Uname-A: View information about the operating system and CPU
Top view CPU and memory usage of processes
The/etc/profile environment variable file can be set to $ {ace_root}

Iv. Compilation and debugging
VI makefile
Make Compilation
./Kill. Sh script for restarting the program
CTRL + C ended

<Debugging>
GDB./reportserver
B Main breakpoint
B creportserver: SVC
B 100 place a breakpoint on the second line of the current file
D. Delete all breakpoints.
Start
T displays the current thread status
P argc variable display
S: Enter function execution
N jump to the next line for execution
C jump to the next breakpoint for execution
Quit exit debugging

Ulimit-C Unlimited
Check the debugging information of GDB tcastchanroot core.6200.
Where module structure

Chmod A + x tcastchanroot Modify file attributes to run
./Runnewtcast. Sh & background running script
Nohup./tcastchanroot> runlog does not suspend the execution program, and the output is directed to the file runlog

 

 

V. Text operation commands
Tail-F 2005-10-31.log: View logs
Open a text file in CAT/proc/cpuinfo read-only mode

VI command
I from command mode to insert mode
ESC from insert mode to command mode
Command mode scrolling: Ctrl + F
YY copy the current row
P Paste
Dd deletes the current row
: WQ

Vi. File Operations
Touch XXX creates a new file
Mkdir XXX creates a new directory
MV jspwiki-2.2.33-bin.zip.../usr/tomcat55/webapps/
CP jspwiki. War ../jspwiki. War
Rm-RF WEB-INF force remove folders with content
CP-A./star_zh_cn.../tomwiki/templates/start_zh_cn copy the entire directory
CP-A./star_zh_cn ../.../../tomwiki/templates/start_zh_cn copy, use absolute path

7. Decompression command:
Unzip jspwiki.zip
Unzip-D ../jspwiki jspwiki.zip
Unrar x udt2.rar

8. run commands in the background
When starting a program, let it immediately enter the background Running Mode
After reading the previous bash introduction, we should understand the usage of Ctrl + z/BG/FG. Some programs work very time-consuming. Add an & symbol next to it, such as "updatedb &" and "Netscape. In this case

Shell will be released for other jobs. Note that the parent process of the program is still the shell. If you exit the shell, these programs will also be killed. We recommend that you run the jobs command to view background jobs before exiting shell.

Use the nohup (do not suspend) command
If you want to execute a process after you exit the system, you can use the nohup command, for example:
% Nohup tar-CF/dev/tape/home &
If you log on again after logging out, run the "Ps" command to check that the process is still running. Note: To run the command in the background, nohup must be used together with & operation. Some software can handle sighup messages by themselves

No., such as wget, no need to use nohup for them.
You can also use nohup to implement PPP callback: dial up first, and then execute a self-made script with nohup, such as "sleep 60; PPP-start-script. Finally, log out and stop the call.

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.