FreeBSD Commands

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue Jun 15 12:33:29 PDT 2004


On Tue, Jun 15, 2004 at 12:40:07PM -0600, Lloyd Hayes wrote:
> I have the FreeBSD Handbook on a computer hard drive. There isn't any 
> mention of the line commands that FreeBSD uses or recognizes in the 
> handbook. Where do I find these?

Yes.  The Handbook does assume that you are familiar with the basics
of the Unix environment.  Let's see.  Crash course in how to survive
Unix -- the University of Ohio has a well regarded course available on
line:

    http://wks.uts.ohio-state.edu/unix_course/unix.html

Other than that, all commands should have manual pages, which you can
display using the 'man' command. eg.

    % man ls

To find out about the man command, read its man page:

    % man man

Man pages are laid out according to a standard style -- eg. for
commands, first there's a very short and probably rather impenetrable
synopsis of how to use the command and various option arguments you
can give it.  Then there's a paragraph explaining what the command
does, followed by a detailed breakdown of all the different options.
Then there can be several different bits of stuff depending on the
nature of the command, culminating in a list of environment variables
used by the program (if any), a number of examples, references to the
man pages for related commands and a list of any known bugs in the
command.  Length varies from less than a page to getting on for book
length.

To try and find a command to do something, for example to copy a file,
use the '-k' option to man:

    % man -k copy

That will print out a list of all of the man pages on the system that
mention the word 'copy' in their titles, amongst which you will see a
reference to:

    cp(1)                    - copy files

Not that this is a quite limited technique: coming from a DOS
background you might reasonably expect there to be commands to delete
or rename a file.  Indeed there are, but named rm(1) (ie. ReMove) and
mv(1) (ie. MoVe) and you basically have to know that in order to find
the right command.

Now in that last paragraph I introduced a bit of unixiod jargon:
saying cp(1) is a reference to the man page for the cp command, which
is in section 1 of the manual.

You'll also note that the Unix environment does not go out of its way
to be helpful to complete beginners.  That's because you're only a
beginner at that sort of level for a couple of weeks, tops, and this
environment is designed for use day in, day out by people who know
what they're doing.  All those arcane looking two and three letter
commands (without vowels) really are easier to deal with when you are
typing fast.  Unix commands also tend to assume that you know what you
are doing and not ask you to confirm things -- mostly because that
means they can be used for running unattended and in scripts.  That
means if you tell your system to delete all the files in your home
directory, it will do so without question.

What are the absolute basic commands you have to know?  Something like
this:

    ls(1)    -- get a directory listing
    ls -l    -- get a long format directory listing

    pwd(1)   -- show your present working directory
    cd       -- change directory.  Note this is a shell builtin(1) rather
                than a standalone command

    cd ~     -- change directory to your accounts home directory

    mv(1)    -- rename files, move files into a different directory
    cp(1)    -- copy files
    rm(1)    -- delete files
    rm -r    -- delete a directory and all of its contents, recursively

    date(1)  -- show time and date
    time(1)  -- time how long a process takes to execute

    whoami(1) -- for the morning after a particularly wild party
    who(1)   -- who is logged into the system

    man(1)   -- read the system manual

    more(1)  -- page through a file
    ee(1)    -- easy editor
    vi(1)    -- difficult editor

    login(1) -- log into the system
    passwd(1) -- change your password
    exit     -- log out (
    logout   -- log out 
 
> I just received instructions to find and copy my X-configure file to a 
> different directory so that KDE would work. One problem. Under this file 
> system, I have no idea how to change directories using line commands. I 
> was sent the command for viewing the current directory, but I need the 
> syntax for changing to different directories, and for moving and 
> copying  files to different directories.
> 
> (If you did it every day, simply walking on Mars would be child's play.)

Absolutely.  I can hardly remember what it was like being a complete
beginner.  Don't worry -- stick with it for few weeks: keep
practicing, and it will get a lot easier.  Really.

	Cheers,

	Matthew

-- 
Dr Matthew J Seaman MA, D.Phil.                       26 The Paddocks
                                                      Savill Way
PGP: http://www.infracaninophile.co.uk/pgpkey         Marlow
Tel: +44 1628 476614                                  Bucks., SL7 1TH UK
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20040615/a9baa649/attachment.bin


More information about the freebsd-questions mailing list