Posts Tagged ‘skills’

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>

Need to remove all those ^M characters from a DOS file? Try
        tr -d \r < dosfile > newfile
                — Originally by Dru <genesis@istar.ca>

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 [...]

Need to see your routing table? Type "netstat -rn". The entry with the G
flag is your gateway.
                — Dru <genesis@istar.ca>

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

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 [...]

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.

To find out the hostname associated with an IP address, use
        dig -x IP_address
                — Dru <genesis@istar.ca>

Need to see the calendar for this month? Simply type "cal".  To see the
whole year, type "cal -y".
                — Dru <genesis@istar.ca>

To change an environment variable in /bin/sh use:
        $ VARIABLE="value"
        $ export VARIABLE