// This code is copyrighted material owned by W. D. Bricker, doing business
// as US-Webmasters.com. Copyright 1998-2009 - All rights reserved.
//
// A single license for this code has been granted to
// US-Webmasters.com
//
// for use on site(s):
// US-Webmasters.com and related sites
//
// No other rights are implied nor shall be inferred. This code may
// not be altered, copied or distributed without express permission.
// Violation of these rights will necessitate legal remedial action.
// To get rid of "the Undefined variable: DOCUMENT_ROOT" error:
// The Root Directory:
// This worked in PHP4:
// $RootDir = $RootDir;
// This works in PHP5:
$RootDir = $_SERVER['DOCUMENT_ROOT'];
// $RootDir = $RootDir."/testing";
// Echo "DOCUMENT_ROOT: ".$RootDir."
\n";
// Echo "RootDir: ".$RootDir."
\n";
// We'll need access to the Global Variables:
// include_once("$DOCUMENT_ROOT/include/GlobalVars.php");
// To get rid of: Warning: include_once() [function.include-once]: Unable to access /include/GlobalVars.php in
include_once("$RootDir/include/GlobalVars.php");
// We will be accessing all sorts of functions:
//include_once("$DOCUMENT_ROOT/include/Functs.php");
include_once("$RootDir/include/Functs.php");
// Check to see if the visitor (USER_AGENT) is a spider. If not:
// then do a "session_start"...
// Creates a session or resumes the current one
// based on the current session id that's being passed via a
// request, such as GET, POST, or a COOKIE.
// It's necessary that this be the first PHP command in the file.
If (!ItsASpider())
{
session_start();
// Sets various session variables like ReferringURL and EntryURL
// if they haven't already been set
//include_once("$DOCUMENT_ROOT/include/SetSessionVars.php");
include_once("$RootDir/include/SetSessionVars.php");
}
// This turns on Output Buffering. This seems to be
// necessary because we may be redirecting to a "Thank You" page
// after they submit the form. Speeds things up because
// browser doesn't reload when hitting BACK button.
ob_start();
// PageNameStr - This is the dominant keyword phrase for the page.
// Goes in comments, header bars, IMAGE ALT tags, etc. Only about 10 words!
$PageNameStr="FreeBSD Shell Configuration";
// This is the first line string. It goes at the very top of the page.
// If this is NOT a doorway page, then set the $PageFirstLineStr:
// This is the first line string. It goes at the very top of the page.
// If this is NOT a doorway page, then set the $PageFirstLineStr:
// Notice: Undefined variable: ThisIsDoorway
// IF (!($ThisIsDoorway))
// If not set, then set it to get rid of error message:
If (!IsSet($ThisIsDoorway))
{$ThisIsDoorway=0;}
If ($ThisIsDoorway<>1)
{$PageFirstLineStr="FreeBSD Shell Configuration, Tutorial, Howto";}
// This is the first text after the first line,
// that usually shows up in the upper left corner
$PageFirstTextStr="${CompanyStr}
FreeBSD Shell Configuration";
// This is the second text after the first line,
// that usually shows up in the upper right corner
$PageSecondTextStr="${CompanyDomain}
FreeBSD Shell Configuration";
$PageTitleStr=$PageFirstLineStr;
$PageKeywordStr=$PageNameStr;
$PageCommentStr="FreeBSD Shell Configuration, Linux, Unix, Nix, Hard Disks, CD, CDROM, Floppy, Keyboard, Cheat Sheet for FreeBSD Installation, Configure, Options, Configuration, Howto, How To, Red Hat, FreeBSD";
// $PageDescriptionStr="";
// $PageRobotsStr="";
// If this is NOT a doorway page, then include header.php:
IF (!($ThisIsDoorway))
{ include_once("$RootDir/include/header-brief.php"); }
?>
/root/.cshrc
For your convenience, we have included the .cshrc
start up file
linked
here.Login:
root
cd /usr/ports/editors/pico/
make install
The process to install Pico will begin. It
will most likely try to download the source
code it needs from an
FTP
server. The file is about 4 MB, and you
should see a progress line indicating about how
long it will take to download.pkg_info | more
(The pipe character '|' is probably located on your
keyboard as the shifted version of the '\' key).shutdown -r now
pico
Ctrl-X
(Hold the 'Ctrl' key down, and simultaneously
press the 'X' key.)cd /root/
pwd
This command will give you the Present Working Directory
that you are located in.ls -lt
You should see .cshrc listed.
cp -p .cshrc .cshrc.1.bak
(That's the number 'one' not the letter 'ell')ls -lt
You should see both files, and they should have the
same size and date.pico .cshrc
You now see the contents of this file before you.
alias h history 25
Let's add 3 aliases by inserting the following lines:
# Change the 'rm' (remove) command to interactive mode for safety:
alias rm 'rm -i'
# Copy Interactively with a prompt before overwriting
alias cp 'cp -i'
# Move or Rename Interactively with a prompt before overwriting
alias mv 'mv -i'
The 'rm' command is extremely powerful. It will
ReMove files and directories very quickly and efficiently.
By forcing this command to work in the 'Interactive' mode,
(-i), you will have to confirm any deletions before rm
will proceed. Similarly, by adding '-i' to 'cp' and
'mv' they will be forced into interactive mode as well.
# LiSt files with Largest last:
alias lsl
'ls -ablprtFT | sort -n +4'
# LiSt files a page at a time with Largest shown first:
alias lslm
'ls -ablprtFT | sort -n +4 -r | more'
# LiSt files with Smallest shown last:
alias lss
'ls -ablprtFT | sort -n +4 -r'
# LiSt files a page at a time with the Smallest shown first:
alias lssm
'ls -ablprtFT | sort -n +4 | more'
# LiSt files with the newly modified (Time) shown last:
alias lst
'ls -ablprtFT'
# LiSt files a page at a time with the newly modified (Time) shown first:
alias lstm
'ls -ablptFT | more'
# LiSt files sorted by name:
alias lsn
'ls -ablptFT | sort +9'
# LiSt files a page at a time sorted by name:
alias lsnm
'ls -ablptFT | sort +9 | more'
alias h history 25
alias j jobs -l
Move them to just before this line:# a righteous umask
# Show the last 25 commands entered:
alias h 'history 25'
# Show the status of tasks that you typed in on the command line:
alias j 'jobs -l'
alias la ls -a
alias lf ls -FA
alias ll ls -lA
Let's add comments and tidy them up so that they look
like this:
# LiSt (a)ll files, even those that are hidden:
alias la 'ls -a'
# LiSt (A)ll files except for '.' & '..'; show (F)iletype symbol.
alias lf 'ls -FA'
# LiSt (A)ll files except for '.' & '..'; show in (l)ong format (wide).
alias ll 'ls -lA'
Alt-F2
(This means hold the Alt key down while simultaneously
pressing the 'F2' key.)cd /
pwd
This shows us the (p)resent (w)orking (d)irectory. It should
show:/
mkdir /floppy
cd /floppy
touch Floppy-NOT-mounted-mflop.txt
This creates a file that will show up if the
floppy disk is not mounted. By the way,
a removable drive like a floppy or CDROM needs
to 'mounted' before the operating system will
be able to use it. Also, the removable
drive will need to be unmounted before it
is removed from the computer.ls -lt
Alt-F1
# An alias for mounting a MS-DOS floppy disk:
alias mflop
'mount -t msdos /dev/fd0 /floppy'
# An alias for unmounting a floppy disk:
alias uflop
'umount /floppy'
mflop
Alt-F2
cd /
mkdir /cdrom
Now we are going to create a file that
will help us know if the CD is mounted.
Enter the following:cd /cdrom
touch CD-is-NOT-mounted-mcd.txt
Alt-F1
# An alias for mounting a CD-ROM disk:
alias mcd
'mount -t cd9660 /dev/acd0c /cdrom'
# An alias for unmounting a CD disk:
alias ucd
'umount /cdrom'
mcd
# Move UP one directory:
alias up 'cd ..'
# Move DowN to subdir:
alias dn 'cd ./\!*'
# Move OVer to different directory at same level:
alias ov 'cd ../\!*'
# Make a directory:
alias md 'mkdir'
# Make a directory, then go to it:
alias mdc
'mkdir \!* && cd \!*'
# Remove a directory:
alias rd 'rmdir'
# Remove a subdirectory and EVERYTHING that it contains, (i)nteractively:
alias treedel 'rm -dirv'
# Remove a subdirectory and EVERYTHING that it contains, WITHOUT PROMPTS:
alias treezap 'rm -dfrv'
# Show the last 25 commands entered:
alias h 'history 25'
# Show the status of tasks that you typed in on the command line:
alias j 'jobs -l'
# A righteous umask
umask 22
let's add this alias:
# Set up the 'cd' command to trigger a change in the command prompt:
alias cd
'chdir \!* && set prompt="`hostname -s` ${USER} `pwd` # "'
Note that there are three (3) types of quotation
marks being used in this line. The quote mark
just before 'chdir' and on the end are single
quote marks ('). The 'set prompt' command
is bounded on both sides by double quote marks
("). The 'back tick' quote marks
surround `hostname -s` and `pwd`. You should
be able to find the back tick on the same key
as the tilde (~) on your keyboard.
# An interactive shell -- set some stuff up
set prompt = "`hostname -s`# "
to:
# An interactive shell -- set some stuff up
set prompt = "`hostname -s` ${USER} `pwd` # "
setenv EDITOR vi
Change it to:setenv EDITOR pico
Ctrl-O
(That's the letter 'oh', not the number 'zero')Ctrl-X
cp -p .cshrc .cshrc.2.bak
shutdown -r +1
alias | more
/var/cron/tabs/
and has the exact name as the user. So, since
we are currently logged in as 'root', that is the
name of our file.cd /var/cron/tabs/
crontab -e -u root
Since we have set up our default editor to be pico, we
see a blank file show up.
#^^^^^^^The above comments were generated by 'crontab -e -u root' ^^^^^^^
# Crontab file created 200_ September 27, 23:45
#Min Hr
DOM Mnth
DOW command
# At 3:XX in the morning, everyday, as root, update the ports tree:
XX 3
* *
*
/usr/local/bin/cvsup -h cvsupZZ.FreeBSD.org
/usr/share/examples/cvsup/ports-supfile
#^^^^^^^The above comments were generated by 'crontab -e -u root' ^^^^^^^
# Crontab file created 200_ September 27, 23:45
#Min Hr
DOM Mnth
DOW command
# At 3:XX in the morning, everyday, as root, update the ports tree:
XX 3
* *
*
/usr/local/bin/cvsup
-h
cvsupZZ.FreeBSD.org
/usr/share/examples/cvsup/ports-supfile
Here is a
third
version in plain text formatCtrl-O
This will write 'O'ut the file to the diskCtrl-X