279 lines
10 KiB
Plaintext
279 lines
10 KiB
Plaintext
|
This fortune brought to you by:
|
||
|
$FreeBSD$
|
||
|
%
|
||
|
Having trouble using FTP through a firewall? Try setting the environment
|
||
|
variable FTP_PASSIVE_MODE to yes, and see ftp(1) for more details.
|
||
|
%
|
||
|
By pressing "Scroll Lock" you can use the arrow keys to scroll backward
|
||
|
through the console output. Press "Scroll Lock" again to turn it off.
|
||
|
%
|
||
|
Want colour in your directory listings? Use "ls -G". "ls -F" is also useful,
|
||
|
and they can be combined as "ls -FG".
|
||
|
%
|
||
|
If you need to ask a question on the FreeBSD-questions mailing list then
|
||
|
|
||
|
http://www.freebsd.org/doc/en_US.ISO8859-1/articles/\
|
||
|
freebsd-questions/index.html
|
||
|
|
||
|
contains lots of useful advice to help you get the best results.
|
||
|
%
|
||
|
If you'd like to keep track of applications in the FreeBSD ports tree, take a
|
||
|
look at FreshPorts;
|
||
|
|
||
|
http://www.freshports.org/
|
||
|
%
|
||
|
To search for files that match a particular name, use find(1); for example
|
||
|
|
||
|
find / -name "*GENERIC*" -ls
|
||
|
|
||
|
will search '/', and all subdirectories, for files with 'GENERIC' in the name.
|
||
|
-- Stephen Hilton <nospam@hiltonbsd.com>
|
||
|
%
|
||
|
In tcsh, you can `set autolist' to have the shell automatically show
|
||
|
all the possible matches when doing filename/directory expansion.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
You can `set autologout = 30' to have tcsh log you off automatically
|
||
|
if you leave the shell idle for more than 30 seconds.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
If you `set filec' (file completion) in tcsh and write a part of the
|
||
|
filename, pressing TAB will show you the available choices when there
|
||
|
is more than one, or complete the filename if there's only one match.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
You can press up-arrow or down-arrow to walk through a list of
|
||
|
previous commands in tcsh.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
You can disable tcsh's terminal beep if you `set nobeep'.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
If you `set watch (0 any any)' in tcsh, you will be notified when
|
||
|
someone logs in or out of your system.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
Nice tcsh prompt: set prompt = '%m %# '
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
Nice tcsh prompt: set prompt = '%n@%m%# '
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
Nice tcsh prompt: set prompt = '%n@%m:%~%# '
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
Nice tcsh prompt: set prompt = '%n@%m:%/%# '
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
Nice tcsh prompt: set prompt = '[%B%m%b] %B%~%b%# '
|
||
|
%
|
||
|
Simple tcsh prompt: set prompt = '%# '
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
If you want df(1) and other commands to display disk sizes in
|
||
|
kilobytes instead of 512-byte blocks, set BLOCKSIZE in your
|
||
|
environment to 'K'.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
To change an environment variable in tcsh you use: setenv NAME "value"
|
||
|
where NAME is the name of the variable and "value" its new value.
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
To change an environment variable in /bin/sh use:
|
||
|
|
||
|
$ VARIABLE="value"
|
||
|
$ export VARIABLE
|
||
|
-- Giorgos Keramidas <keramida@ceid.upatras.gr>
|
||
|
%
|
||
|
/etc/make.conf contains overrides to /etc/defaults/make.conf, which
|
||
|
controls the options used to compile software on this system.
|
||
|
%
|
||
|
To do a fast search for a file, try
|
||
|
|
||
|
locate filename
|
||
|
|
||
|
locate uses a database that is updated every saturday (assuming your computer
|
||
|
is running FreeBSD at the time) to quickly find files based on name only.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
In order to search for a string in some files, use 'grep' like this:
|
||
|
|
||
|
grep "string" filename1 [filename2 filename3 ...]
|
||
|
|
||
|
This will print out the lines in the files that contain the string. grep can
|
||
|
also do a lot more advanced searches - type 'man grep' for details.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can use the 'fetch' command to retrieve files over ftp or http.
|
||
|
|
||
|
fetch http://www.freebsd.org/index.html
|
||
|
|
||
|
will download the front page of the FreeBSD web site.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
In order to make fetch (the FreeBSD downloading tool) ask for
|
||
|
username/password when it encounter a password-protected web page, you can set
|
||
|
the environment variable HTTP_AUTH to 'basic:*'.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can permanently set environment variables for your shell by putting them
|
||
|
in a startup file for the shell. The name of the startup file varies
|
||
|
depending on the shell - csh and tcsh uses .cshrc, bash uses .bashrc, zsh uses
|
||
|
.zshrc, ksh uses .kshrc, and the Bourne shell (/bin/sh) uses .profile (and
|
||
|
through a little bit of trickery in .profile also .shrc)
|
||
|
Other shells will often also read .profile
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you are running xterm, the default TERM variable will be 'xterm'. If you
|
||
|
set this environment variable to 'xterm-color' instead, a lot of programs will
|
||
|
use colors. You can do this by
|
||
|
|
||
|
TERM=xterm-color; export TERM
|
||
|
|
||
|
in Bourne-derived shells, and
|
||
|
|
||
|
setenv TERM xterm-color
|
||
|
|
||
|
in csh-derived shells.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you accidently drop into /bin/sh (e.g, due to a computer failure where you
|
||
|
end up in single user mode), you can make the cursor keys work by typing
|
||
|
|
||
|
set -E
|
||
|
|
||
|
The E represents the initial E in Emacs (for emacs keys).
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you do not want to get beeps in X11 (X Windows), you can turn them off with
|
||
|
|
||
|
xset b off
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can look through a file in a nice text-based interface by typing
|
||
|
|
||
|
less filename
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
The default editor in FreeBSD is vi, which is efficient to use when you have
|
||
|
learned it, but somewhat user-unfriendly. To use ee (an easier but less
|
||
|
powerful editor) instead, set the environment variable EDITOR to /usr/bin/ee
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you accidently end up inside vi, you can quit it by pressing Escape, colon
|
||
|
(:), q (q), bang (!) and pressing return.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can use aliases to decrease the amount of typing you need to do to get
|
||
|
commands you commonly use. Examples of fairly popular aliases include (in
|
||
|
bourne shell style, as in /bin/sh, bash, ksh, and zsh):
|
||
|
|
||
|
alias lf="ls -FA"
|
||
|
alias ll="ls -lA"
|
||
|
alias su="su -m"
|
||
|
|
||
|
In csh or tcsh, these would be
|
||
|
|
||
|
alias lf ls -FA
|
||
|
alias ll ls -lA
|
||
|
alias su su -m
|
||
|
|
||
|
To remove an alias, you can usually use 'unalias aliasname'. To list all
|
||
|
aliases, you can usually type just 'alias'.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
In order to support national characters for european languages in tools like
|
||
|
less without creating other nationalisation aspects, set the environment
|
||
|
variable LC_ALL to 'en_US.ISO8859-1'.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can search for documentation on a keyword by typing
|
||
|
|
||
|
apropos keyword
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
Man pages are divided into section depending on topic. There are 9 different
|
||
|
sections numbered from 1 (General Commands) to 9 (Kernel Developer's Manual).
|
||
|
You can get an introduction to each topic by typing
|
||
|
|
||
|
man <number> intro
|
||
|
|
||
|
In other words, to get the intro to general commands, type
|
||
|
|
||
|
man 1 intro
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
FreeBSD is started up by the program 'init'. The first thing init does when
|
||
|
starting multiuser mode (ie, starting the computer up for normal use) is to
|
||
|
run the shell script /etc/rc. By reading /etc/rc, you can learn a lot about
|
||
|
how the system is put together, which again will make you more confident about
|
||
|
what happens when you do something with it.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you want to play CDs with FreeBSD, a utility for this is already included.
|
||
|
Type 'cdcontrol' then 'help' to learn more. (You may need to set the CDROM
|
||
|
environment variable in order to make cdcontrol want to start.)
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
If you have a CD-ROM drive in your machine, you can make the CD-ROM that is
|
||
|
presently inserted available by typing 'mount /cdrom' as root. The CD-ROM
|
||
|
will be available under /cdrom/. Remember to do 'unmount /cdrom' before
|
||
|
removing the CD-ROM (it will usually not be possible to remove the CD-ROM
|
||
|
without doing this.)
|
||
|
|
||
|
Note: This tip may not work in all configurations.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
You can install extra packages for FreeBSD by using the ports system.
|
||
|
If you have installed it, you can download, compile, and install software by
|
||
|
just typing
|
||
|
|
||
|
# cd /usr/ports/<category>/<portname>
|
||
|
# make install && make clean
|
||
|
|
||
|
as root. The ports infrastructure will download the software, change it so
|
||
|
it works on FreeBSD, compile it, install it, register the installation so it
|
||
|
will be possible to automatically uninstall it, and clean out the temporary
|
||
|
working space it used. You can remove an installed port you decide you do not
|
||
|
want after all by typing
|
||
|
|
||
|
# cd /usr/ports/<category>/<portname>
|
||
|
# make deinstall
|
||
|
|
||
|
as root.
|
||
|
-- Eivind Eklund <eivind@FreeBSD.org>
|
||
|
%
|
||
|
Nice bash prompt: PS1='(\[$(tput md)\]\t <\w>\[$(tput me)\]) $(echo $?) \$ '
|
||
|
-- Mathieu <mathieu@hal.interactionvirtuelle.com>
|
||
|
%
|
||
|
To see the output from when your computer started, run dmesg(8). If it has
|
||
|
been replaced with other messages, look at /var/run/dmesg.boot.
|
||
|
-- Francisco Reyes <lists@natserv.com>
|
||
|
%
|
||
|
You can use "whereis" to locate standard binary, manual page and source
|
||
|
directories for the specified programs. This can be particularly handy
|
||
|
when you are trying to find where in the ports tree an application is.
|
||
|
|
||
|
Try "whereis netscape" and "whereis whereis".
|
||
|
-- Konstantinos Konstantinidis <kkonstan@duth.gr>
|
||
|
%
|
||
|
You can press Ctrl-D to quickly exit from a shell, or logout from a
|
||
|
login shell.
|
||
|
-- Konstantinos Konstantinidis <kkonstan@duth.gr>
|
||
|
%
|
||
|
You can use "pkg_info" to see a list of packages you have installed.
|
||
|
-- Konstantinos Konstantinidis <kkonstan@duth.gr>
|
||
|
%
|
||
|
You can change the video mode on all consoles by adding something like
|
||
|
the following to /etc/rc.conf:
|
||
|
|
||
|
allscreens="80x30"
|
||
|
|
||
|
You can use "vidcontrol -i mode | grep T" for a list of supported text
|
||
|
modes.
|
||
|
-- Konstantinos Konstantinidis <kkonstan@duth.gr>
|
||
|
%
|
||
|
Any user that is a member of the wheel group can use "su -" to simulate
|
||
|
a root login. You can add a user to the wheel group by editing /etc/group.
|
||
|
-- -- Konstantinos Konstantinidis <kkonstan@duth.gr>
|