ÌáÉýÄãµÄÏÂÁîÐÐÊÖÒÕ£ºBash ºÍ Linux ·ûºÅÓëÏÂÁîµÄÍêÕûÖ¸ÄÏ
±¾Ö¸ÄϽ«Ïòµ¼Äúȥ̽Ë÷linuxºÍbash·ûºÅÓëÏÂÁîµÄÁÉÀ«ÌìÏ¡£ÎÒÃǽ«ÁýÕÖÖÖÖÖÖ÷Ì⣬ºÃ±ÈÎļþϵͳµ¼º½¡¢Îı¾´¦Àí¡¢ÍøÂ硢ϵͳÖÎÀíµÈ£¬²¢ÎªÃ¿¸öÏÂÁîÌṩÏÖʵʾÀý¡£ÎÞÂÛÄãÊÇÂÄÀú¸»ºñµÄlinuxÓû§ÕվɸոÕÈëÃÅ£¬±¾Ö¸Ä϶¼ÄÜ×ÊÖúÄãÌáÉýÏÂÁîÐÐÊÖÒÕ£¬ÔÚÒ»Ñùƽ³£ÊÂÇéÖбäµÃÔ½·¢¸ßЧ¡£ÒÔÊÇ·¿ªÄãµÄÖնˣ¬ÈÃÎÒÃÇ×îÏÈ°É£¡
Öض¨Ïò
Bash ×î»ù±¾µ«×îÇ¿Ê¢µÄ¹¦Ð§Ö®Ò»ÊÇÄܹ»Öض¨ÏòÏÂÁîµÄÊäÈëºÍÊä³ö¡£ÒÔÏÂÊÇһЩ¿ÉÓÃÓÚÖض¨ÏòµÄ·ûºÅ£º
>£º½«ÏÂÁîµÄÊä³öÖض¨Ïòµ½Îļþ£¬ÈôÊÇÎļþÒѱ£´æÔòÁýÕÖÆäÄÚÈÝ¡£ÀýÈ磬ls > linuxmi.txt½«ÏÂÁîµÄÊä³öдÈëlsÃûΪlinuxmi.txt.
>>£º½«ÏÂÁîµÄÊä³öÖض¨Ïòµ½Îļþ£¬ÈôÊÇÎļþÒѱ£´æ£¬Ôò½«Æ丽¼Óµ½Îļþĩβ¡£ÀýÈ磬echo “Hello, world!www.linuxmi.com” >> linuxmi.txt½«¸½¼Ó×Ö·û´®¡°Hello, world!www.linuxmi.com¡± µ½Îļþĩβ¡£
2>£ºÓÃÓÚ½«ÏÂÁîµÄ¹ýʧÊä³öÖض¨Ïòµ½Îļþ¡£
2>>£ºÓÃÓÚ½«ÏÂÁîµÄ¹ýʧÊä³ö¸½¼Óµ½Îļþ¡£
&>£ºÓÃÓÚ½«ÏÂÁîµÄÊä³öºÍ¹ýʧÊä³ö¶¼Öض¨Ïòµ½Îļþ¡£
&>>£ºÓÃÓÚ½«ÏÂÁîµÄÊä³öºÍ¹ýʧÊä³ö¸½¼Óµ½Îļþ¡£
¹ÜµÀ
¿ÉÒÔʹÓùܵÀ½«¶à¸öÏÂÁî´®ÁªÔÚÒ»Æð£¬Ê¹ÆäÖÐÒ»¸öÏÂÁîµÄÊä³ö³ÉΪÁíÒ»¸öÏÂÁîµÄÊäÈë¡£¹ÜµÀµÄ·ûºÅÊÇ|¡£ÒÔÏÂÊÇÒ»¸öÀý×Ó£º
ls -l | grep "linuxmi"
µÇ¼ºó¸´ÖÆ
´ËÏÂÁîÒÔ³¤ÃûÌà ( ) ÁгöÄ¿½ñĿ¼µÄÄÚÈÝls -l£¬È»ºó½«Êä³öת´ï¸øgrepÏÂÁÏÂÁîÔÚÊä³öÖÐËÑË÷×Ö·û´®¡°linuxmi¡±¡£
tee£ºÓÃÓÚ²ð·ÖÏÂÁîµÄÊä³ö²¢½«Æä·¢Ë͵½ÎļþºÍ±ê×¼Êä³ö¡£
ͨÅä·ûºÍͨÅä·û
Bash Ö§³Ö³ÆΪͨÅä·ûµÄÇ¿Ê¢¹¦Ð§£¬ËüÔÊÐíÄúʹÓÃͨÅä·ûÀ´Æ¥ÅäÎļþÃûģʽ¡£ÒÔÏÂÊÇ globbing ÖÐ×î³£ÓõÄһЩ·ûºÅ£º
*: Æ¥ÅäÎļþÃûÖÐí§ÒâÊýÄ¿µÄ×Ö·û¡£ÀýÈ磬ls *.txt½«ÁгöÄ¿½ñĿ¼ÖÐËùÓÐÒÔ.txt.
?: Æ¥ÅäÎļþÃûÖеÄÈκε¥¸ö×Ö·û¡£ÀýÈ磬ls file?.txt½«ÁгöÄ¿½ñĿ¼ÖÐËùÓÐÒÔ ¿ªÍ·fileÇÒºóÃæÖ»ÓÐÒ»¸ö×Ö·ûµÄÎļþ£¬ºó¸ú.txt.
[ ]: Æ¥ÅäÒ»×é×Ö·ûÖеÄÈκÎÒ»¸ö¡£ÀýÈ磬ls file[123].txt½«ÁгöÄ¿½ñĿ¼ÖÐÒÔ¡¢»ò¿ªÍ·fileºÍ×îºóµÄËùÓÐÎļþ£¬ºó¸ú.123.txt
³£Óñí´ï
grep£ºÓÃÓÚÔÚÎļþ»òÁ÷ÖÐËÑË÷ģʽ¡£
sed£ºÓÃÓÚ¶ÔÎļþ»òÁ÷Ö´ÐÐÎı¾×ª»»¡£
awk£ºÓÃÓÚͼÐÎɨÃèºÍ´¦Àí¡£
egrep£ºÓÃÓÚÀ©Õ¹µÄÕýÔò±í´ïʽ¡£
fgrep£ºÓÃÓÚÀο¿×Ö·û´®ÕýÔò±í´ïʽ¡£
regex£ºÊ¹ÓÃÌØÊâ×Ö·ûºÍÔËËã·ûÖ¸¶¨Îı¾Ä£Ê½µÄ·ûºÅ¡£
±äÁ¿À©Õ¹ºÍÇéÐαäÁ¿
$£ºÓÃÓÚÒýÓñäÁ¿µÄÖµ¡£
export£ºÓÃÓÚÔÚ Bash Öн¨Éè»òÐÞ¸ÄÇéÐαäÁ¿¡£
${}£ºÓÃÓÚ¾ÙÐбäÁ¿À©Õ¹¡£
$(())£ºÓÃÓÚ¾ÙÐÐËãÊõÕö¿ª¡£
env£ºÓÃÓÚÏÔʾĿ½ñÇéÐαäÁ¿¡£
echo£ºÓÃÓÚÏÔʾÇéÐαäÁ¿µÄÎı¾»òÖµ¡£
ͨÅä·ûºÍͨÅä·û
*: Æ¥ÅäÎļþÃûÖÐí§ÒâÊýÄ¿µÄ×Ö·û¡£
?: Æ¥ÅäÎļþÃûÖеÄÈκε¥¸ö×Ö·û¡£
·ñ¶¨
!£ºÓëÆäËûÏÂÁîÍŽáʹÓã¬Ö´ÐÐÈ¡·´¡£
ËãÊõÔËËã
+£ºËãÊõ±í´ïʽÖеļӷ¨ÔËËã·û¡£ÀýÈ磬echo $((2+3))½«Êä³ö5.
-£ºËãÊõ±í´ïʽÖеļõ·¨ÔËËã·û¡£ÀýÈ磬echo $((16-5))½«Êä³ö11.
*£ºËãÊõ±í´ïʽÖеij˷¨ÔËËã·û¡£ÀýÈ磬echo $((4*5))½«Êä³ö20.
/: ËãÊõ±í´ïʽÖеijý·¨ÔËËã·û¡£ÀýÈ磬echo $((20/2))½«Êä³ö10.
$((expression))£ºÓÃÓÚÔÚ Bash ÖÐÖ´ÐÐËãÊõÔËËã¡£ÀýÈ磬echo $((2 + 6))½«´òÓ¡Öµ 8¡£
expr£ºÓÃÓÚÖ´ÐÐËãÊõÔËËã¡£
½ÏÁ¿
==£ºÓÃÓÚ½ÏÁ¿Ìõ¼þ±í´ïʽÖÐÁ½¸öÖµÊÇ·ñÏàµÈ¡£ÀýÈ磬if [ “$name” == “linuxmi” ]; then echo “Hello, linuxmi!”; fi½«Êä³ö¡°Hello, linuxmi!¡± ÈôÊDZäÁ¿µÄnameֵΪ¡°linuxmi¡±¡£
!=£ºÓÃÓÚ½ÏÁ¿Ìõ¼þ±í´ïʽÖеÄÁ½¸öÖµÊÇ·ñ²»ÏàµÈ¡£ÀýÈ磬if [ “$name” != “linuxmi” ]; then echo “You’re not linuxmi!”; fi½«ÔÚ±äÁ¿nameµÄÖµ²»Îª¡°John¡±Êä³ö¡°You¡¯re not linuxmi!¡±¡£
Ìõ¼þÖ´ÐÐ
&&£ºÓÃÓÚ½öÔÚÇ°Ò»¸öÏÂÁîÀÖ³ÉÖ´ÐÐʱִÐкóÐøÏÂÁî¡£ÀýÈ磬command1 && command2 »á½öÔÚ command1 ÀÖ³ÉÖ´Ðкó²ÅÖ´ÐÐcommand2¡£
||£ºÓÃÓÚ½öÔÚÇ°Ò»¸öÏÂÁîʧ°ÜʱִÐкóÐøÏÂÁî¡£ÀýÈ磬command1 || command2»á½öÔÚ command1 ʧ°Üºó²ÅÖ´ÐÐ command2¡£
Ìõ¼þÓï¾ä
if£ºÓÃÓÚ¼ì²éÌõ¼þÊÇ·ñΪÕæ²¢ÏìÓ¦µØÖ´ÐÐÏÂÁî¡£ÀýÈ磬if [[ $foo == “bar” ]]; then echo “foo is bar”; fi½«¼ì²é±äÁ¿ÊÇ·ñfoo¼´ÊÇ¡°bar¡±£¬ÈôÊÇΪÕæÔò´òÓ¡¡°foo is bar¡±¡£
elifif£ºÈôÊÇÓï¾äÖеÄÏÈÇ°Ìõ¼þΪ¼Ù£¬ÔòÓÃÓÚ¼ì²éÆäËûÌõ¼þ¡£ÀýÈ磬if [[ $foo == “bar” ]]; then echo “foo is bar”; elif [[ $foo == “baz” ]]; then echo “foo is baz”; else echo “foo is something else”; fi½«¼ì²éÊÇ·ñfoo¼´ÊÇ¡°bar¡±²¢ÔÚΪÕæʱ´òÓ¡¡°foo is bar¡±£¬²»È»¼ì²éÊÇ·ñfoo¼´ÊÇ¡°baz¡±²¢ÔÚΪÕæʱ´òÓ¡¡°foo is baz¡±£¬×îºó´òÓ¡¡°foo is something else¡±ÈôÊÇÇ°ÃæÁ½¸öÌõ¼þ¶¼Îª¼Ù¡£
[[ ]]£ºÓÃÓÚÔÚ Bash ÖÐÖ´ÐÐÌõ¼þ²âÊÔ¡£
case£ºÓÃÓÚ½«±äÁ¿ÓëģʽÁбí¾ÙÐÐÆ¥Åä²¢ÏìÓ¦µØÖ´ÐÐÏÂÁî¡£ÀýÈ磺
case $fruit inapple)echo "It's an apple";;banana)echo "It's a banana";;*)echo "It's something else";;esac
µÇ¼ºó¸´ÖÆ
½«¼ì²é±äÁ¿µÄÖµfruit£¬ÈôÊǼ´ÊÇ¡°apple¡±Ôò´òÓ¡¡°It¡¯s an apple¡±£¬ÈôÊǼ´ÊÇ¡°banana¡±Ôò´òÓ¡¡°It¡¯s a banana¡±£¬¹ØÓÚÈκÎÆäËûÖµÔò´òÓ¡¡°It¡¯s something else¡±¡£
Ñ»·
for: ÓÃÓÚ½¨ÉèÒ»¸ö±éÀúÏîÄ¿ÁбíµÄÑ»·¡£ÀýÈ磬for fruit in apple banana orange; do echo $fruit; done½«ÔÚ²î±ðµÄÐÐÖÐÊä³ö¡°apple¡±¡¢¡°banana¡±ºÍ¡°orange¡±¡£
while£ºÓÃÓÚ½¨ÉèÒ»¸öÑ»·£¬Ö»ÒªÌõ¼þΪÕ棬¸ÃÑ»·¾Í»á¼ÌÐøÖ´ÐÐÏÂÁî¡£ÀýÈ磬while true; do echo “Hello”; sleep 1; done»áÖظ´Êä³ö¡°Hello¡±£¬Ö±µ½¾ç±¾±»ÖÐÖ¹¡£
until£ºÓÃÓÚÖ´ÐÐÏÂÁֱµ½Ìõ¼þΪÕæ¡£
º¯Êý
function£ºÓÃÓÚÔÚ Bash Öнç˵һ¸öº¯Êý¡£ÀýÈ磬function hello { echo “Hello, $1!”; }½ç˵һ¸öÃûΪhelloµÄº¯Êý£¬Ëü½ÓÊÜÒ»¸ö²ÎÊý²¢´òÓ¡¡°Hello,¡±ºó¸ú²ÎÊý¡£
$1, $2, µÈ£ºÓÃÓÚÖ¸´úת´ï¸øº¯ÊýµÄµÚÒ»¸ö¡¢µÚ¶þ¸ö¡¢µÚÈý¸öµÈ²ÎÊý¡£ÀýÈ磬ÔÚÉÏÃæ½ç˵µÄº¯ÊýÖÐhello£¬$1Ö¸µÄÊÇת´ï¸øº¯ÊýµÄµÚÒ»¸ö²ÎÊý¡£
Êý×é
[]£ºÓÃÓÚÔÚ Bash Öнç˵һ¸öÊý×é¡£ÀýÈ磬my_array=(apple banana orange)½ç˵һ¸öÃûΪmy_array¡°apple¡±¡¢¡°banana¡±ºÍ¡°orange¡±µÄÊý×é¡£
${array[@]}£ºÓÃÓÚÒýÓà Bash ÖÐÊý×éÖеÄËùÓÐÔªËØ¡£ÀýÈ磬echo ${my_array[@]}½«ÔÚÒ»ÐÐÖÐÊä³ö¡°apple banana orange¡±¡£
Àú³Ì¿ØÖƺÍÖÎÀí
&£ºÓÃÓÚÔÚºǫ́ÔËÐÐÏÂÁî¡£
ctrl-c£ºÓÃÓÚÖÕÖ¹ÕýÔÚÔËÐеÄÏÂÁî¡£
ctrl-z£ºÓÃÓÚÔÝÍ£ÕýÔÚÔËÐеÄÏÂÁî¡£
ps£ºÓÃÓÚÏÔʾÓйØÕýÔÚÔËÐеÄÀú³ÌµÄÐÅÏ¢¡£
kill£ºÓÃÓÚÖÕÖ¹ÕýÔÚÔËÐеÄÀú³Ì¡£
nohup£ºÓÃÓÚÔÚºǫ́ÔËÐÐÏÂÁ×ÝÈ»ÖÕ¶ËÒѹرա£
nice£ºÓÃÓÚÉèÖÃÀú³ÌµÄÓÅÏȼ¶¡£
renice£ºÓÃÓÚÐÞ¸ÄÒѾÔËÐеÄÀú³ÌµÄÓÅÏȼ¶¡£
Îļþϵͳ²Ù×÷
cp£ºÓÃÓÚ¸´ÖÆÎļþ¡£
mv£ºÓÃÓÚÒƶ¯»òÖØÃüÃûÎļþ¡£
rm£ºÓÃÓÚɾ³ýÎļþ¡£
mkdir£ºÓÃÓÚ½¨ÉèĿ¼¡£
rmdir£ºÓÃÓÚɾ³ýĿ¼¡£
ln£ºÓÃÓÚ½¨ÉèÎļþ»òĿ¼֮¼äµÄÁ´½Ó¡£
ÎļþºÍÎı¾²Ù×÷
head: ÓÃÓÚÏÔʾÎļþµÄÇ°¼¸ÐС£
tail£ºÓÃÓÚÏÔʾÎļþµÄ×îºó¼¸ÐС£
sort£ºÓÃÓÚ°´×Öĸ»òÊý×Ö¶ÔÎı¾ÐоÙÐÐÅÅÐò¡£
uniq£ºÓÃÓÚɾ³ýÖظ´µÄÎı¾ÐС£
cut£ºÓÃÓÚ´ÓÎı¾ÐÐÖÐÌáÈ¡Ìض¨µÄÁлò×ֶΡ£
paste£ºÓÃÓںϲ¢À´×Ô¶à¸öÎļþµÄÐС£
ȨÏÞ
chmod£ºÓÃÓÚ¸ü¸ÄÎļþºÍĿ¼µÄȨÏÞ¡£
chown£ºÓÃÓÚ¸ü¸ÄÎļþ»òĿ¼µÄËùÓÐÕß¡£
chgrp£ºÓÃÓÚ¸ü¸ÄÎļþ»òĿ¼µÄ×é¡£
umask£ºÓÃÓÚÉèÖÃн¨ÎļþºÍĿ¼µÄĬÈÏȨÏÞ¡£
×Ö·û´®²Ù×÷¡¢ËÑË÷ºÍ½ÏÁ¿
cut£ºÓÃÓÚ´ÓÎļþ»òÁ÷ÖÐÌáÈ¡Ìض¨ÁС£
tr£ºÓÃÓÚ·Òë»òɾ³ý×Ö·û¡£
sort£ºÓÃÓÚ¶ÔÎı¾ÐоÙÐÐÅÅÐò¡£
uniq£ºÓÃÓÚ´ÓÎļþ»òÁ÷ÖÐɾ³ýÖظ´ÐС£
grep£ºÓÃÓÚÔÚÎļþ»òÁ÷ÖÐËÑË÷ģʽ¡£
sed£ºÓÃÓÚ¶ÔÎļþ»òÁ÷Ö´ÐÐÎı¾×ª»»¡£
awk£ºÓÃÓÚͼÐÎɨÃèºÍ´¦Àí¡£
diff: ÓÃÓÚÖðÐнÏÁ¿Á½¸öÎļþ¡£
cmp£ºÓÃÓÚÖð×Ö½Ú½ÏÁ¿Á½¸öÎļþ¡£
ÍøÂç
ping£ºÓÃÓÚ²âÊÔÓëÍøÂçÖ÷»úµÄÅþÁ¬¡£
curl£ºÓÃÓÚÏòЧÀÍÆ÷´«ÊäÊý¾Ý»ò´ÓЧÀÍÆ÷´«ÊäÊý¾Ý¡£
wget£ºÓÃÓÚ´Ó»¥ÁªÍøÏÂÔØÎļþ¡£
ssh£ºÓÃÓÚÇå¾²µØÅþÁ¬µ½Ô¶³ÌÅÌËã»ú¡£
nslookup£ºÓÃÓÚÅÌÎÊ DNS ЧÀÍÆ÷ÒÔ½«Ö÷»úÃûÆÊÎöΪ IP µØµã¡£
ifconfig£ºÓÃÓÚÏÔʾºÍÉèÖÃÍøÂç½Ó¿Ú¡£
netstat£ºÓÃÓÚÏÔʾÍøÂçͳ¼ÆÐÅÏ¢ºÍÔ˶¯ÅþÁ¬Êý¡£
SSH ºÍ¼ÓÃÜ
ssh-keygen£ºÓÃÓÚÌìÉúºÍÖÎÀíÓÃÓÚÇå¾²Ô¶³Ì»á¼ûµÄ SSH ÃÜÔ¿¡£
scp£ºÓÃÓÚͨ¹ý SSH ÅþÁ¬ÔÚϵͳ֮¼äÇå¾²µØ´«ÊäÎļþ¡£
openssl£ºÓÃÓÚ¼ÓÃܹ¦Ð§£¬ÀýÈçÌìÉúºÍÖÎÀí SSL/TLS Ö¤Êé¡¢¼ÓÃÜÏ¢ÕùÃÜ¡£
gpg£ºÓÃÓÚ¼ÓÃÜ¡¢½âÃܺÍÊý×ÖÊðÃûÑéÖ¤¡£
ϵͳÐÅÏ¢¡¢Î¬»¤ºÍÖÎÀí
sudo£ºÓÃÓÚÔËÐоßÓÐÌáÉýȨÏÞµÄÏÂÁî¡£
su£ºÓÃÓÚÇл»µ½²î±ðµÄÓû§ÕÊ»§¡£
systemctl£ºÓÃÓÚÖÎÀí»ùÓÚ systemd µÄ Linux ¿¯ÐаæÖеÄϵͳЧÀÍ¡£
uptime£ºÓÃÓÚÏÔʾϵͳÔËÐÐÁ˶೤ʱ¼ä¡£
journalctl£ºÓÃÓÚÉó²éϵͳÈÕÖ¾¡£
fdisk£ºÓÃÓÚ½¨ÉèºÍ²Ù×÷´ÅÅÌ·ÖÇø¡£
mount£ºÓÃÓÚÔÚϵͳÉϹÒÔØÎļþϵͳ¡£
top£ºÓÃÓÚÏÔʾϵͳ×ÊԴʹÓÃÇéÐΡ£
htoptop£ºÌṩʵʱϵͳ¼à¿ØºÍ×ÊԴʹÓÃÐÅÏ¢µÄ¸ü¸ß¼¶°æ±¾¡£
ps£ºÓÃÓÚÏÔʾÓйØÕýÔÚÔËÐеÄÀú³ÌµÄÐÅÏ¢¡£
df£ºÓÃÓÚÏÔʾ´ÅÅÌ¿Õ¼äʹÓÃÇéÐΡ£
du£ºÓÃÓÚÏÔʾÎļþ»òĿ¼µÄ¾Þϸ¡£
apt-get£ºÓÃÓÚ×°Öá¢É¾³ýºÍ¸üÐÂÈí¼þ°üµÄ°ü¹ÜÀí¹¤¾ß¡£
dpkg£ºÓÃÓÚ×°ÖúÍÖÎÀíÈí¼þ°üµÄ°ü¹ÜÀí¹¤¾ß¡£
shutdown£ºÓÃÓڹرջòÖØÆôϵͳ¡£
free£ºÓÃÓÚÏÔʾϵͳÄÚ´æʹÓÃÇéÐΡ£
uname£ºÓÃÓÚÏÔʾÄں˰汾¡¢Ö÷»úÃûµÈϵͳÐÅÏ¢¡£
lscpu£ºÓÃÓÚÏÔʾCPUÐÅÏ¢¡£
lsusb£ºÓÃÓÚÏÔʾϽµµÍ¬½ÓµÄUSB×°±¸¡£
nmon£ºÓÃÓÚÏÔʾÏêϸµÄϵͳÐÔÄÜÐÅÏ¢£¬°üÀ¨CPU¡¢ÄÚ´æ¡¢´ÅÅÌI/OºÍÍøÂçʹÓÃÇéÐΡ£
sar£ºÓÃÓÚÍøÂçºÍ±¨¸æÒ»¶Îʱ¼äÄÚµÄϵͳÐÔÄÜÊý¾Ý¡£
lshw£ºÓÃÓÚÏÔʾϵͳӲ¼þÐÅÏ¢¡£
dmidecode£ºÓÃÓÚÏÔʾϵͳµÄBIOSºÍÓ²¼þÐÅÏ¢¡£
lsblk£ºÓÃÓÚÏÔʾϵͳÖпé×°±¸£¨ÈçÓ²ÅÌ£©µÄÐÅÏ¢¡£
lspci£ºÓÃÓÚÏÔʾϽµµÍ¬½ÓµÄPCI×°±¸ÐÅÏ¢¡£
lsusb£ºÓÃÓÚÏÔʾϽµµÍ¬½ÓµÄUSB×°±¸ÐÅÏ¢¡£
Óû§ÊäÈë
read£ºÓÃÓÚ´ÓÏÂÁîÐжÁÈ¡Óû§ÊäÈë¡£
select£ºÓÃÓÚÏòÓû§ÏÔʾѡÏî²Ëµ¥¡£
ÏÂÁîÐбà¼
ctrl-a£ºÓÃÓÚ½«¹â±êÒƶ¯µ½ÐÐÊס£
ctrl-e£ºÓÃÓÚ½«¹â±êÒƶ¯µ½ÐÐβ¡£
ctrl-k£ºÓÃÓÚɾ³ý´Ó¹â±êλÖõ½ÐÐβµÄÎı¾¡£
ctrl-u£ºÓÃÓÚɾ³ý´Ó¹â±êλÖõ½ÐÐÊ×µÄÎı¾¡£
Îı¾±à¼
nano£ºÒ»¸ö¼òÆÓµÄÏÂÁîÐÐÎı¾±à¼Æ÷¡£
vi»òvim£º¾ßÓÐÐí¶à¹¦Ð§µÄ¸ü¸ß¼¶µÄÎı¾±à¼Æ÷¡£
cat£ºÓÃÓÚÔÚÖÕ¶ËÉÏÏÔʾÎļþµÄÄÚÈÝ¡£
head: ÓÃÓÚÏÔʾÎļþµÄÇ°¼¸ÐС£
tail£ºÓÃÓÚÏÔʾÎļþµÄ×îºó¼¸ÐС£
×÷Òµ¿ØÖÆ
jobs£ºÓÃÓÚÏÔʾºǫ́×÷ÒµÁÐ±í¡£
fg£ºÓÃÓÚ½«ºǫ́×÷Òµ´øµ½Ç°Ì¨¡£
bg£ºÓÃÓÚ½«ÔÝÍ£»ò×èÖ¹µÄ×÷ÒµÒÆÖÁºǫ́¡£
kill£ºÓÃÓÚÖÕÖ¹ÕýÔÚÔËÐеÄÀú³Ì¡£
Óû§ºÍ×éÖÎÀí
useradd£ºÓÃÓÚ½¨ÉèеÄÓû§ÕÊ»§¡£
usermod£ºÓÃÓÚÐÞ¸ÄÏÖÓÐÓû§ÕÊ»§¡£
userdel£ºÓÃÓÚɾ³ýÓû§ÕÊ»§¡£
groupadd£ºÓÃÓÚ½¨ÉèеÄÓû§×é¡£
groupmod£ºÓÃÓÚÐÞ¸ÄÒÑÓеÄÓû§×é¡£
groupdel£ºÓÃÓÚɾ³ýÓû§×é¡£
passwd£ºÓÃÓÚ¸ü¸ÄÓû§ÃÜÂë¡£
µ÷ÊԺ͹ÊÕÏɨ³ý
strace£ºÓÃÓÚ¸ú×ÙÀú³Ì·¢³öµÄϵͳŲÓúÍÐźš£
ltrace£ºÓÃÓÚ¸ú×ÙÀú³Ì¾ÙÐеĿâŲÓá£
gdb: Ò»¸öÇ¿Ê¢µÄµ÷ÊÔÆ÷£¬ÓÃÓÚµ÷ÊÔ C ºÍ C++ ³ÌÐò¡£
tcpdump£ºÓÃÓÚ²¶»ñºÍÆÊÎöÍøÂçÁ÷Á¿¡£
wireshark: ÓÃÓÚÆÊÎöÍøÂçÁ÷Á¿µÄ»ùÓÚ GUI µÄ¹¤¾ß¡£ellaneous
echo£ºÓÃÓÚÔÚÖÕ¶ËÉÏÏÔʾÐÂÎÅ¡£
printf£ºÓÃÓÚÃûÌû¯ºÍÏÔʾÊý¾Ý¡£
date£ºÓÃÓÚÏÔʾ»òÉèÖÃϵͳÈÕÆÚºÍʱ¼ä¡£
tar£ºÓÃÓÚ½¨Éè»òÌáȡѹËõµµ°¸¡£
ÖÖÖÖ¸÷ÑùµÄ
cal£ºÓÃÓÚÏÔʾÈÕÀú¡£
date£ºÓÃÓÚÏÔʾ»òÐÞ¸ÄϵͳÈÕÆÚºÍʱ¼ä¡£
sleep£ºÓÃÓÚ½«¾ç±¾»òÏÂÁîµÄÖ´ÐÐÑÓ³ÙÖ¸¶¨µÄʱ¼äÁ¿¡£
tee£ºÓÃÓÚ½«Êä³öÖض¨Ïòµ½ÆÁÄ»ºÍÎļþ¡£
history£ºÓÃÓÚÏÔʾĿ½ñshell»á»°µÄÏÂÁîÀúÊ·¡£
echo£ºÓÃÓÚ½«Îı¾´òÓ¡µ½Öն˻òÊä³öµ½Îļþ¡£
Çë×¢ÖØ£¬±¾Ö¸ÄÏÖÐËùÊöµÄ·ûºÅ·ÖÀಢ·Ç¾ø¶Ô£¬¶øÊÇ»ùÓÚÒ»ÖÖ¿ÉÄܵķÖÀà·½·¨¡£Ä³Ð©·ûºÅ¿ÉÄÜÊÊÓÃÓÚ¶à¸öÖֱ𣬲¢ÇÒ¿ÉÄܱ£´æһЩÖصþ»òÖظ´¡£·ûºÅÁÐ±í²¢·ÇÍêÈ«Ï꾡£¬¿ÉÄÜÒòLinux¿¯ÐаæºÍ°æ±¾µÄ²î±ð¶øÓÐËù²î±ð¡£ÎÒÃÇÃãÀø¶ÁÕ߲ο¼ÆäϵͳÎĵµ»ñÈ¡¸ü¶àÐÅÏ¢¡£Õâ·ÝÖ¸ÄϵÄÄ¿µÄÊÇÌṩLinuxºÍBash±ê¼ÇºÍÏÂÁîµÄ×ۺϸÅÊö£¬µ«²¢·ÇȨÍþ×ÊÔ´¡£
ллÔĶÁÎÒÃǹØÓÚLinuxºÍBash·ûºÅºÍÏÂÁîµÄÖÜÈ«Ö¸ÄÏ¡£Ï£ÍûÄú·¢Ã÷±¾Ö¸Ä϶ÔÕÆÎÕÏÂÁîÐкÜÊÇÓÐ×ÊÖú¡£ÎªÁËʵʱÏàʶÓйØÔÚÒ»Ñùƽ³£ÊÂÇéÖÐʹÓÃÕâЩÏÂÁîµÄ×îм¼ÇÉ¡¢¼¼ÇɺÍ×î¼Ñʵ¼ù£¬ÇëÎñ±Øºã¾Ã¹Ø×¢LinuxÃÔwww.linuxmi.comÒÔ»ñȡδÀ´µÄÎÄÕ¡£ÎÒÃǽ«ÌṩÏêϸµÄʾÀýºÍʵÀý£¬ÒÔÐÖúÄú³ÉΪԽ·¢ÐÑÄ¿µÄLinuxÓû§ºÍÏÂÁîÐÐרԱ¡£
ÒÔÉϾÍÊÇÌáÉýÄãµÄÏÂÁîÐÐÊÖÒÕ£ºBash ºÍ Linux ·ûºÅÓëÏÂÁîµÄÍêÕûÖ¸ÄϵÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