Computer >> คอมพิวเตอร์ >  >> สมาร์ทโฟน >> Linux

20 คำสั่งทุบตีที่มีประโยชน์มาก

ต่อไปนี้คือรายการคำสั่งทุบตีบางคำสั่งที่ฉันใช้บ่อยที่สุดและคำอธิบายสั้นๆ เกี่ยวกับสิ่งที่ฉันใช้

ifconfig

ใช้เพื่อค้นหาที่อยู่ IP ของคุณ (ดูที่ wlan0 บรรทัดที่ขึ้นต้นด้วย 'inet addr')

[kmurray@radon ~]$ /sbin/ifconfig
lo ลิงก์ encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr:::1/128 ขอบเขต:โฮสต์
UP LOOPBACK กำลังทำงาน MTU:16436 เมตริก:1
แพ็กเก็ต RX:19266 ข้อผิดพลาด:0 หลุด:0 เกิน:0 เฟรม:0
แพ็กเก็ต TX:19266 ข้อผิดพลาด:0 หลุด:0 เกิน:0 ผู้ให้บริการ:0
การชนกัน:0 txqueuelen:0
RX ไบต์:963988 (941.3 KiB) ไบต์ TX:963988 (941.3 KiB)

ตัวเข้ารหัสลิงก์ wlan0:Ethernet HWaddr 00:1A:73:0F:0E:FD
inet addr:192.168.1.139 Bcast:192.168.1.255 มาสก์:255.255.255.0
inet6 addr:fe80::21a:73ff:fe0f:efd/64 ขอบเขต:ลิงก์
UP BROADCAST RUNNING MULTICAST MTU:1500 เมตริก:1
แพ็กเก็ต RX:8712 ข้อผิดพลาด:0 หลุด:0 โอเวอร์รัน:0 เฟรม:0
แพ็กเก็ต TX:8944 ข้อผิดพลาด:0 หลุด:0 โอเวอร์รัน:0 ผู้ให้บริการ:0
ชน:0 txqueuelen:1000
ไบต์ RX:8002586 (7.6 MiB) ไบต์ TX:3113446 (2.9 MiB)

เส้นทาง -n

ใช้เพื่อค้นหาที่อยู่ IP ของเกตเวย์เริ่มต้นของคุณ (มองหาเส้นที่มีตัว G ในคอลัมน์ Flags}

[kmurray@radon ~]$ /sbin/route -n
Kernel IP routing table
เกตเวย์ปลายทาง Genmask Flags Metric Ref Use Iface
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 wlan0
0.0. 0.0 192.168.1.1 0.0.0.0 UG 0 0 0 wlan0

ip

ฉันใช้อันนี้คล้ายกับ ifconfig และกำหนดเส้นทาง

[kmurray@radon ~]$ /sbin/ip route
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.139
default via 192.168.1.1 dev wlan0 proto static

[kmurray@radon ~]$ /sbin/ip addr
1:lo: mtu 16436 qdisc noqueue state UNKNOWN
ลิงก์/loopback 00:00:00:00:00:00 brd 00:00:00 :00:00:00
inet 127.0.0.1/8 ขอบเขตโฮสต์ lo
inet6 ::1/128 ขอบเขตโฮสต์
valid_lft ถาวรที่ต้องการ_lft ตลอดไป
2:eth0: mtu 1500 qdisc noop state ลง qlen 1000
ลิงก์/อีเธอร์ 00:16:d4:ec:25:4b brd ff:ff:ff:ff:ff:ff
3:wlan0: mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:1a:73:0f:0e:fd brd ff:ff:ff:ff:ff:ff
inet 192.168.1.139/24 brd 192.168.1.255 ขอบเขตทั่วโลก wlan0
inet6 fe80::21a:73ff:fe0f:efd/64 ลิงก์ขอบเขต
valid_lft ตลอดไป Pressure_lft ตลอดไป

ปิง

ใช้เพื่อทดสอบการเชื่อมต่อเครือข่าย

