Wednesday, October 15, 2008

$PATH not declare on .bashrc

Salam,
Dah dua hari aku berjaya install Fedora 9 kedalam notebook baru aku..
harini aku cuba utk main2 dengan terminal.. tetapi keputusannya seperti berikut...hmmmm.

[p4dawan@localhost ~]$ ifconfig
bash: ifconfig: command not found


uik??? kat mana plak command nih..heh?

[p4dawan@localhost ~]$ locate ifconfig
/sbin/ifconfig


owh..need to run "/sbin/ifconfig" heh?

tetapi command hanya berjalan setelah menjalankan command "/sbin/ifconfig"
[p4dawan@localhost ~]$ /sbin/ifconfig
eth0 Link encap:Ethernet HWaddr 00:XX:XX:XX:XX:XX
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 b) TX bytes:0 (0.0 b)
Interrupt:17


jadi, untuk menjalankannya arahan seperti biasa aku terpaksa mengubah file ".bashrc" pada /root dan juga /home/p4dawan (/home/)
[root@localhost p4dawan]# ls -al /home/p4dawan | grep .bashrc
-rw-r--r-- 1 p4dawan p4dawan 125 2008-10-15 18:37 .bashrc
[root@localhost p4dawan]# ls -al /root | grep .bashrc
-rw-r--r-- 1 root root 176 2008-10-15 18:40 .bashrc


OK.. sekarang kita tengok kandungan pada .bashrc pada lokasi /home/p4dawan
[p4dawan@localhost ~]$ cat .bashrc
# .bashrc


# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions


tengok pula .bashrc pada lokasi /root
[root@localhost p4dawan]# cat /root/.bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi


Kemudian tambahkan
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin

dan
export PATH


pada kedua-dua fail .bashrc (pada lokasi /root dan /home/ )
jadikan seperti dibawah.
[p4dawan@localhost ~]$ cat .bashrc
# .bashrc
#tambahan
PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/sbin:/usr/local/bin"
export PATH
#tambahan tamat
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions


kemudian buka console/terminal baru dan cuba
[p4dawan@localhost ~]$ ifconfig
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
UP BROADCAST MULTICAST MTU:1500 Metric:1


WALLLAAA, tak payah susah-susah taip /sbin/ifconfig lagi..huhu!!!! berjaya..

credit to sifoo mambang from mambang.org.my

No comments: