netbsd-tips revision 1.1 1 1.1 reed List 20 largest files (larger than 5 MB) sorted by megabytes:
2 1.1 reed
3 1.1 reed find / -type f -size +10000 -print0 | xargs -0 du -m | sort -nr | head -20
4 1.1 reed %
5 1.1 reed You can keep specific rc.conf configurations in individual files
6 1.1 reed under /etc/rc.conf.d/ where each file is named after the $name of
7 1.1 reed the rc.d script. Some configurations may have different names than
8 1.1 reed the script; see the $name variable to check.
9 1.1 reed %
10 1.1 reed You can see the total used buffers in megabytes with:
11 1.1 reed
12 1.1 reed vmstat -s | awk '
13 1.1 reed / bytes per page$/ { bpp = $1 }
14 1.1 reed / cached file pages$/ { cfp = $1 }
15 1.1 reed / cached executable pages$/ { cep = $1 }
16 1.1 reed END { print((cfp + cep) * bpp / 1024 / 1024); }'
17 1.1 reed %
18 1.1 reed You can view a value of a variable in pkgsrc by using the show-var
19 1.1 reed target, for example:
20 1.1 reed
21 1.1 reed make show-var VARNAME=MAINTAINER
22 1.1 reed %
23 1.1 reed You can view the basic order of your rc.d scripts with:
24 1.1 reed
25 1.1 reed rcorder /etc/rc.d/*
26 1.1 reed %
27 1.1 reed You can ask questions about NetBSD at the netbsd-users (a] NetBSD.org
28 1.1 reed mailing list. Be sure to clearly explain your problem, what you
29 1.1 reed tried, what results you had, and what you expected.
30 1.1 reed %
31 1.1 reed You can view your non-default Postfix settings with:
32 1.1 reed
33 1.1 reed postconf -n
34 1.1 reed %
35 1.1 reed To report about installed packages with known vulnerabilities,
36 1.1 reed fetch the latest pkg-vulnerabilities file as the superuser with:
37 1.1 reed
38 1.1 reed download-vulnerability-list
39 1.1 reed
40 1.1 reed And then run:
41 1.1 reed
42 1.1 reed audit-packages
43 1.1 reed %
44 1.1 reed The following shows an example of temporarily adding 10MB more swap
45 1.1 reed space for virtual memory:
46 1.1 reed
47 1.1 reed dd if=/dev/zero of=/root/swapfile bs=1024 count=10000
48 1.1 reed swapctl -a /root/swapfile
49 1.1 reed %
50 1.1 reed If your console ever gets broken, you can try resetting it to its
51 1.1 reed initial state with:
52 1.1 reed
53 1.1 reed printf "\033c
54 1.1 reed %
55 1.1 reed If you installed a package, but don't know what the software is
56 1.1 reed called or what executables, to run use the pkg_add with the -L
57 1.1 reed switch to list the package's files and search for /bin:
58 1.1 reed
59 1.1 reed pkg_add -L PACKAGE-NAME | grep /bin
60 1.1 reed %
61 1.1 reed A new user can be added by using the useradd tool with the -m switch
62 1.1 reed to create the home directory. Then set the password. For example:
63 1.1 reed
64 1.1 reed useradd -m susan
65 1.1 reed passwd susan
66 1.1 reed %
67 1.1 reed To modify user account information use the chpass or usermod tools.
68 1.1 reed If you need to edit the user database directly, use the vipw command.
69 1.1 reed %
70 1.1 reed You can temporarily start the SSH server by running the following
71 1.1 reed as root:
72 1.1 reed
73 1.1 reed /etc/rc.d/sshd onestart
74 1.1 reed %
75 1.1 reed Several IP Filter and ipnat examples are available in the
76 1.1 reed /usr/share/examples/ipf/ directory.
77 1.1 reed %
78 1.1 reed Want to dual boot using a bluetooth mouse or keyboard? Use btkey(1)
79 1.1 reed to store the link key in the hardware.
80 1.1 reed %
81 1.1 reed If you are having trouble connecting to a remote bluetooth device,
82 1.1 reed try the btconfig(8) inquiry command. The kernel will retain some
83 1.1 reed clock offset information that may help.
84 1.1 reed %
85 1.1 reed You can download files via HTTP using the ftp(1) command; for example:
86 1.1 reed
87 1.1 reed ftp http://www.NetBSD.org/images/NetBSD.png
88 1.1 reed %
89 1.1 reed The mtree(8) tool can be used to check permissions, ownerships,
90 1.1 reed file changes, and more when compared against a specification. For
91 1.1 reed example to check directory ownership and permissions for standard
92 1.1 reed NetBSD directories, run:
93 1.1 reed
94 1.1 reed /usr/sbin/mtree -e -p / -f /etc/mtree/NetBSD.dist
95 1.1 reed %
96 1.1 reed If you need reminders on your console to leave, use the leave(1)
97 1.1 reed tool. For example to receive reminders to leave in one hour:
98 1.1 reed
99 1.1 reed leave +0100
100 1.1 reed %
101 1.1 reed To stop non-superuser logins until next boot, as root:
102 1.1 reed
103 1.1 reed touch /etc/nologin
104 1.1 reed %
105 1.1 reed When extracting distribution tar sets, be sure to use the pax -pe
106 1.1 reed option or the tar -p switch to preserve the user and group and file
107 1.1 reed modes (including setuid and setgid). This is needed, for example,
108 1.1 reed so su(1) will work after extracting the base.tgz set.
109 1.1 reed %
110 1.1 reed Math can be done within the sh(1) and ksh(1) shells or with expr(1),
111 1.1 reed dc(1), bc(1), or awk(1). Here are some simple examples:
112 1.1 reed
113 1.1 reed echo $((431 * 79))
114 1.1 reed expr 60 \* 60 \* 24 \* 7
115 1.1 reed %
116