[kmurray@radon ~]$ ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) ไบต์ของข้อมูล
64 ไบต์จาก 192.168.1.1:icmp_seq=1 ttl=64 เวลา=1.23 ms
64 ไบต์จาก 192.168.1.1:icmp_seq=2 ttl=64 เวลา=1.17 ms
64 ไบต์จาก 192.168.1.1:icmp_seq=3 ttl=64 เวลา=1.14 ms
64 ไบต์จาก 192.168.1.1:icmp_seq =4 ttl=64 เวลา=1.19 ms
^C
— 192.168.1.1 สถิติการปิง —
ส่ง 4 แพ็กเก็ต, รับ 4 ครั้ง, แพ็กเก็ตสูญหาย 0%, เวลา 3268ms
rtt นาที /avg/max/mdev =1.149/1.190/1.238/0.032 มิลลิวินาที

traceroute

เครื่องมือเชื่อมต่อเครือข่ายอื่น ข้อมูลนี้จะบอกคุณว่าคุณต้องผ่านเราเตอร์กี่ตัวเพื่อเชื่อมต่อกับโฮสต์เฉพาะ

[kmurray@radon ~]$ traceroute simplehelp.net
traceroute ไปยัง simplehelp.net (74.52.95.42), สูงสุด 30 ฮ็อพ, แพ็กเก็ต 60 ไบต์
1 192.168.1.1 (192.168.1.1) 1.121 ms 2.010 ms 2.218 ms
2 24.68.178.1 (24.68.178.1) 25.950 ms * *
3 * * *
4 * * *
5 rc2bb-pos0-1-5-0.vc.shawcable.net (66.163) .77.185) 39.178 ms 128.371 ms 50.787 ms
6 rc2sj-pos6-0-0.cl.shawcable.net (66.163.77.70) 119.703 ms 76.364 ms 88.337 ms
7 rc2sj-ge2-0-0 .cl.shawcable.net (66.163.67.10) 110.862 ms 55.853 ms *
8 * rx0sj-comcast.cl.shawcable.net (66.163.67.110) 61.930 ms 109.439 ms
9 pos-0-8 -0-0-cr01.losangeles.ca.ibone.comcast.net (68.86.85.82) 79.587 ms 102.306 ms 81.225 ms
10 pos-0-9-0-0-cr01.dallas.tx.ibone comcast.net (68.86.85.142) 120.064 ms 125.584 ms 118.207 ms
11 68.86.88.50 (68.86.88.50) 107.133 ms 109.350 ms 113.994 ms
12 te9-1.dsr02.dllstx3.theplanet.com ( 70.87.253.22) 87.928 มิลลิวินาที 87.949 มิลลิวินาที te9-1.dsr01.dllstx3.theplanet.com (70.87.253.6) 89.500 มิลลิวินาที
13 76.fd.5746 static.theplanet.com (70.87.253.118) 99.789 ms 97.329 ms 100.789 ms
14 po1.car03.dllstx6.theplanet.com (12.96.160.5) 91.323 ms 91.788 ms po2.car03.dllstx6.theplanet.com (12.96) .160.37) 89.571 มิลลิวินาที
15 2a.5f.344a.static.theplanet.com (74.52.95.42) 92.695 มิลลิวินาที 92.601 มิลลิวินาที 91.871 มิลลิวินาที

เจ้าภาพ

ใช้เพื่อค้นหาที่อยู่ IP ของชื่อโดเมนแบบเต็ม

[kmurray@radon ~]$ โฮสต์ simplehelp.net
simplehelp.net มีที่อยู่ 74.52.95.42
อีเมล simplehelp.net ได้รับการจัดการโดย 10 aspmx.l.google.com

ขุด

เครื่องมือสืบค้น DNS ขั้นสูง

[kmurray@radon ~]$ ขุด simplehelp.net a

