Sei sulla pagina 1di 2

Login Command File : Bourne Shell

.profile

Sample contents

Frequently Used Unix Commands


Use lowercase letters. Multiple files for a command are separated by spaces.

PATH=/bin:/usr/bin:/usr/ucb:.
TERM=vt100
export TERM

File Handling

mail Initialisation File

.mailrc

vi Initialisation File:

.exrc

Useful Unix Utilities

Create files

pico, vi or emacs
cat >filename
cat /dev/null > filename

Unix editors
input from keyboard
create empty file

Destroy files

rm filename
rm -i filename

interactive delete

Display file contents

Copy files

more filename ...


cat filename ...
tail filename ...
head filename ...
cp original copyfile

Rename file

mv oldname newname

List files in directory

ls
ls -l [file1 file2 ..]

The following are popular and useful Unix utilities, worth further investigation.
grep
wc
diff
file
find
od
tee
ar
tar
stty
sort
pr
nohup
make
sccs
awk

Search files for strings


Count lines, words,characters
List differences between files
Identify file type
Locate file(s)
Octal dump
Captures data in pipe
Create library or archive
Tape handling
Set terminal characteristics
Sort file(s)
Paginate file(s)
Run program after logout
Manage software compilation
Manage software updates
String processing language

pausing after screenful


no pause
display end
display start

long listing

Change directory

cd
cd directory-name

goto home directory

Print current directory

pwd

Make a directory

mkdir

Destroy a directory

rmdir directory-name

must be empty

Help

man command

help on command

Date and time

date

Other users

who

users on system

Whats happening

ps

programs running

Change password

passwd

Information Commands

Communication Commands
Send a message

mail username

Read a message

mail

Interactive conversation

talk username
write username

Editing previous commands

Common vi Commands
To enter new text

a or i
Terminate with ESC
x
for single characters
dw
for words
dd
for lines
u
Arrow keys and others

To delete text

To undo last command


To move around
Quit and save the file
To quit without saving changes :
To search for text

refuse messages
informed on arrival

q!
/text-to-be-found

% mesg y
% biff n

accept messages
informed at login

command > filename


command < filename
command >&
filename
command 2>
filename

Pipes
% who | wc -l
% cc file.c |& more

record last 40 commands


display previous commands

Recall commands
% !4
% !c
% !!

alias Command
% alias
% alias
% alias

dir
h
ls

ls
history
/bin/ls -l

To undefine an alias:
% unalias dir

Repeat command 4
Repeat command starting with c
Repeat last command

path, term, cdpath, home


Listing Variable Values
% set
Setting Variables
Ctrl/D will not exit logout
Redirection will not overwrite .
(To force overwrite use : >! )

Bourne Shell Variables


PATH, HOME, TERM

Login Command File: C Shell

.login

Sample Contents:
setenv TERM vt100 Set terminal
stty erase '^?'
Use Del for delete
.cshrc

C Shell Features
% set history = 40
% history

%set prompt = ' ! % '

% set ignoreeof
% set noclobber

* character matches zero or more characters.


? character matches any single character.

Standard error through pipe (BSD):

Display command number with prompt

C Shell Variables

Filename Generation (wild card characters)

Input/Output Redirection
Redirect output
Redirect input
Redirect error stream C Shell
Bourne Shell

Replace old by new in last command.


As above for command 4

ZZ

mail, write, talk Settings


% mesg n
% biff y

% ^old ^new
% !4:s/old/new

executed when start a C shell

Sample contents:
set
set
set

prompt = '! % '


Change prompt
history=20
Remember 20 ccommands
path = ( /bin /usr/bin /usr/ucb .) Change search path

.logout contains command which are executed when you logout.

Potrebbero piacerti anche