Ê·ÉÏ×îÅ£×îÈ«µÄLINUXÃüÁ
Unix Toolbox
This document is a collection of Unix/Linux/BSD commands and tasks which are useful for IT work or for advanced users. This is a practical guide with concise explanations, however the reader is supposed to know what s/he is doing.
Unix Toolbox revision 14.2
The latest version of this document can be found at http://cb.vu/unixtoolbox.xhtml. Replace .xhtml on the link with .pdf for the PDF version and with .book.pdf for the booklet version. On a duplex printer the booklet will create a small book ready to bind. This XHTML page can be converted into a nice PDF document with a CSS3 compliant application (see the script example). See also the about page.
Error reports and comments are most welcome - c@cb.vu Colin Barschel.
© Colin Barschel 2007-2009. Some rights reserved under Creative Commons.
System
Processes
File System
Network
SSH SCP
VPN with SSH
RSYNC
SUDO
Encrypt Files
Encrypt Partitions
SSL Certificates
CVS
SVN
Useful Commands
Install Software
Convert Media
Printing
Databases
Disk Quota
Shells
Scripting
Programming
Online Help
white black
System
Hardware | Statistics | Users | Limits | Runlevels | root password | Compile kernel | Repair grub
Running kernel and system information
# uname -a # Get the kernel version (and BSD version)
# lsb_release -a # Full release info of any LSB distribution
# cat /etc/SuSE-release # Get SuSE version
# cat /etc/debian_version # Get Debian version
Use /etc/DISTR-release with DISTR= lsb (Ubuntu), redhat, gentoo, mandrake, sun (Solaris), and so on. See also /etc/issue.
# uptime # Show how long the system has been running + load
# hostname # system's host name
# hostname -i # Display the IP address of the host. (Linux only)
# man hier # Description of the file system hierarchy
# l
Ïà¹ØÎĵµ£º
ShellµÄI/OÓï·¨ÄÑÒÔÀí½â£¬¸üÄÑÒÔÕýȷʹÓá£ShellµÄÊäÈëÊä³öÓï·¨ÓÐÁ½¸öÄÑµã£ºÖØ¶¨ÏòºÍÎļþÃèÊö·û¡£ÎÒÒÔǰ¶ÔShell I/OµÄÀí½âÒ²ÓдíÎó¡£×î½üÖØÐÂÕûÀí˼·£¬¾ö¶¨Ð´Ò»ÆªÎÄÕÂÀ´×ܽáI/OÖØ¶¨Ïò¡£
ÏȽéÉܼ¸¸ö»ù±¾¸ÅÄî:
1£©Îļþ(File)£ºÔÚUnix/LinuxÖУ¬ÎļþÀàÐÍÓÐÆ ......
±¾ÎĽâÊÍÁ½ÖÖ×îÁ÷ÐÐµÄ Linux® »ã±àÆ÷ —— GNU Assembler£¨GAS£©ºÍ Netwide
Assembler£¨NASM£© ——
Ö®¼äһЩ±È½ÏÖØÒªµÄÓï·¨²îÒìºÍÓïÒå²îÒ죬°üÀ¨»ù±¾Óï·¨¡¢±äÁ¿ºÍÄÚ´æ·ÃÎÊ¡¢ºê´¦Àí¡¢º¯ÊýºÍÍⲿÀý³Ì¡¢¶ÑÕ»´¦ÀíÒÔ¼°Öظ´Ö´ÐдúÂë¿éµÄ¼¼Êõ·½ÃæµÄ²îÒì¡£
ÓëÆäËûÓïÑÔ²»Í¬£¬»ã±àÓïÑÔ
ÒªÇ󿪷¢ÈËÔ±ÁË ......
¼ò¶øÑÔÖ®,²úÉú¶Î´íÎó¾ÍÊÇ·ÃÎÊÁË´íÎóµÄÄÚ´æ¶Î£¬Ò»°ãÊÇÄãûÓÐȨÏÞ£¬»òÕ߸ù±¾¾Í²»´æÔÚ¶ÔÓ¦µÄÎïÀíÄÚ´æ,ÓÈÆä³£¼ûµÄÊÇ·ÃÎÊ0µØÖ·.
Ò»°ãÀ´Ëµ,¶Î´íÎó¾ÍÊÇÖ¸·ÃÎʵÄÄڴ泬³öÁËϵͳËù¸øÕâ¸ö³ÌÐòµÄÄÚ´æ¿Õ¼ä£¬Í¨³£Õâ¸öÖµÊÇÓÉgdtrÀ´±£´æµÄ£¬ËûÊÇÒ»¸ö48λµÄ¼Ä´æÆ÷£¬ÆäÖеÄ32λÊDZ£´æÓÉËüÖ¸ÏòµÄgdt±í£¬ºó13λ±£´æÏàÓ¦ÓÚgdtµÄϱ꣬×îºó3λ°ü ......
1.linux ϵͳµ÷ÓõĻù±¾ÔÀí
linuxµÄϵͳµ÷ÓÃÐÎʽÓëPOSIX¼æÈÝ£¬Ò²ÊÇÒ»Ì×CÓïÑÔº¯ÊýÃûµÄ¼¯ºÏ¡£È»¶ø£¬linuxϵͳµ÷ÓõÄÄÚ²¿ÊµÏÖ·½Ê½È´ÓëDOCµÄINT 21HÏàËÆ£¬ËüÊǾ¹ýINT 0X80HÈíÖжϽøÈëºó£¬ÔÙ¸ù¾Ýϵͳµ÷ÓúŷÖÃűðÀàµØ·þÎñ¡£
´Óϵͳ·ÖÎöµÄ½Ç¶È£¬linuxµÄϵͳµ÷ÓÃÉæ¼°4¸ö·½ÃæµÄÎÊÌâ¡£
(1)Óëϵͳµ÷ÓÃÓÐ¹ØµÄ ......
/************************
cÓïÑÔ±àдµÄtcp socketͨÐŵÄserver¶Ë¡£
¿ÉÒÔ³ÖÐø¼àÌýmyprotÖ¸¶¨µÄ¶Ë¿Ú
´òÓ¡¶Ë¿Ú½ÓÊÕµ½µÄ×Ö·ûÁ÷
Í·ÎļþÒòΪ¼âÀ¨ºÅ±»×ªÒ壬ËùÒÔÓÃÁËÒýºÅ
************************/
#include "stdio.h"
#include "stdlib.h"
#include "errno.h"
#include "string.h& ......