; <<>> DiG 9.5.0-P2 <<>> simplehelp.net a
;; ตัวเลือกสากล:printcmd
;; ได้คำตอบแล้ว:
;; ->>HEADER<<- opcode:QUERY, สถานะ:NOERROR, id:25242;; ธง:qr rd ra; คำถาม:1 คำตอบ:1 ผู้มีอำนาจ:0, เพิ่มเติม:0;; ส่วนคำถาม:;simplehelp.net ใน;; ส่วนคำตอบ:simplehelp.net 86238 ใน 74.52.95.42;; เวลาสืบค้น:1 มิลลิวินาที;; เซิร์ฟเวอร์:192.168.1.1#53(192.168.1.1);; เมื่อ:ศุกร์ 31 ต.ค. 20:21:49 น. 2008;; MSG SIZE rcvd:48 แสดงว่าที่อยู่ IP ของเซิร์ฟเวอร์ที่มี simplehelp.net คือ 74.52.95.42 [kmurray@radon ~]$ ขุด simplehelp.net mx

; <<>> DiG 9.5.0-P2 <<>> simplehelp.net mx
;; ตัวเลือกสากล:printcmd
;; ได้คำตอบแล้ว:
;; ->>HEADER<<- opcode:QUERY, สถานะ:NOERROR, id:17277;; ธง:qr rd ra; คำถาม:1 คำตอบ:1 ผู้มีอำนาจ:0, เพิ่มเติม:2;; ส่วนคำถาม:;simplehelp.net ใน MX;; ส่วนคำตอบ:simplehelp.net 86317 ใน MX 10 aspmx.l.google.com;; ส่วนเพิ่มเติม:aspmx.l.google.com 180 ใน 209.85.199.27aspmx.l.google.com 180 ใน 209.85.199.114;; เวลาสืบค้น:40 มิลลิวินาที;; เซิร์ฟเวอร์:192.168.1.1#53(192.168.1.1);; เมื่อ:ศุกร์ 31 ต.ค. 20:21:51 น. 2008;; ขนาดผงชูรส rcvd:98 แสดงว่าอีเมลสำหรับ simplehelp.net ได้รับการจัดการโดย aspmx.l.google.com และ aspmx.l.google.com มีที่อยู่ IP สองแห่ง 209.85.199.27 และ 209.85.199.114 [kmurray@radon ~]$ ขุด simplehelp.net ns

; <<>> DiG 9.5.0-P2 <<>> simplehelp.net ns
;; ตัวเลือกสากล:printcmd
;; ได้คำตอบแล้ว:
;; ->>HEADER<<- opcode:QUERY, สถานะ:NOERROR, id:62957;; ธง:qr rd ra; คำถาม:1 คำตอบ:2 ผู้มีอำนาจ:0, เพิ่มเติม:8;; ส่วนคำถาม:;simplehelp.net ใน NS;; ส่วนคำตอบ:simplehelp.net 70617 ใน NS ns1.theplanet.com.simplehelp.net 70617 ใน NS ns2.theplanet.com;; ส่วนเพิ่มเติม:ns1.theplanet.com 172785 ใน 70.86.61.133ns2.theplanet.com 172785 ใน 70.86.61.135ns1.theplanet.com 172785 ใน 70.86.61.134ns2.theplanet.com 172785 ใน 70.87.7.73ns1.theplanet.com 172785 ใน 70.87.7.71ns1.theplanet.com 172785 ใน 70.87.7.70ns2.theplanet.com 172785 ใน 70.86.61.136ns2.theplanet.com 172785 ใน 70.87.7.72;; เวลาสืบค้น:33 msec;; เซิร์ฟเวอร์:192.168.1.1#53(192.168.1.1);; เมื่อ:ศุกร์ 31 ต.ค. 20:21:55 2551;; ขนาดผงชูรส rcvd:209 แสดงว่า DNS สำหรับ simplehelp.net ได้รับการจัดการโดย ns1.theplanet.com และ ns2.theplanet.com นอกจากนี้ยังแสดงว่าเนมเซิร์ฟเวอร์เหล่านี้มีที่อยู่ IP หลายแห่ง

iwlist

