ºìÁªLinuxÃÅ»§
Linux°ïÖú

LinuxLookupС¼¼ÇÉ

·¢²¼Ê±¼ä:2005-12-26 09:30:25À´Ô´:ºìÁª×÷Õß:°®µÄ±ßÔµ
1¡¢ÔÚ vi ÖÐÇÉÓøÐ̾ºÅÃüÁî
2¡¢Óà dd ÃüÁîת»»Êý¾Ý¸ñʽ
3¡¢¼ÆËãÒ»¸öÏîÄ¿ÖÐËùÓÐÎļþµÄƽ¾ùÐÐÊý

1¡¢ÔÚ vi ÖÐÇÉÓøÐ̾ºÅÃüÁî

ÎÒÃÇÖªµÀÔÚvi ÖиÐ̾ºÅÊÇÓÃÀ´Ö´ÐÐÍⲿ³ÌÐòµÄÊֶΡ£

ÀýÈç :!ls ¾ÍÊÇÁгöµ±Ç°Ä¿Â¼¡£

µ«ÊÇÈç¹ûÎÒÃÇÒª°Ñµ±Ç°Ä¿Â¼µÄÄÚÈݶÁÈëÕýÔڱ༭µÄÎļþÖУ¬Ôõô°ìÄØ£¿
Ò»¸ö±¿°ì·¨¾ÍÊDzÉÓÃ

:r file_name

À´¶ÁÈëÎļþ¡£

ÎÒÃǵÄÕâ¸ö¼¼ÇÉ£¬°ÑºóÃæµÄ file_name ¸Ä¶¯Ò»Ï£¬ÈÃÎÒÃÇ¿´¿´£º

:r !ps


ÄãÖªµÀÁË£¬ÎÒÃǰѵ±Ç°½ø³Ì¶ÁÈëÁËÕýÔڱ༭µÄÎļþ£º

PID TTY TIME CMD
1966 pts/2 00:00:00 bash
2276 pts/2 00:00:00 vi
2320 pts/2 00:00:00 bash
2328 pts/2 00:00:00 ps


Íƶø¹ãÖ®£¬ÎÒÃÇ¿ÉÒ԰ѵ±Ç°ÄÚÈÝдµ½¸Ð̾ºÅÃüÁ

:1,$w !spell

Õâ¸ö²Ù×÷°Ñµ±Ç°ÄÚÈÝË͵½ spell ÃüÁîÀ´¼ì²éƴдÁË¡£


2¡¢Óà dd ÃüÁîת»»Êý¾Ý¸ñʽ

Äã´ó¸ÅÖªµÀ dd ÃüÁîÊÇÓÃÀ´¿½±´Êý¾ÝµÄ¡£ÌرðÊÇÓÃÀ´ÖÆ×÷Æô¶¯ÅÌ¡£µ«ÊÇ dd Ò²ÄÜÓÃÓÚÊý¾Ýת»»¡£

ÔÚ "endian" ½á¹¹µÄϵͳÉÏ£¬µ¼³ö Ingres Êý¾Ý¿âµÄÄÚÈÝʱ£¬´úÂë»á·¢ÉúÆæ¹ÖµÄת»»£¬Ëü°Ñ£º¡°The cat in the hat¡±×ª±ä³ÉÁË ¡°hT eac tnit ehh ta¡±£¬°ÑÊý¾Ý»Ö¸´¹ýÀ´µÄ°ì·¨¾ÍÊDzÉÓà dd ÃüÁ

dd if=randys_bad_data of=marcs_good_data conv=swab


×îºó²¿·Ö "conv=swab" ¸æËß dd ²ÉÈ¡ "swap bytes" ·½Ê½×ª»»¡£

ͬÑùµÄ£¬Èç¹ûÒª°É EBCDIC ¸ñʽµÄÊý¾Ýת»»Îª ASCII ¸ñʽ¾Í¿ÉÒÔ²ÉÓÃÈçÏÂÃüÁ

dd if=ebcdic_file of=ascii_file conv=ascii


dd µÄ man °ïÖúÏÔʾ³öÓв»ÉÙÓÚ 10 ÖÖת»»£¬×Ðϸ¿´¿´£¬Ï´ÎÓöµ½Í¬ÑùÎÊÌâʱ£¬¾Í¿ÉÒÔÓà dd À´°ïæÁË¡£



3¡¢¼ÆËãÒ»¸öÏîÄ¿ÖÐËùÓÐÎļþµÄƽ¾ùÐÐÊý

¼ÙÉèÎÒÃǵÄÏîÄ¿Îļþ¶¼ÊÇ .c »òÕß .h Îļþ£¬¼ÆËãÄÇôËùÓÐÎļþµÄÐÐÊýÓ¦¸Ã²ÉÓãº

# cat *.[ch] | wc -l

Òª¼ÆËãƽ¾ùµÄ»°£¬Î޷ǾÍÊÇÕâЩÐÐÊý³ýÒÔÎļþÊýÄ¿£º

# ls -l *.[ch] | wc -l

ƽ¾ùÊý£º

# echo `cat *.[ch] | wc -l` / `ls -1 *.[ch] | wc -l` | bc
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