Skip to main content
Memanggil history (bahagian II)

Pada siri yang lalu kita telah mempelajari bagaimana untuk memanggil baris arahan mengikut jujukan nombor pada history.

Kali ini kita menggunakan awalan huruf/rangkai kata pada history.


Katakan kita melaksanakan 3 ARAHAN iaitu echo $PATH, cat /proc/version dan date

$ echo $PATH
/usr/local/sbin:/usr/local
/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

$ cat /proc/version
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009

$ date
Rab Ogos 12 12:42:56 MYT 2009


Rekodnya...

$ history
1 echo $PATH
2 printenv
3 echo $PATH
4 cat /proc/version
5 date
6 history

Kita cuba cara yang lalu... menggunakan baris pada kolum nombor
$ !1 && !5 && !4
echo $PATH && date && cat /proc/version
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Rab Ogos 12 12:43:15 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009

Cuba guna awalan huruf pada arahan... rujuk "history" di atas.. "
$ !e && !d && !c
echo $PATH && date && cat /proc/version && date && cat /proc/version
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
Rab Ogos 12 12:43:36 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009
Rab Ogos 12 12:43:36 MYT 2009
Linux version 2.6.28-14-generic (buildd@palmer) (gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) ) #47-Ubuntu SMP Sat Jul 25 00:28:35 UTC 2009



:-)

Comments

Popular posts from this blog

Gue dengan S2 gue. Sronok banget!

Vultr - another reliable alternative for SEA Virtual Private Server!

I have been using Vultr  as my recent VPS now, since it has just a nearby Data Center in Singapore (sadly, Malaysian VPS is always expensive.. so the best option is DC in Singapore - most of the time). It provides free trial credit for around USD5.. and +USD2 if you did a social media integration/sharing with Twitter. Try it now. Click Vultr