รับข้อมูลจากอินเทอร์เฟซไร้สาย (อันนี้ต้องรันเป็นรูท)

[root@radon ~]# iwlist wlan0 scan
wlan0 การสแกนเสร็จสมบูรณ์ :
เซลล์ 01 – ที่อยู่:00:10:18:90:20:DB
ESSID:”Coffee”
Mode:Master
ช่องสัญญาณ:6
ความถี่:2.437 GHz (ช่อง 6)
คุณภาพ=96/100 ระดับสัญญาณ:-37 dBm ระดับเสียงรบกวน=-70 dBm
คีย์การเข้ารหัส:ปิด
บิต อัตรา:1 Mb/s; 2 เมกะไบต์/วินาที; 5.5 เมกะไบต์/วินาที; 11 เมกะไบต์/วินาที; 6 Mb/s
9 Mb/s; 12 เมกะไบต์/วินาที; 18 เมกะไบต์/วินาที; 24 เมกะไบต์/วินาที; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:tsf=0000017f91cc818a
Extra:Last beacon:19ms ago
Cell 02 – ที่อยู่:00:11:50:6E:BC:3A
ESSID:”Belkin Traveller”
โหมด:มาสเตอร์
ช่องสัญญาณ:1
ความถี่:2.412 GHz (ช่อง 1)
คุณภาพ=88/100 ระดับสัญญาณ:-44 dBm ระดับเสียงรบกวน=-70 dBm
รหัสการเข้ารหัส:ปิด
อัตราบิต:1 Mb/s; 2 เมกะไบต์/วินาที; 5.5 เมกะไบต์/วินาที; 11 เมกะไบต์/วินาที; 6 Mb/s
12 Mb/s; 24 เมกะไบต์/วินาที; 36 เมกะไบต์/วินาที; 9 เมกะไบต์/วินาที; 18 Mb/s
48 Mb/s; 54 Mb/s
Extra:tsf=0000017f13571181
Extra:Last beacon:601ms ago
Cell 03 – ที่อยู่:00:17:9A:9C:14:28
ESSID:”Abby”
โหมด:มาสเตอร์
ช่องสัญญาณ:6
ความถี่:2.437 GHz (ช่อง 6)
คุณภาพ=50/100 ระดับสัญญาณ:-79 dBm ระดับเสียงรบกวน=-70 dBm
รหัสการเข้ารหัส:ปิด
อัตราบิต:1 Mb/s; 2 เมกะไบต์/วินาที; 5.5 เมกะไบต์/วินาที; 11 เมกะไบต์/วินาที; 6 Mb/s
9 Mb/s; 12 เมกะไบต์/วินาที; 18 เมกะไบต์/วินาที; 24 เมกะไบต์/วินาที; 36 Mb/s
48 Mb/s; 54 Mb/s
Extra:tsf=00000000cbe364d6
Extra:Last beacon:272ms ago
Cell 04 – ที่อยู่:00:18:D1:A8:E8:1A
ESSID:”Gigaset815″
โหมด:มาสเตอร์
ช่องสัญญาณ:4
ความถี่:2.427 GHz (ช่อง 4)
คุณภาพ=45/100 ระดับสัญญาณ:-83 dBm ระดับเสียงรบกวน=-70 dBm
Encryption key:on
IE:WPA เวอร์ชัน 1
Group Cipher :TKIP
Pairwise Ciphers (1) :TKIP
Authentication Suites (1) :PSK
อัตราบิต:1 Mb/s; 2 เมกะไบต์/วินาที; 5.5 เมกะไบต์/วินาที; 11 เมกะไบต์/วินาที; 22 เมกะไบต์/วินาที
6 เมกะไบต์/วินาที; 9 เมกะไบต์/วินาที; 12 เมกะไบต์/วินาที; 18 เมกะไบต์/วินาที; 24 เมกะไบต์/วินาที
36 เมกะไบต์/วินาที; 48 เมกะไบต์/วินาที; 54 Mb/s
Extra:tsf=0000015633a50e12
Extra:Last beacon:571ms ago

