Useful
Unix Commands & Utilities
Getting Started
1.1
Logging into the Unix System
To gain
access to Unix systems, you must go
through a login process. Usually this
is done by telnet-ing to a Unix system.
e.g. on a Windows 95 system with the
Internet package installed, at the
command prompt you type
c:\>telnet
telnet.netfront.net
the following
should appear on a pop-up screen:
Trying
202.81.252.254...
Connected to telnet.netfront.net.
Escape character is '^]'.
Linux 2.0.29 (telnet.netfront.net)
(ttyp0)
telnet login:
To log
into the system you simply type your
user name, and then press the carriage-return
key. Then type in your password, press
the RETURN key again. The UNIX system
prompt % will then appear.
1.2 Terminal
Type
You have
to set the correct terminal type for
the Unix system to display on your
window properly, this is done by setting
the term environmental variable. In
most cases, the following command
telnet-demo
10% set term=vt100
will be
okay.
1.3
Signing Off
Type
"logout" to
log out from UNIX.
1.4
Getting Help
In UNIX,
there are just too many commands which
make it difficult to remember all.
From time to time you will need to
refer to their help information or
manuals. You can access the manual
of any UNIX commands by using the
man command. E.g. to read the manual
for the man command itself, you type
telnet-demo
14% man man
Files
and Directories
Files and
Directories are organized in a tree
structure similar to DOS. The path
name separator is "/" instead of "\"
as in DOS.
2.1
Printing Working Directory with pwd
The full
pathname of the current directory
will be displayed.
DOS
counterpart: N/A
2.2
List Directory Contents with
ls
-a list
all files, including directories
and hidden files
-C list in column form
-d list status of directory (together
with -l)
-F show file type
-g list group
-l long listing
-r reverse order listing
-R recursive listing
-t on time sequence
DOS
counterpart: dir
2.3
Changing Working Directory with cd
cd alone
will bring you to the home directory
DOS
counterpart: cd
2.4
Looking at the Contents of a File
with cat
-b, -n
number the lines
-s substitute a single blank line
for multiple adjacent blank lines
-v display non-printable charaters
DOS
counterpart: type
2.5
Looking at the Content of a File with
more
telnet-demo
100% more /etc/motd
DOS
counterpart: more
2.6
Looking at the End of a File with
tail
telnet-demo
101% tail /etc/motd
DOS
counterpart: N/A
2.7
Copying File with cp
cp file1
file2
cp file dir
cp -r dir1 dir2
-i interactive
-p preserve modification time and
permissions
-r recursively coping files in subdirectories
DOS
counterpart: copy
2.8
Creating Directories with mkdir
DOS
counterpart: md
2.9
Moving and Renaming Files with mv
-i interactive
-f override any mode restriction
and -i option
DOS
counterpart: move
2.10
Removing Files with rm
-i interactive
-f force files to be removed
-r recursively remove files
DOS
counterpart: del
2.11
Removing Directories with rmdir
DOS
counterpart: rd
2.12
Ownership and Protection
The first
character of a directory listing with
the ls -l command indicates the file
type.
telnet-demo
122% ls ?/FONT>l
total
401
drwxr-x--- 2 demo 512 Apr 10 13:14
pub
-rwxr--r-- 1 demo 6442 Mar 24 21:00
README
-rwxr--r-- 1 demo 14 Apr 18 17:41
account.txt
-rwxr--r-- 1 demo 25293 Apr 23 19:53
log
d entry is a directory
- entry is a plain file
The next 9 characters designate
access permissions.
r the file is readable
w the file is writable
x the file is executable
- the indicated permission is not
granted
The chmod
command can be used to change the
file permissions.
owners
operator permission
u users + add r read
g group - subtract w write
o others = assign x execute
e.g.
telnet-demo 123% ls ?/FONT>l
README
-rwxr--r--
1 demo 6442 Mar 24 21:00 README
telnet-demo 124% chmod go+w README
telnet-demo 125% ls -l README
-rwxrw-rw- 1 demo 6442 Mar 24 21:00
README
The
Electronic Mail System
The following
are some the most popular e-mail programs
for sending and reading E-Mail, use
the man command to learn how to use
them.
mail
elm
pine
Text
Editing
vi
emacs
pico
Use the
man command to learn how to use them.
|