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

13¸öCatÃüÁî¹ÜÀí(ÏÔʾ£¬ÅÅÐò£¬½¨Á¢)ÎļþʵÀý

·¢²¼Ê±¼ä:2014-06-14 09:57:23À´Ô´:ºìÁª×÷Õß:velcbo
ÔÚLinuxϵͳÖУ¬´ó¶àÊýÅäÖÃÎļþ¡¢ÈÕÖ¾Îļþ£¬ÉõÖÁshell½Å±¾¶¼Ê¹ÓÃÎı¾Îļþ¸ñʽ£¬Òò´Ë£¬Linuxϵͳ´æÔÚ×ŶàÖÖÎı¾±à¼­Æ÷£¬µ«µ±Äã½ö½öÏëÒª²é¿´Ò»ÏÂÕâЩÎļþµÄÄÚÈÝʱ£¬¿ÉʹÓÃÒ»¸ö¼òµ¥µÄÃüÁî-cat¡£

catÊÖ²áÀïÕâÑùÃèÊö£º

catÃüÁî¶ÁÈ¡ÎļþÄÚÈÝ£¬²¢Êä³öµ½±ê×¼É豸ÉÏÃæ

catÊÇÒ»ÌõlinuxÄÚÖÃÃüÁî. ¼¸ºõËùÓÐlinux·¢Ðа涼ÄÚÖã¨Òë×¢£º»òÕß˵ÎÒ´ÓδÌý˵¹ý²»ÄÚÖÃcatÃüÁîµÄ·¢Ðа棩¡£½ÓÏÂÀ´£¬ÈÃÎÒÃÇ¿ªÊ¼Ñ§Ï°ÈçºÎʹÓÃ.
1. ÏÔʾÎļþÄÚÈÝ

×î¼òµ¥µÄ·½·¨ÊÇÖ±½ÓÊäÈë¡®cat file_name¡¯.

# cat /etc/issue

CentOS release 5.10 (Final)
Kernel \r on an \m

2. ͬʱÏÔʾÐкÅ

µ±ÔÚ¶ÁÈ¡ÄÚÈݺܶàµÄÅäÖÃÎļþʱ£¬Èç¹ûͬʱÏÔʾÐкŽ«»áʹ²Ù×÷±ä¼òµ¥£¬¼ÓÉÏ-n²ÎÊý¿ÉÒÔʵÏÖ.

# cat -n /etc/ntp.conf

1 # Permit time synchronization our time resource but do not
2 # permit the source to query or modify the service on this system
3 restrict default kod nomodify notrap nopeer noquery
4 restrict -6 default kod nomodify notrap nopeer noquery
5
6 # Permit all access over the loopback interface. This could be
7 # tightened as well, but to do so would effect some of the
8 # administration functions
9 restrict 127.0.0.1
10 restrict -6 ::1

3. ÔڷǿոñÐÐÊ×ÏÔʾÐкÅ

ÀàËÆÓÚ-n²ÎÊý£¬-bÒ²¿ÉÒÔÏÔʾÐкš£Çø±ðÔÚÓÚ-bÖ»ÔÚ·Ç¿ÕÐÐǰÏÔʾÐкš£

#cat -b /etc/ntp.conf

1 # Permit time synchronization our time resource but do not
2 # permit the source to query or modify the service on this system
3 restrict default kod nomodify notrap nopeer noquery
4 restrict -6 default kod nomodify notrap nopeer noquery

5 # Permit all access over the loopback interface. This could be
6 # tightened as well, but to do so would effect some of the
7 # administration functions
8 restrict 127.0.0.1
9 restrict -6 ::1

4. ÏÔʾtabÖÆ±í·û

µ±ÄãÏëÒªÏÔʾÎı¾ÖеÄtabÖÆ±íλʱ. ¿ÉʹÓÃ-T²ÎÊý. Ëü»áÔÚÊäÈë½á¹ûÖбêʶΪ ^I .

# cat -T /etc/hosts

# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1^I^Ilocalhost.localdomain localhost
::1^I^Ilocalhost6.localdomain6 localhost6

5. ÏÔʾ»»Ðзû

-E²ÎÊýÔÚÿÐнáβʹÓà $ ±íʾ»»Ðзû¡£ÈçÏÂËùʾ :

# cat -E /etc/hosts

# Do not remove the following line, or various programs$
# that require network functionality will fail.$
127.0.0.1 localhost.localdomain localhost$
::1 localhost6.localdomain6 localhost6$

6. ͬʱÏÔÊ¾ÖÆ±í·û¼°»»Ðзû

µ±ÄãÏëҪͬʱ´ïµ½-T¼°-EµÄЧ¹û, ¿ÉʹÓÃ-A²ÎÊý.

# cat -A /etc/hosts

# Do not remove the following line, or various programs$
# that require network functionality will fail.$
127.0.0.1^I^Ilocalhost.localdomain localhost$
::1^I^Ilocalhost6.localdomain6 localhost6$

7. ·ÖÆÁÏÔʾ

µ±ÎļþÄÚÈÝÏÔʾ³¬¹ýÁËÄãµÄÆÁÄ»´óС, ¿É½áºÏcatÃüÁîÓëÆäËüÃüÁî·ÖÆÁÏÔʾ¡£Ê¹ÓùܵÀ·û ( | )À´Á¬½Ó¡£

# cat /proc/meminfo | less

# cat /proc/meminfo | more