นี่แสดงว่าคอมพิวเตอร์ของฉันเห็นเครือข่ายไร้สาย 4 เครือข่ายในพื้นที่พร้อมกับชื่อ ช่อง ความแรงของสัญญาณ และไม่ว่าจะเข้ารหัสหรือเปิดอยู่หรือไม่

iwconfig

เช่นเดียวกับ ifconfig แต่สำหรับข้อมูลเกี่ยวกับการตั้งค่าไร้สายของคุณ

[kmurray@radon ~]$ /sbin/iwconfig
ไม่มีส่วนขยายแบบไร้สาย
eth0 ไม่มีส่วนขยายแบบไร้สาย
wlan0 IEEE 802.11bg ESSID:”Coffee”
โหมด:ความถี่ที่มีการจัดการ:2.437 GHz จุดเข้าใช้งาน:00 :10:18:90:20:DB
อัตราบิต=54 Mb/s Tx-Power=27 dBm
ลองขีดจำกัดขั้นต่ำอีกครั้ง:7 RTS thr:off Fragment thr=2352 B
ลิงก์ คุณภาพ=96/100 ระดับสัญญาณ:-37 dBm ระดับเสียงรบกวน=-70 dBm
Rx ไม่ถูกต้อง nwid:0 Rx ไม่ถูกต้อง crypt:0 Rx ไม่ถูกต้อง Frag:0
Tx การลองใหม่มากเกินไป:0 เบ็ดเตล็ดที่ไม่ถูกต้อง:0 พลาด สัญญาณ:0

นี่แสดงว่าฉันกำลังเชื่อมต่อกับเครือข่ายไร้สายชื่อ Coffee ที่ 54 Mb/s และความแรงของสัญญาณดีมากที่ 96%

ฟรี

จำนวนหน่วยความจำและพื้นที่สว็อปที่ใช้/ว่าง

[kmurray@radon ~]$ free -m
ใช้งานทั้งหมด ฟรี แคชบัฟเฟอร์ที่ใช้ร่วมกันฟรี แคช
บันทึก:2017 1659 357 0 42 1078
-/+ บัฟเฟอร์/แคช:538 1478
สลับ:1983 0 1983

เมานต์

ไม่มีพารามิเตอร์ใด ๆ ใช้เพื่อแสดงระบบไฟล์ที่เมาท์

[kmurray@radon ~]$ mount
/dev/mapper/VolGroup00-LogVol00 on / type ext3 (rw,noatime)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts บน /dev/pts ประเภท devpts (rw,gid=5,mode=620)
/dev/sda2 บน /boot ประเภท ext3 (rw,noatime)
tmpfs บน /dev/shm ประเภท tmpfs (rw)
ไม่มีใน /proc/sys/fs/binfmt_misc ประเภท binfmt_misc (rw)
sunrpc บน /var/lib/nfs/rpc_pipefs ชนิด rpc_pipefs (rw)
fusectl บน /sys /fs/fuse/ประเภทการเชื่อมต่อ fusectl (rw)
gvfs-fuse-daemon บน /home/kmurray/.gvfs ประเภท fuse.gvfs-fuse-daemon(rw,nosuid,nodev,user=kmurray)
/dev/sda1 บน /media/disk ประเภท fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

บรรทัดที่น่าสนใจด้านบนคือบรรทัดที่ระบุ /dev/mapper/VolGroup00-LogVol00 on /, /dev/sda2 on /boot และ /dev/sda1 on /media/disk

df

แสดงการใช้พื้นที่ดิสก์

[kmurray@radon ~]$ df -h
ขนาดระบบไฟล์ที่ใช้ ความพร้อมใช้งาน % ติดตั้งบน
/dev/sda2 190M 19M 162M 11% /boot
tmpfs 1009M 1.1M 1008M 1% /dev/shm
gvfs -fuse-daemon 60G 44G 16G 74% /home/kmurray/.gvfs
/dev/sda1 31G 29G 2.5G 93% /media/disk

