Bash 如何在开发被阻止时卸载?

lsof -n | grep /mnt/cdrom

Bash unix系统中网络管理员的有用命令和文件

#useful commands:
	hostname - show or set the system’s host name
	ifconfig - configure a network interface
	host - DNS lookup utility (host "adress.com")
	route - show / manipulate the IP routing table
	netstat - Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships
	dnsdomainname - show the system’s DNS domain name
	arp - manipulate the system ARP cache
	ping, ping6 - send ICMP ECHO_REQUEST to network hosts



#useful conf files:

#DNS and resolv
/etc/hosts 
/etc/resolv.conf

#eth configuration
/etc/network/interfaces

Bash 本地LAN内或路由器后面的动态IP更新(对于像zoneedit或dyndns这样的DNS服务)

#!/bin/sh
newip=`wget -o /dev/null -O - http://simple.showmyip.com | cut -f1 -d' ' | sed -n 1p`
presentip=`host myweb.com | sed -n 1p | cut -d' ' -f4`
if [ "$newip" != "$presentip" ]; then update_dns_ip.sh; fi

Bash linux日期和时钟的变化

sudo date --set "2006-08-19 00:43" #system update
sudo hwclock --set --date="2006-08-19 00:43" #bios update

Bash 用fgrep找一个空行

cat -A file_name.txt | fgrep -U -n -x $

Bash 如何设置进程的nice值(优先级执行)

#new process
nice -n PRIORITYNUMBER PROCESSNAME

#existing process
renice PRIORITYNUMBER PID_PROCESS

Bash 系统信息的命令

cat /proc/cpuinfo
free
df -h
hdparm -tT harddisk

Bash FreeBSD ipfw内核配置

machine         i386
cpu             I686_CPU
ident           MYKERNEL

options         SCHED_4BSD              # 4BSD scheduler
options         PREEMPTION              # Enable kernel thread preemption
options         INET                    # InterNETworking
options         FFS                     # Berkeley Fast Filesystem
options         SOFTUPDATES             # Enable FFS soft updates support
options         PROCFS                  # Process filesystem (requires PSEUDOFS)
options         PSEUDOFS                # Pseudo-filesystem framework
options         COMPAT_43               # Compatible with BSD 4.3 [KEEP THIS!]
options         COMPAT_FREEBSD4         # Compatible with FreeBSD4
options         COMPAT_FREEBSD5         # Compatible with FreeBSD5
options         KTRACE                  # ktrace(1) support
options         SYSVSHM                 # SYSV-style shared memory
options         SYSVMSG                 # SYSV-style message queues
options         SYSVSEM                 # SYSV-style semaphores
options         _KPOSIX_PRIORITY_SCHEDULING # POSIX P1003_1B real-time extensions
options         KBD_INSTALL_CDEV        # install a CDEV entry in /dev
options         AHC_REG_PRETTY_PRINT    # Print register bitfields in debug
                                        # output.  Adds ~128k to driver.
options         AHD_REG_PRETTY_PRINT    # Print register bitfields in debug
                                        # output.  Adds ~215k to driver.
options         ADAPTIVE_GIANT          # Giant mutex is adaptive.

device          apic                    # I/O APIC
device          eisa
device          pci
device          fdc
device          ata
device          atadisk         # ATA disk drives

options         ATA_STATIC_ID   # Static device numbering

device          atkbdc          # AT keyboard controller
device          atkbd           # AT keyboard
device          psm             # PS/2 mouse
device          vga             # VGA video card driver
device          splash          # Splash screen and screen saver support
device          sc
device          sio             # 8250, 16[45]50 based serial ports
device          miibus          # MII bus support
device          dc              # DEC/Intel 21143 and various workalikes
device          tl              # Texas Instruments ThunderLAN
device          loop            # Network loopback
device          random          # Entropy device
device          ether           # Ethernet support
device          pty             # Pseudo-ttys (telnet etc)
device          bpf             # Berkeley packet filter
device          tun             # Packet tunnel.

options         IPFIREWALL
options         IPFIREWALL_VERBOSE
options         IPFIREWALL_VERBOSE_LIMIT=5
options         IPFIREWALL_DEFAULT_TO_ACCEPT
options         IPDIVERT
options         DUMMYNET
options         HZ=1000

Bash Bash FreeBSD端口升级

#!/bin/sh

cd /usr/ports
make fetchindex
/usr/local/sbin/portupgrade -anrR

Bash Bash FreeBSD更新稳定

#!/bin/sh

if SERVER=`/usr/local/bin/fastest_cvsup -q -c all`; then
  /usr/local/bin/cvsup -g -P - -L 2 -h $SERVER /root/stable-supfile
fi