网络推荐



本广告位招租!

FreeBSD skills everyday

本文来自http://blog.kedy.cn/,不知多少人注意过,FreeBSD默认的登陆后的第一屏文字。除了上次登陆时间,IP,以及一些可以自定义的登陆信息外,还有一项很重要的就是,随机技巧提示功能。说起来也让我觉得汗颜,用BSD也3years+了,直到前段时间才认真的注意这个东东。于是再次感叹,生活不是缺少美,而是缺少发现。我们如果能对平常习以为常的人或事多一些关注,或许你会有意想不到的发现。
为了让自己能学习到更多的技巧,也为了我这曾经被自己忽视的发现。从今天开始,我将把这些技巧在这里以连载的形式做一个记录。希望能对我,也对来看我的博客的技术朋友有些帮助。
我也来说两句 查看全部回复

最新回复

  • 剑心通明 (2008-7-11 10:46:58)

    1:You can get a good standard workstation install by using the
    instant-workstation port/package.  If you have ports installed, you can
    install it by doing

            # cd /usr/ports/misc/instant-workstation
            # make install && make clean

    as root.  This will install a collection of packages that is convenient to
    have on a workstation.
  • 剑心通明 (2008-7-11 10:48:35)

    2:If you use the C shell, add the following line to the .cshrc file in your
    home directory to prevent core files from being written to disk:

            limit coredumpsize 0
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:48:56)

    3:Need to see which daemons are listening for connection requests? Use
    "sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:49:14)

    4:Want to know how many words, lines, or bytes are contained in a file? Type
    "wc filename".
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:49:34)

    5: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'.  You can also use 'M' for Megabytes or 'G' for
    Gigabytes.  If you want df(1) to automatically select the best size
    then use 'df -h'.
  • 剑心通明 (2008-7-11 10:49:52)

    6: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>
  • 剑心通明 (2008-7-11 10:50:17)

    7:To change an environment variable in /bin/sh use:

            $ VARIABLE="value"
            $ export VARIABLE
  • 剑心通明 (2008-7-11 10:50:36)

    8:Need to see the calendar for this month? Simply type "cal".  To see the
    whole year, type "cal -y".
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:50:53)

    9:To find out the hostname associated with an IP address, use

            dig -x IP_address
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:51:22)

    10: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.
  • 剑心通明 (2008-7-11 10:51:39)

    11: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'.
  • 剑心通明 (2008-7-11 10:51:55)

    12:Want to use sed(1) to edit a file in place?  Well, to replace every 'e' with
    an 'o', in a file named 'foo', you can do:

            sed -i.bak s/e/o/g foo

    And you'll get a backup of the original in a file named 'foo.bak', but if you
    want no backup:

            sed -i '' s/e/o/g foo
  • 剑心通明 (2008-7-11 10:52:11)

    13:Need to see your routing table? Type "netstat -rn". The entry with the G
    flag is your gateway.
                    -- Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:52:28)

    14: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.
  • 剑心通明 (2008-7-11 10:52:53)

    15:Need to remove all those ^M characters from a DOS file? Try

            tr -d \\r < dosfile > newfile
                    -- Originally by Dru <genesis@istar.ca>
  • 剑心通明 (2008-7-11 10:53:10)

    16:Need to see which daemons are listening for connection requests? Use
    "sockstat -4l" for IPv4, and "sockstat -l" for IPv4 and IPv6.
                    -- Dru <genesis@istar.ca>