Skip to content

Instantly share code, notes, and snippets.

@grahamperrin
Last active June 9, 2024 14:03
Show Gist options
  • Save grahamperrin/83fa2bd1f3dbf32fa8019ec04f810c6e to your computer and use it in GitHub Desktop.
Save grahamperrin/83fa2bd1f3dbf32fa8019ec04f810c6e to your computer and use it in GitHub Desktop.
FreeBSD environments miscellany

Miscellaneous notes on my FreeBSD environments

/etc/csh.cshrc

#
# System-wide .cshrc file for csh(1).

setenv PATH /usr/local/libexec/ccache:$PATH
setenv CCACHE_PATH /usr/bin:/usr/local/bin
setenv CCACHE_DIR "/usr/.ccache"
setenv EDITOR /usr/local/bin/nano
setenv VISUAL /usr/local/bin/nano
alias ls ls --color=always

/etc/profile

# grep -v \# /etc/profile
export EDITOR=/usr/local/bin/nano
export VISUAL=/usr/local/bin/nano
export TERM=xterm-256color
export PATH=/usr/local/libexec/ccache:$PATH
export CCACHE_PATH=/usr/bin:/usr/local/bin
…

/root/.profile

# whoami
root
# grep -v \# ~/.profile
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:~/bin
export PATH
HOME=/root
export HOME
PAGER=less
export PAGER
ENV=$HOME/.shrc; export ENV
# 

/root/.cshrc

# whoami
root
# cat ~/.cshrc
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#

alias h         history 25
alias j         jobs -l
alias la        ls -aF
alias lf        ls -FA
alias ll        ls -lAF

# read(2) of directories may not be desirable by default, as this will provoke
# EISDIR errors from each directory encountered.
# alias grep    grep -d skip

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin)

# setenv        EDITOR  /usr/bin/vi
# setenv        VISUAL  /usr/bin/vi
setenv  PAGER   less

# 2021-04-21 xterm1 <https://photos.app.goo.gl/wEY24PFB4ytep42E9>
# setenv        TERM    xterm1
# 2021-04-21 no entry for terminal type "xterm-256"
# setenv        TERM    xterm-256

# setenv        TERM    vt200
# setenv        TERM    xterm
setenv  TERM    xterm-256color

if ($?prompt) then
        # An interactive shell -- set some stuff up
        set prompt = "%N@%m:%~ %# "
        set promptchars = "%#"

        set filec
        set history = 2000
        set savehist = (2000 merge)
        set autolist = ambiguous
        # Use history to aid expansion
        set autoexpand
        set autorehash
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
#               bindkey '\e[1~'         beginning-of-line
#               bindkey '\e[4~'         end-of-line
                bindkey '\e[3~'         delete-char
#               bindkey '\e[5~'         beginning-of-history
#               bindkey '\e[6~'         end-of-history
#               bindkey '\e[2~'         quoted-insert
#               bindkey '\e[5C'         forward-word
#               bindkey '\e[5D'         backward-word
                bindkey '\e[1;5C'       forward-word
                bindkey '\e[1;5D'       backward-word

        endif

endif
# 

~/.profile

% whoami
grahamperrin
% grep -v \# ~/.profile
BLOCKSIZE=M;    export BLOCKSIZE
EDITOR=/usr/local/bin/nano;     export EDITOR
VISUAL=/usr/local/bin/nano;     export VISUAL
ENV=$HOME/.shrc; export ENV
if [ -x /usr/bin/resizewin ] ; then /usr/bin/resizewin -z ; fi
if [ -x /usr/bin/fortune ] ; then /usr/bin/fortune freebsd-tips ; fi
% 

~/.cshrc

% whoami
grahamperrin
% cat ~/.cshrc
# $FreeBSD: head/share/skel/dot.cshrc 337497 2018-08-08 19:24:20Z asomers $
#
# .cshrc - csh resource script, read at beginning of execution by each shell
#
# see also csh(1), environ(7).
# more examples available at /usr/share/examples/csh/
#

alias h         history 25
alias j         jobs -l
alias la        ls -aF
alias lf        ls -FA
alias ll        ls -lAF
alias ft        'cat /usr/share/games/fortune/freebsd-tips | grep '
# complete ft   'cat /usr/share/games/fortune/freebsd-tips | grep '

# These are normally set through /etc/login.conf.  You may override them here
# if wanted.
set path = (/sbin /bin /usr/sbin /usr/bin /usr/local/sbin /usr/local/bin $HOME/bin $HOME/.local/bin)
setenv  BLOCKSIZE       M
# A righteous umask
# umask 22

setenv  EDITOR  /usr/local/bin/nano
setenv  VISUAL  /usr/local/bin/nano
# setenv        PAGER   less
# setenv        PAGER   more
# 
# 2021-03-25 ""
# setenv        TERM    xterm1

if ($?prompt) then
        # An interactive shell -- set some stuff up
#       set prompt = "%N@%m:%~ %# "
        set prompt = "%# "
        set promptchars = "%#"

        set filec
        set history = 1000
        set savehist = (1000 merge)
        set autolist = ambiguous
        # Use history to aid expansion
        set autoexpand
        set autorehash
        set mail = (/var/mail/$USER)
        if ( $?tcsh ) then
                bindkey "^W" backward-delete-word
                bindkey -k up history-search-backward
                bindkey -k down history-search-forward
        endif

endif

setenv XIM ibus
setenv GTK_IM_MODULE ibus
setenv QT_IM_MODULE ibus
setenv XMODIFIERS @im=ibus
setenv XIM_PROGRAM ibus-daemon
setenv XIM_ARGS "--daemonize --xim"
% 
@grahamperrin
Copy link
Author

grahamperrin commented Mar 21, 2021

Note to self: https://cgit.freebsd.org/src/log/?qt=grep&q=terminfo&h=main 2021-03 commits in particular …

@grahamperrin
Copy link
Author

Note to readers: E&OE.

Whilst I don't intend to update this gist – it served its purpose, for me, for a while – I might do so if an error is reported (in commentary).

@grahamperrin
Copy link
Author

grahamperrin commented Sep 12, 2022

In a helloSystem context (root login disabled by design), the requirement to use sudo(8) created a problem with freebsd-update(8): https://www.reddit.com/r/freebsd/comments/xbycd8/-/io2fofz/

@grahamperrin
Copy link
Author

Side note: /.cshrc no longer exists.

freebsd/freebsd-src@dcb65c5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment