LinuxÖ®VIÃüÁîÏê½â
¹¦ÄÜ×îÇ¿Ôڵıà¼Æ÷——vi
¹¦ÄÜ×îÇ¿Ôڵıà¼Æ÷——vi
viÊÇËùÓÐUNIXϵͳ¶¼»áÌṩµÄÆÁÄ»±à¼Æ÷£¬ËüÌṩÁËÒ»¸öÊÓ´°É豸£¬Í¨¹ýËü¿ÉÒÔ±à¼Îļþ¡£µ±È»£¬¶ÔUNIXϵͳÂÔÓÐËùÖªµÄÈË£¬
»ò¶à»òÉÙ¶¼¾õµÃvi³¬¼¶ÄÑÓ㬵«viÊÇ×î»ù±¾µÄ±à¼Æ÷£¬ËùÒÔÏ£Íû¶ÁÕßÄܺúðÑËüѧÆðÀ´£¬ÒÔºóÔÚUNIXÊÀ½çÀï±Ø½«³©ÐÐÎÞ×è¡¢
ÓÎÈÐÓÐÓ࣬ÒòΪÆäËû¼¸ÖÖÎı¾´¦ÀíÆ÷²¢·ÇUNIX±ê×¼Å䱸¡£Ëµ²»¶¨±ðÈ˵ÄLinux»úÆ÷û°²×°joe»òpico£¬Èç¹ûÄú²»»ávi£¬ÄÇÄú¿ÉÄܾÍûéüÁË¡£
viµÄ»ù±¾¸ÅÄî
»ù±¾ÉÏvi¿É·ÖΪÈýÖÖ²Ù×÷״̬£¬·Ö±ðÊÇÃüÁîģʽ£¨Command mode£©¡¢²åÈëģʽ£¨Insert mode£©ºÍµ×ÏßÃüÁîģʽ£¨Last line mode£©£¬
¸÷ģʽµÄ¹¦ÄÜÇø·ÖÈçÏ£º
1£® Comand mode£º¿ØÖÆÆÁÄ»¹â±êµÄÒƶ¯£¬×Ö·û»ò¹â±êµÄɾ³ý£¬Òƶ¯¸´ÖÆijÇø¶Î¼°½øÈëInsert modeÏ£¬»òÕßµ½Last line mode¡£
2£® Insert mode£ºÎ¨ÓÐÔÚInsert modeÏ£¬²Å¿É×öÎÄ×ÖÊý¾ÝÊäÈ룬°´EscµÈ¿É»Øµ½Comand mode¡£
3£® Last line mode£º½«´¢´æÎļþ»òÀ뿪±à¼Æ÷£¬Ò²¿ÉÉèÖñ༻·¾³£¬ÈçÑ°ÕÒ×Ö·û´®¡¢ÁгöÐкŵȡ£
²»¹ý¿ÉÒÔ°Ñvi¼ò»¯³ÉÁ½¸öģʽ£¬¼´Êǽ«Last line modeÒ²ËãÈëCommand mode,°Ñvi·Ö³ÉCommand ºÍInsert mode¡£
viµÄ»ù±¾²Ù×÷
?½øÈëvi
ÔÚϵͳÌáʾ·ûºÅÊäÈëvi¼°ÎļþÃû³Æºó£¬¼´¿É½øÈëviÈ«ÆÁÄ»±à¼»Ã棺
$ vi testfile
ÓÐÒ»µãÒªÌرð×¢Ò⣬¾ÍÊÇÄú½øÈëviÖ®ºóÊÇ´¦ÓÚ“Command mode”Ï£¬ÄúÒªÇл»µ½Insert mode²ÅÄÜÊäÈëÎÄ×Ö¡£
³õ´ÎÓÃviµÄÓû§¶¼»áÏëÏÈÓÃÉÏÏÂ×óÓÒ¼üÒƶ¯¹â±ê£¬½á¹ûµçÄÔÒ»Ö±½Ð£¬°Ñ×Ô¼ºÆø¸ö°ëËÀ£¬ËùÒÔ½øÈëviºó£¬ÏȲ»ÒªÂÒ¶¯£¬
ת»»ÈëInsertºóÔÙ˵¡£?Çл»ÖÁInsert mode±à¼ÎļþÔÚCommand modeÏ°´‘i’¡¢‘a’»ò‘o’Èý¼ü¾Í¿É½øÈëInsert mode¡£
ÕâʱºòÄú¾Í¿ÉÒÔ¿ªÊ¼ÊäÈëÎÄ×ÖÁË¡£
i: ²åÈ룬´ÓÄ¿Ç°¹â±êËùÔÚÖ®´¦²åÈëËùÊäÈëµÄÎÄ×Ö¡£
a: Ôö¼Ó£¬Ä¿Ç°¹â±êËùÔÚµÄÏÂÒ»¸ö×Ö¿ªÊ¼ÊäÈëÎÄ×Ö¡£
o: ²åÈëеÄÒ»ÐУ¬´ÓÐÐÊ׿ªÊ¼ÊäÈëÎÄ×Ö¡£
?InsertµÄÇл»→Command mode£¬°´Esc¼ü
ÄúÄ¿Ç°´¦ÓÚInsert mode£¬Äú¾ÍÖ»ÄÜÒ»Ö±´ò×Ö¡£¼ÙÈçÄú·¢ÏÖ´ò´í×ÖÁË£¬ÏëÓùâ±ê¼üÍù»ØÒƶ¯£¬½«¸Ã×Öɾ³ý£¬
¾ÍÒª°´ESC¼üת»»»ØCommand mode£¬ÔÙɾ³ýÎÄ×Ö¡£
?À뿪vi¼°´æÎļþ
ÔÚCommand modeÏ£¬¿É°´Ã°ºÅ“£º”¼üÈëÈëLast line mode£¬ÀýÈ磺
:w filename (ÊäÈë“w filename”£¬½«ÎÄÕ´æÈëÖ¸¶¨µÄÎļþÃûfilename)
:wq (ÊäÈë“wq”£¬ÒòΪ½øÈë֮ʱÒѾָ¶¨ÎļþÃût
Ïà¹ØÎĵµ£º
³ÌÐò12£ºÀàËÆjava ÀïÃæµÄswitch case
[root@localhost scripts]# cat sh12.sh
read -p "input comand:" command
case $command in
"fix")
echo "fix system"
;;
"fuck")
echo "fuck you"
;;
*)
echo "what a stupid man!ex>$0 some word"
......
ÔÚʵÏÖÇý¶¯³ÌÐòµÄmmapº¯Êýʱ£¬Òª×¢ÒâÓ³ÉäµØÖ·µÄת»»ÎÊÌ⣬¼û´úÂë¡£
¶¨ÒåÒ»¸öÉ豸½á¹¹Ì壺
struct leedriver
{
struct cdev cdev;
unsigned char mem[MEMSIZE];
};
ÕâÀïÃæÕâ¸öMEMSIZE£¬×îС¶¼ÒªÊÇ4096£¬ÒòΪÄÚ´æÓ³ÉäÊÇÒÔҳΪµ¥Î»µÄ¡£
ÔÚʵÏÖsimple_remap_mmapº¯Êýʱ£¬´úÂëÈçÏÂ
static int simple_remap_mmap(stru ......
Ò». ÖÕÖ¹½ø³ÌµÄ¹¤¾ß kill ¡¢killall¡¢pkill¡¢xkill
ÖÕÖ¹Ò»¸ö½ø³Ì»òÖÕÖ¹Ò»¸öÕýÔÚÔËÐеijÌÐò£¬Ò»°ãÊÇͨ¹ý kill ¡¢killall¡¢pkill¡¢xkill µÈ½øÐС£±ÈÈçÒ»¸ö³ÌÐòÒѾËÀµô£¬µ«ÓÖ²»ÄÜÍ˳ö£¬Õâʱ¾ÍÓ¦¸Ã¿¼ÂÇÓ¦ÓÃÕâЩ¹¤¾ß¡£
ÁíÍâÓ¦Óõij¡ºÏ¾ÍÊÇÔÚ·þÎñÆ÷¹ÜÀíÖУ¬ÔÚ²»Éæ¼°Êý¾Ý¿â·þÎñÆ÷³ÌÐòµÄ¸¸½ø³ÌµÄÍ£Ö¹ÔËÐУ¬Ò²¿ÉÒÔÓÃÕâЩ¹¤¾ßÀ´Ö ......
1¡¢Ö±½ÓÓÃexportÃüÁ
#export PATH=$PATH:×Ô¶¨Òå·¾¶
²é¿´ÊÇ·ñÒѾÉèºÃ£¬¿ÉÓÃÃüÁîexport²é¿´£º
[root@localhost bin]# export
PATH=$PATH:×Ô¶¨Òå·¾¶
2¡¢ÐÞ¸ÄprofileÎļþ£º
#vi /etc/profile
ÔÚÀïÃæ¼ÓÈë:
export PATH="$PATH:/opt/au1200_rm/build_tools/bin"
3. ÐÞ¸Ä.bashrcÎļþ£º
# vi /root/. ......