×ðÁú¿­Ê±

Linux shell¾ç±¾±àдµÄÇå¾²ÐÔ£º×èÖ¹Çå¾²Îó²î

Linux shell¾ç±¾±àдµÄÇå¾²ÐÔ£º×èÖ¹Çå¾²Îó²î

СÐò£º

Ëæ×ÅLinux²Ù×÷ϵͳµÄÆÕ¼°ºÍÓ¦Óà £¬Linux shell¾ç±¾±à³Ì³ÉΪÁËÒ»ÖÖºÜÊÇÖ÷ÒªµÄÊÖÒÕ¡£È»¶ø £¬ÓÉÓÚshell¾ç±¾µÄÌØÕ÷ºÍʹÓ÷½·¨ £¬±àд²»Çå¾²µÄ¾ç±¾¿ÉÄܻᵼÖÂÇå¾²Îó²îµÄ·ºÆð¡£±¾ÎĽ«Ì½ÌÖÔõÑù±àдÇå¾²µÄshell¾ç±¾ £¬²¢Í¨¹ý´úÂëʾÀýÀ´ËµÃ÷ÔõÑù×èÖ¹³£¼ûµÄÇå¾²Îó²î¡£

Ò»¡¢×èֹʹÓÃÃ÷ÎÄÃÜÂë

ÔÚshell¾ç±¾ÖÐ £¬×èֹʹÓÃÃ÷ÎÄÃÜÂëÊÇÖÁ¹ØÖ÷ÒªµÄ¡£Ã÷ÎÄÃÜÂëµÄʹÓò»µ«ÈÝÒ×±»ËûÈË»ñÈ¡ £¬²¢ÇÒ»áÔöÌíÕË»§±»ºÚ¿Í¹¥»÷µÄΣº¦¡£Òò´Ë £¬ÎÒÃÇÓ¦¸ÃʹÓÃÇå¾²µÄ·½·¨À´´æ´¢ºÍת´ïÃÜÂë¡£

ÏÂÃæÊÇÒ»¸öʹÓÃÃ÷ÎÄÃÜÂëµÄ¹ýʧʾÀý£º

#!/bin/bash

password="mypassword"

µÇ¼ºó¸´ÖÆ

׼ȷµÄ·½·¨ÊÇʹÓÃÃÜÂë¹þÏ£Öµ £¬ÀýÈçʹÓÃmd5sumÏÂÁî¶ÔÃÜÂë¾ÙÐйþÏ££º

#!/bin/bash

password=$(echo -n "mypassword" | md5sum | cut -d" " -f1)

µÇ¼ºó¸´ÖÆ

¶þ¡¢¹ýÂËÓû§ÊäÈë

µ±Óû§ÊäÈë×÷Ϊ¾ç±¾µÄ²ÎÊý»ò±äÁ¿Ê¹ÓÃʱ £¬ÐèÒª¾ÙÐÐÊäÈë¹ýÂË¡£ÈôÊÇûÓжÔÓû§ÊäÈë¾ÙÐйýÂ˵Ļ° £¬Óû§¿ÉÄÜ»áÊäÈë¶ñÒâÄÚÈÝ´Ó¶øµ¼Ö¾籾ÔËÐÐÒì³£»òÕß·­¿ªÏµÍ³Çå¾²Îó²î¡£

ÏÂÃæÊÇÒ»¸öûÓйýÂËÓû§ÊäÈëµÄ¹ýʧʾÀý£º

#!/bin/bash

file=$1

cat $file

µÇ¼ºó¸´ÖÆ

׼ȷµÄ·½·¨ÊÇʹÓÃreadÏÂÁî¶ÁÈ¡Óû§ÊäÈë £¬²¢¾ÙÐÐÊʵ±µÄÑéÖ¤ºÍ¹ýÂË£º

#!/bin/bash

read -p "ÇëÊäÈëÎļþÃû£º" file
file=$(echo "$file" | sed 's/[`~!@#$%^&*()<>"]//g')

cat "$file"

µÇ¼ºó¸´ÖÆ

Èý¡¢ÏÞÖƾ籾µÄÖ´ÐÐȨÏÞ

ΪÁËÔöÌíϵͳµÄÇå¾²ÐÔ £¬ÎÒÃÇÓ¦¸ÃÏÞÖƾ籾µÄÖ´ÐÐȨÏÞ¡£½öµ±ÓÐÐëҪʱ²Å¸øÓëÖ´ÐÐȨÏÞ £¬²¢È·±£¾ç±¾½ö¶ÔËùÐèµÄÎļþºÍĿ¼¾ÙÐжÁд²Ù×÷¡£

ÏÂÃæÊÇÒ»¸öûÓÐÏÞÖƾ籾ִÐÐȨÏ޵ĹýʧʾÀý£º