นี่แสดงว่า /dev/sda1 เกือบเต็มแล้วที่ 93% ถึงเวลาลบไฟล์บางไฟล์หรืออัปเกรดดิสก์แล้ว

du

แสดงการใช้พื้นที่ดิสก์ในไดเร็กทอรี

[kmurray@radon ~]$ du -hc Documents/N95/tutorials/
380K Documents/N95/tutorials/done/bluetooth gps
480K Documents/N95/tutorials/done/putty fonts
เอกสาร 1.4M/N95/tutorials /done/gparted
1.1M Documents/N95/tutorials/done/remote filesystem gnome
1.4M Documents/N95/tutorials/done/gnome แป้นพิมพ์ลัด
2.1M Documents/N95/tutorials/ เสร็จสิ้น/ดาวน์โหลดตัวช่วย
992K Documents/N95/tutorials/done/mconnection
1008K Documents/N95/tutorials/done/snap links
5.0M Documents/N95/tutorials/done/watermark gimp
1.2M Documents/N95/tutorials/done/gnome disk usage
208K Documents/N95/tutorials/done/enhanced calculator
544K Documents/N95/tutorials/done/putty/orig
964K Documents/N95/tutorials/done/putty
848K Documents/N95/tutorials/done/wifi ap
1.4M Documents/N95/tutorials/done/imap gmail
872K เอกสาร/N95 /tutorials/done/แอปที่ไม่ได้ลงชื่อ
884K Documents/N95/tutorials/done/taskman
1.1M Documents/N95/tutorials/done/downthemall
916K Documents/N95/tutorials/done/tethering bt
432K Documents/N95/tutorials/done/install apps wifi http
924K Documents/N95/tutorials/done/tethering usb
320K Documents/N95/tutorials/done/install stuff via bluetooth
416K Documents/N95/tutorials/done/smb4s60
1.1M Documents/N95/tutorials/done/download statusbar
308K Documents/N95/tutorials/done/install stuff via usb
828K Documents/N95/tutorials/done/nokia step counter
4.3M Documents/N95/tutorials/todo
52M Documents/N95/tutorials/
52M total

This shows that my N95 tutorials directory is using a total of 52M and the breakdown of each directory’s size.

head

Display the first few lines of a file.

[kmurray@radon ~]$ head /var/log/yum.log
Jun 13 22:30:33 Installed:bash-completion-20060301-10.noarch
Jun 13 22:31:31 Installed:yum-downloadonly-1.1.13-2.fc9.noarch
Jun 14 06:20:11 Installed:swfdec-0.6.6-1.fc9.i386
Jun 14 06:20:13 Installed:swfdec-gtk-0.6.6-1.fc9.i386
Jun 14 06:20:14 Installed:swfdec-mozilla-0.6.0-1.fc9.i386
Jun 14 06:34:41 Updated:libxml2-2.6.32-2.fc9.i386
Jun 14 06:34:41 Updated:dbus-glib-0.74-8.fc9.i386
Jun 14 06:34:42 Updated:libselinux-2.0.64-2.fc9.i386
Jun 14 06:34:43 Updated:e2fsprogs-libs-1.40.8-3.fc9.i386
Jun 14 06:34:43 Updated:audit-libs-1.7.4-1.fc9.i386

By default, head displays the first 10 lines. head -20 /var/log/yum.log would show the first 20 lines. You can use any arbitrary number.

tail

Display the last few lines of a file.