ÔÚlessÓëmoreÏÔʾ½á¹ûµÄÇø±ðÔÚÓÚless²ÎÊý¿Épageup¼°pagedownÉÏÏ·­¹ö¡£¶ømore½öÄÜʹÓÿոñÏòÏ·­ÆÁ¡£
8. ͬʱ²é¿´2¸öÎļþÖеÄÄÚÈÝ

λÓÚ/rootÎļþ¼ÐÀïÓÐÁ½¸öÎļþÈ¡Ãûlinux¼°desktop£¬Ã¿¸öÎļþº¬ÓÐÒÔÏÂÄÚÈÝ :

Linux : Ubuntu, centos, RedHat, mint and slackware

Desktop : gnome kde, xfce, enlightment, and cinnamon

µ±ÄãÏëͬʱ²é¿´Á½ÎļþÖеÄÄÚÈÝʱ£¬¿É°´ÈçÏ·½·¨ :

# cat /root/linux /root/desktop

ubuntu
centos
redhat
mint
slackware
gnome
kde
xfce
enlightment
cinnamon

9. ÅÅÐòÏÔʾ

ÀàËÆ. ÄãÒ²¿ÉÒÔ½áºÏcatÃüÁîÓëÆäËüÃüÁîÀ´½øÐÐ×Ô¶¨ÒåÊä³ö. Èç½áºÏ sort £¬Í¨¹ý¹ÜµÀ·û¶ÔÄÚÈݽøÐÐÅÅÐòÏÔʾ¡£¾ÙÀý :

# cat /root/linux | sort

CentOS
mint
RedHat
slackware
Ubuntu

10. ÊäÈëÖØ¶¨Ïò

ÄãÒ²¿É½«ÏÔʾ½á¹ûÊä³öÖØ¶¨Ïòµ½ÆÁÄ»»òÁíÒ»¸öÎļþ¡£ Ö»ÐèҪʹÓà > ·ûºÅ£¨´óÓںţ©¼´¿ÉÊä³öÉú³Éµ½ÁíÒ»¸öÎļþ¡£

# cat /root/linux > /root/linuxdistro

ÒÔÉÏÃüÁî»áÉú³ÉÒ»¸öÓë/root/linuxÄÚÈÝһģһÑùµÄ½ÐlinuxdistroµÄÎļþ.
11. н¨Îļþ

LinuxÏÂÓжàÖÖ·½·¨Ð½¨Îļþ¡£ÆäÖÐʹÓÃcat¾ÍÊÇ·½·¨Ö®Ò».

# cat > operating_system

Unix
Linux
Windows
MacOS

µ±ÄãÊäÈëcat > operatingsystem£¬Ëü»áÉú³ÉÒ»¸öoperatingsystemµÄÎļþ¡£È»ºóÏÂÃæ»áÏÔʾ¿ÕÐС£´ËʱÄã¿ÉÊäÈëÄÚÈÝ¡£±ÈÈçÎÒÃÇÊäÈëUnix, Linux, Windows ºÍ MacOS£¬ ÊäÈëÍê³Éºó£¬°´Ctrl-D´æÅÌÍ˳öcat¡£´ËʱÄã»á·¢ÏÖµ±Ç°Îļþ¼ÐÏ»áÉú³ÉÒ»¸ö°üº¬Äã¸Õ²ÅÊäÈëÄÚÈݵĽРoperating_systemµÄÎļþ¡£
12.ÏòÎļþÖÐ×·¼ÓÄÚÈÝ

µ±ÄãʹÓÃÁ½¸ö > ·ûʱ, »á½«µÚÒ»¸öÎļþÖеÄÄÚÈÝ×·¼Óµ½µÚ¶þ¸öÎļþµÄĩβ¡£ ¾ÙÀý :

# cat /root/linux >> /root/desktop

# cat /root/desktop

Ëü»á½« /root/linuxµÄÄÚÈÝ×·¼Óµ½/root/desktopÎļþµÄĩβ¡£

µÚ¶þ¸öÎļþµÄÄÚÈݽ«»á±ä³ÉÕâÑù:

gnome
kde
xfce
enlightment
cinnamon
ubuntu
centos
redhat
mint
slackware

13. ÖØ¶¨ÏòÊäÈë

Äã¿ÉʹÓà <ÃüÁСÓںţ©½«ÎļþÊäÈëµ½catÖÐ.

# cat < /root/linux

ÉÏÃæÃüÁî±íʾ /root/linuxÖеÄÄÚÈÝ×÷ΪcatµÄÊäÈë¡£ÆÁÄ»ÉÏÏÔʾÈçÏ :

ubuntu
centos
redhat
mint
slackware

ΪÁ˸üÇå³þ±íʾËüµÄÒâÒ壬ÎÒÃÇʹÓÃÒÔÏÂÃüÁî :

# cat < /root/linux | sort > linux-sort

´ËÃüÁîÕâÑùÀí½â: ´Ó/root/linuxÖжÁÈ¡ÄÚÈÝ£¬È»ºóÅÅÐò£¬½«½á¹ûÊä³ö²¢Éú³Élinux-sortÐÂÎļþ

È»ºóÎÒÃÇ¿´¿´linux-sortÖеÄÄÚÈÝ :

centos
mint
redhat
slackware
ubuntu

ÒÔÉÏÊÇһЩcatÃüÁîµÄÈÕ³£»ù±¾Ó¦ÓÃ. ¸ü¶àÏà¹ØÄã¿É´ÓcatÃüÁîÊÖ²áÖÐѧµ½²¢¼ÇµÃ¾­³£Á·Ï°ËüÃÇ.

À´Ô´£ºlinux.cn
ÎÄÕÂÆÀÂÛ

¹²ÓÐ 0 ÌõÆÀÂÛ