FreeBSD Cheat Sheet: Difference between revisions
No edit summary |
|||
| Line 1: | Line 1: | ||
== Upgrading pkgconfig to pkg-config on FreeBSD == | == Upgrading pkgconfig to pkg-config on FreeBSD == | ||
Revision as of 05:17, 15 April 2013
Upgrading pkgconfig to pkg-config on FreeBSD
upgrade from pkgconf portmaster -o devel/pkgconf devel/pkg-config
Restarting Services
Linux
Use any one of:
/etc/init.d/<service> restart /etc/init.d/<service> stop && /etc/init.d/<service> start service <service> restart
FreeBSD
Usually, the startup scripts are located in /etc/rc.d
/etc/rc.d/<service> restart
However, if it is 3rd party software, they are located in /usr/local/etc/rc.d
/usr/local/etc/rc.d/<service> restart
If you are trying to restart NFS, you may do either:
/etc/rc.d/nsfd restart kill -HUP `cat /var/run/mountd.pid`
Solaris / SunOS
The startup scripts are located in /lib/svc/method/<service>
/lib/svc/method/<service> restart svcadm restart <service>
Example: To restart ssh, do any one of:
svcadm restart ssh svcadm restart svc:/network/ssh /lib/svc/method/sshd restart
wget to console
Use the -O - option to output contents to the console.
wget -O - http://google.ca
sed
Simple search / replace
sed 's/<search>/<replace>/g'
remove HTML tags
sed -e 's/<[^>]*>//g' <file>
FreeBSD Ports
Recursively Configure Ports
make config-recursive
Ports Update / Upgrade
portsnap fetch portsnap update
or if you are doing this the first time, run:
portsnap fetch portsnap extract
You may also get the ports from svn:
svn co svn://svn.freebsd.org/base/releng/9.1 /usr/src svn up /usr/src
Upgrade FreeBSD
# mv /usr/src /usr/src.old # svn co svn://svn.freebsd.org/base/release/9.1.0 /usr/src
To build and install 9.1-RELEASE:
# mergemaster -p # cd /usr/src # make buildworld # make buildkernel # make installkernel # reboot # cd /usr/src # make installworld # mergemaster -iU # reboot
User Management
FreeBSD
Create a new user with a home directory /home/username:
pw useradd -n username -s /bin/sh -m
Remove a user and their home directory:
pw userdel -n username -r
Create a new group
pw groupadd groupname
Show group
pw groupshow groupname
Set user to group
pw groupmod groupname -M username,user2,user3
Add user to group
pw groupmod groupname -m user4
Disable SELinux
Temporary:
echo 0 > /selinux/enforce
Permanently:
vi /etc/selinux/config # Change to SELINUX=disabled
Pack & Unpack initird.img
Extracting initrd.img
mkdir initrd_test cd initrd_test gzip -dc < ../initrd.img | cpio -i
Packing initrd.img
cd initrd_test find . | cpio -o -c | gzip -9 > ../initrd.img
Create Driver Disk
# Create a blank, 20MB image dd if=/dev/zero of=driverdisk.img bs=1M count=20 # Format the image with ext2 mkfs -t ext2 -q driverdisk.img # mount it and copy the files over mount -o loop driverdisk.img /mnt/driverdisk # copy drivers to /mnt/driverdisk, then run umount /mnt/tmp
List Installed Packages
rpm -qa rpm -qi <package name>