[kmurray@radon ~]$ tail /var/log/yum.log
Oct 30 23:19:56 Updated:6:kdebase-libs-4.1.2-5.fc9.i386
Oct 30 23:19:57 Updated:6:kdemultimedia-libs-4.1.2-2.fc9.i386
Oct 30 23:19:57 Updated:ksysguardd-4.1.2-6.fc9.i386
Oct 30 23:19:58 Updated:phonon-backend-xine-4.1.2-5.fc9.i386
Oct 30 23:20:08 Updated:kdebase-runtime-4.1.2-5.fc9.i386
Oct 30 23:20:11 Updated:kdebase-workspace-libs-4.1.2-6.fc9.i386
Oct 30 23:20:21 Updated:kdebase-workspace-4.1.2-6.fc9.i386
Oct 30 23:20:27 Updated:6:kdebase-4.1.2-5.fc9.i386
Oct 30 23:20:39 Installed:kdebase-runtime-libs-4.1.2-5.fc9.i386
Oct 30 23:20:42 Updated:6:kdemultimedia-4.1.2-2.fc9.i386

By default, tail displays the last 10 lines. tail -30 /var/log/yum.log would show the last 30 lines. You can use any arbitrary number.

grep

Search for a specific string within a file. (use zgrep to search a gzipped file)

[kmurray@radon ~]$ grep firefox /var/log/yum.log
Jun 19 16:19:33 Updated:firefox-3.0-1.fc9.i386
Jul 24 04:48:06 Updated:firefox-3.0.1-1.fc9.i386
Oct 18 03:13:52 Updated:firefox-3.0.2-1.fc9.i386

This shows that “firefox” is listed three times in this file.

type

Determine which directory a command is in.

[kmurray@radon ~]$ type ping
ping is hashed (/bin/ping)

Ahh, so ping lives in /bin.

locate

Locate any arbitrary file on the filesystem.

[kmurray@radon ~]$ locate *.rpm
/home/kmurray/Download/VirtualBox-2.0.2_36488_fedora9-1.i386.rpm
/home/kmurray/Download/VirtualBox-2.0.4_38406_fedora9-1.i386.rpm
/home/kmurray/Download/skype-2.0.0.72-fc5.i586.rpm
/home/kmurray/Download/synaptics-0.14.6-8.fc9.i386.rpm

I have four rpm files on this computer, all of them in /home/kmurray/Download.

file

Determine what type a file is.

[kmurray@radon ~]$ file /bin/ping
/bin/ping:setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.9, stripped

ping is a binary file.

[kmurray@radon ~]$ file Mythbusters.S02E04.flv
Mythbusters.flv:Macromedia Flash Video

Mythbusters.S02E04.flv is a video.

[kmurray@radon ~]$ file /var/log/yum.log
/var/log/yum.log:ASCII text

/var/log/yum.log is a plain text file.

history

Shows what commands you have been running on the command line.

[kmurray@radon ~]$ history

991 du -hc Documents/N95/tutorials/
992 ls /var/log/messages
993 tail /var/log/messages
994 ls
995 ls /var/log/
996 ls -lh /var/log/
997 tail /var/log/yum.log
998 head /var/log/yum.log
999 grep firefox /var/log/yum.log
1000 sudo su –
1001 cd src/
1002 ls
1003 tar -xvzf TrueCrypt\ 6.1\ Source.tar.gz
1004 cd truecrypt-6.1-source/
1005 ls
1006 less Readme.txt
1007 make
1008 less Readme.txt
1009 make
1010 make
1011 cd
1012 cd .VirtualBox/VDI/
1013 ls
1014 cat RawUSBsdb.vdi
1015 mv RawUSBsdb.vdi RawUSBsdb1G.vdi
1016 cp RawUSBsdb1G.vdi RawUSBsdb2G.vdi
1017 vim RawUSBsdb2G.vdi
1018 rm RawUSBsdb2G.vdi
1019 pwd
1020 VBoxManage internalcommands createrawvmdk -filename /home/kmurray/.VirtualBox
1021 cat RawUSBsdb2G.vdi
1022 cd

In order to discover which commands I use most so I could write this list, I used a combination of five different commands all piped together:

history | awk {‘print $2’} | sort | uniq | less

awk {‘print $2’} causes only the second column of the output to be displayed, sort puts everything in alphabetical order, uniq cuts out all the duplicates, and less causes the output to be displayed one screen at a time.

If you have any favourite bash commands that you would like to share, please tell us about them in the comments below.