#!/bin/bash

cat /etc/passwd

µÇ¼ºó¸´ÖÆ

׼ȷµÄ·½·¨ÊÇʹÓÃchmodÏÂÁîÀ´ÏÞÖƾ籾µÄÖ´ÐÐȨÏÞ£º

#!/bin/bash

if [ $(id -u) -eq 0 ]; then
    cat /etc/passwd
else
    echo "ÐèÒªrootȨÏ޲ŻªÖ´Ðиþ籾"
fi

µÇ¼ºó¸´ÖÆ

ËÄ¡¢×èֹϵͳÃô¸ÐÐÅÏ¢µÄÊä³ö

µ±¾ç±¾ÔÚÖ´ÐÐÀú³ÌÖÐ £¬Ò»Ð©Ãô¸ÐµÄϵͳÐÅÏ¢£¨ÀýÈçµÇ¼ÕË»§¡¢ÏµÍ³ÉèÖã©¿ÉÄܻᱻÊä³öµ½ÆÁÄ»ÉÏ £¬²¢±»ËûÈË»ñÈ¡¡£ÎªÁ˱£»¤ÏµÍ³µÄÇå¾² £¬ÎÒÃÇÓ¦¸Ã×èÖ¹Êä³öÕâЩÃô¸ÐÐÅÏ¢¡£

ÏÂÃæÊÇÒ»¸ö»áÊä³öÃô¸ÐÐÅÏ¢µÄ¹ýʧʾÀý£º

#!/bin/bash

echo "Ä¿½ñµÇ¼ÕË»§£º$(whoami)"

µÇ¼ºó¸´ÖÆ

׼ȷµÄ·½·¨ÊÇʹÓÃ/dev/null½«Ãô¸ÐÐÅÏ¢Öض¨Ïòµ½¿Õ×°±¸£º

#!/bin/bash

echo "Ä¿½ñµÇ¼ÕË»§£º$(whoami)" > /dev/null

µÇ¼ºó¸´ÖÆ

Î塢ʵʱ¸üкͱ¸·Ý¾ç±¾

¼á³Ö¾ç±¾µÄ×îаæÊÇ×èÖ¹Çå¾²Îó²îµÄÖ÷Òª°ì·¨¡£Ëæ×Åʱ¼äµÄÍÆÒÆ £¬¾ç±¾ÖпÉÄܻᱣ´æһЩÒÑÖªµÄÇå¾²Îó²î £¬²¢ÇÒËæ×ÅÊÖÒÕµÄÇ°½øºÍÇå¾²²¹¶¡µÄÐû²¼ £¬ÕâЩÎó²î¿ÉÄÜ»áÖð½¥Ì»Â¶³öÀ´¡£Òò´Ë £¬ÊµÊ±¸üкͱ¸·Ý¾ç±¾ÊDZ£»¤ÏµÍ³Çå¾²µÄÖ÷Òª²½·¥¡£

½áÂÛ£º

ÔÚ±àдLinux shell¾ç±¾Ê± £¬ÎÒÃÇÓ¦¸ÃʼÖÕ¹Ø×¢Çå¾²ÐÔ¡£Í¨¹ý×èֹʹÓÃÃ÷ÎÄÃÜÂë¡¢¹ýÂËÓû§ÊäÈë¡¢ÏÞÖƾ籾ִÐÐȨÏÞ¡¢×èÖ¹Êä³öÃô¸ÐÐÅÏ¢ÒÔ¼°ÊµÊ±¸üкͱ¸·Ý¾ç±¾µÈ²½·¥ £¬ÎÒÃÇ¿ÉÒÔïÔÌ­Çå¾²Îó²îµÄΣº¦²¢Ìá¸ßϵͳµÄÇå¾²ÐÔ¡£

ÔÚÏÖʵµÄ¿ª·¢ÖÐ £¬ÎÒÃÇ»¹Ó¦¸ÃÇ×½ü¹ØעеÄÇå¾²Îó²îºÍ¹¥·ÀÊÖÒÕµÄÉú³¤ £¬²¢ÊµÊ±½ÓÄɲ½·¥À´±£»¤ÏµÍ³µÄÇå¾²¡£Ï£Íû±¾ÎĶÔÄúÔÚ±àдÇå¾²µÄLinux shell¾ç±¾·½ÃæÌṩÁËһЩÓÐÓõÄÖ¸µ¼ºÍÆôʾ¡£

ÒÔÉϾÍÊÇLinux shell¾ç±¾±àдµÄÇå¾²ÐÔ£º×èÖ¹Çå¾²Îó²îµÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í×ðÁú¿­Ê±ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ×ðÁú¿­Ê±ÊµÊ±ÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ×ðÁú¿­Ê±

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
¡¾ÍøÕ¾µØͼ¡¿¡¾sitemap¡¿