find your program with “whereis”

Many linux distro build nowadays, each distro came with spesific purpose, server, workstation or desktop orientation but still not forget to give access to shell :-)

people who run “ifconfig” in mandriva will get confuse when run same command in fedora or maybe slackware

“command not found” is common message

just use “whereis” command for this purpose :

whereis ifconfig

whereis perl

whereis sh

answer will show up for full path of program

type full path in shell to get same result, not easy but always work :-)

Recreate FreeBSD ports build option

As big fan of FreeBSD ports, I like to play around with ports option, like when installing php4 I was prompted with a lot of build options :

kongja# whereis php4
php4: /usr/ports/lang/php4
kongja# cd /usr/ports/lang/php4

then this ncurse option will popup

phpbuild.PNG

===> Found saved configuration for php4-4.4.6
===> Extracting for php4-4.4.6

Continue reading

in Unix | 313 Words

View crontab entries of entire user in FreeBSD

Cron is special utility that process command in periodic time such ;

  • doing regular backup every night
  • email special report every week
  • etc

cron access can be usefull but sometime not, depend on the command issued.

As super user we can list all of entire user crontab entries using log locate in /var/log

su-2.05b# tail -f /var/log/cron
Apr 30 20:30:00 erau /usr/sbin/cron[81893]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:30:00 erau /usr/sbin/cron[81894]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:35:00 erau /usr/sbin/cron[84459]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:35:00 erau /usr/sbin/cron[84462]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:40:00 erau /usr/sbin/cron[87061]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:40:00 erau /usr/sbin/cron[87062]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:45:00 erau /usr/sbin/cron[90181]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)
Apr 30 20:45:00 erau /usr/sbin/cron[90180]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:50:00 erau /usr/sbin/cron[93304]: (root) CMD (/usr/libexec/atrun)
Apr 30 20:50:00 erau /usr/sbin/cron[93305]: (root) CMD (/usr/local/bin/php /usr/local/share/cacti/poller.php > /dev/null)

pay attention on (root) entries, that mean user who run that command in this case generate data for cacti.

You can run the command as root or sudo, otherwise you’ll get “permission denied” message

-bash-2.05b$ tail -f /var/log/cron
tail: /var/log/cron: Permission denied
-bash-2.05b$ su
Password:
kongja# tail -f /var/log/cron
Apr 30 20:36:00 kongja /usr/sbin/cron[81442]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:37:00 kongja /usr/sbin/cron[81504]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:38:00 kongja /usr/sbin/cron[81567]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)
Apr 30 20:39:00 kongja /usr/sbin/cron[81631]: (root) CMD (/usr/local/bin/pfstat -q >>/var/log/pfstat)

happy viewing ­čÖé

P.S :

other usefull place to check for cron entries

/var/cron/tabs
/var/cron/atjobs
/etc/crontab

in Unix | 343 Words

no eth0 in FreeBSD?

Convention in Linux for network interface simple and clear.

eth for cable connection

ath or wifi for wireless connection

l0 for loopback

sample from my ubuntu feisty fawn box :

[email protected]:~$ ifconfig -a

ath0  Link encap:Ethernet├»┬┐┬Ż HWaddr 00:14:A4:70:02:3E
inet addr:192.168.12.100├»┬┐┬Ż Bcast:192.168.12.255├»┬┐┬Ż Mask:255.255.255.0
inet6 addr: fe80::214:a4ff:fe70:23e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST├»┬┐┬Ż MTU:1500├»┬┐┬Ż Metric:1
RX packets:8945 errors:0 dropped:0 overruns:0 frame:0
TX packets:6503 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:5854116 (5.5 MiB)├»┬┐┬Ż TX bytes:1133161 (1.0 MiB)

eth0 Link encap:Ethernet├»┬┐┬Ż HWaddr 00:0A:E4:F1:CC:ED
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:23 Base address:0xe000

eth0:avah Link encap:Ethernet├»┬┐┬Ż HWaddr 00:0A:E4:F1:CC:ED
inet addr:169.254.12.119├»┬┐┬Ż Bcast:169.254.255.255├»┬┐┬Ż Mask:255.255.0.0
UP BROADCAST MULTICAST├»┬┐┬Ż MTU:1500├»┬┐┬Ż Metric:1
Interrupt:23 Base address:0xe000

lo Link encap:Local Loopback
inet addr:127.0.0.1├»┬┐┬Ż Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING├»┬┐┬Ż MTU:16436├»┬┐┬Ż Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:346 (346.0 b)├»┬┐┬Ż TX bytes:346 (346.0 b)

Continue reading