Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Environment Control: Command Description

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 22

Environment Control

Command Description

cd d Change to directory d

mkdir d Create new directory d

rmdir d Remove directory d

mv f1 [f2...] d Move file f to directory d

mv d1 d2 Rename directory d1 as d2

passwd Change password

alias name1 name2 Create command alias (csh/tcsh)

alias name1="name2" Create command alias (ksh/bash)

unalias name1[na2...] Remove command alias na

ssh nd Login securely to remote node

exit End terminal session

sentenv name v Set env var to value v (csh/tcsh)

export name="v" set environment variable to value v


(ksh/bash)

Output, Communication, & Help


Command Description

lpr -P printer f
or
lp -d printer f Output file f to line printer

script [f] Save terminal session to f

exit Stop saving terminal session

mailx username Send mail to user

man name Unix manual entry for name

Process Control
Command Description
CTRL/c * Interrupt processes

CTRL/s * Stop screen scrolling

CTRL/q * Resume screen output

sleep n Sleep for n seconds

jobs Print list of jobs

kill % Kill job n

ps Print process status stats

kill -9 n Remove process n

CTRL/z * Suspend current process

stop %n Suspend background job n

cmmd& Run cmmd in background

bg [%n] Resume background job n

fg [%n] Resume foreground job n

exit Exit from shell

Environment Status
Command Description

ls [d] [f...] List files in directory

ls -1 [f...] List files in detail

alias [name] Display command aliases

printenv [name] Print environment values

quota Display disk quota

date Print date & time

who List logged in users

whoami Display current user

finger [username] Output user information

chfn Change finger information

pwd Print working directory

history Display recent commands


! n Submit recent command n

File Manipulation
Command Description

vi [f] Vi fullscreen editor

emacs [f] Emacs fullscreen editor

ed [f] Text editor

wc f Line, word, & char count

cat f List contents of file

more f List file contents by screen

cat f1 f2 >f3 Concatenates f1 & f2 into f3

chmod mode f Change protection mode of f

cmp f1 f2 Compare two files

cp f1 f2 Copy file f1 into f2

sort f Alphabetically sort f

split [-n] f Split f into n-line pieces

mv f1 f2 Rename file f1 as f2

rm f Delete (remove) file f

grep 'ptn' f Outputs lines that match ptn

diff f1 f2 Lists file differences

head f Output beginning of f

tail f Output end of f

Compiler
Command Description

cc [-o f1] f2 C compiler

lint f Check C code for errors

f77 [-o f1] f2 Fortran77 compiler


pc [-o f1] f2 Pascal compiler

Working with NFS files


Files saved on the UITS central Unix computers Steel, the Parallel PC cluster,
Solar/Lunar, and the Research SP are stored on the Network File Server (NFS). That
means that your files are really on one disk, in directories named for the central Unix
hosts on which you have accounts.
No matter which of these computers you are logged into, you can get to your files on any
of the others. Here are the commands to use to get to any system directory from any
other system:
cd /N/u/username/PPPC/
cd /N/u/username/Cobalt/
cd /N/u/username/Solar/
cd /N/u/username/Steel/
cd /n/u/username/SP/
Be sure you use the capitalization just as you see above, and substitute your own
username for "username".
For example, if Jessica Rabbit is logged into her account on Steel, and wants to get a file
on her SP account, she would enter:
cd /N/u/jrabbit/SP/
Now when she lists her files, she'll see her SP files, even though she's actually logged
into Steel.
You can use the ordinary Unix commands to move files, copy files, or make symbolic
links between files. For example, if Jessica Rabbit wanted to move "file1" from her Steel
directory to her SP directory, she would enter:
mv -i /N/u/jrabbit/Steel/file1 /N/u/jrabbit/SP/
This shared file system means that you can access, for example, your SP files even when
you are logged into Steel, and vice versa. However, if you are logged into the SP, you
can only use the software installed on SP -- only users' directories are linked together, not
system directories.

Abbreviations used in this document


CTRL/x hold down control key and press x

d directory

env environment

f filename

n number

nd computer node

prtr printer
ptn pattern

var variable

[y/n] yes or no

[] optional arg

... list
#######################################################################

ftp (host) ......... connects to a FTP site


archie (filename) .. search the Archie database for a file on a FTP site
irc ................ connect to Internet Relay Chat
lynx ............... a textual World Wide Web browset
gopher ............. a Gopher database browser
tin, trn ........... read Usenet newsgroups

passwd ............. change your password


chfn ............... change your "Real Name" as seen on finger
chsh ............... change the shell you log into

grep ............... search for a string in a file


tail ............... show the last few lines of a file
who ................ shows who is logged into the local system
w .................. shows who is logged on and what they're doing
finger (emailaddr).. shows more information about a user
df ................. shows disk space available on the system
du ................. shows how much disk space is being used up by folders
chmod .............. changes permissions on a file
bc ................. a simple calculator

make ............... compiles source code


gcc (file.c) ....... compiles C source into a file named 'a.out'

gzip ............... best compression for UNIX files


zip ................ zip for IBM files
tar ................ combines multiple files into one or vice-versa
lharc, lzh, lha .... un-arc'ers, may not be on your system

Comprehensive Linux FAQ with Answers


UNIX Command Summary

access()
Used to check the accessibility of files
int
Access(pathname, access_mode)
Char* pathname;
int access-mode;
The access modes are.
04 read
02 write
01 execute (search)
00 checks existence of a file 
& operator
execute a command as a background process.
banner
prints the specified string in large letters. Each argument may be upto 10 characters
long.
break
is used to break out of a loop. It does not exit from the program.
Cal
Produces a calender of the current month as standard output. The month (1-12) and
year (1-9999) must be specified in full numeric format.
Cal [[ month] year]
Calendar
Displays contents of the calendar file
case operator 
The case operator is used to validate multiple conditions.
Case $string in
Pattern 1)
Command list;;
Command list;;
Pattern 3)
Command list;;
easc
 
cat
(for concatenate) command is used to display the contents of a file. Used without
arguments it takes input from standard input <Dtrl d> is used to terminate input.
cat [filename(s)]
cat > [filename]
Data can be appended to a file using >>
Some of the available options are :
Cat [-options] filename(S)
-s silent about files that
cannot be accessed
-v enables display of non printinging characters (except tabs, new lines, form-
feeds)
-t when used with –v, it causes tabs to be printed as ^I’s
-e when used with –v, it causes $ to be printed at the end of each line
 
The –t and –e options are ignored if the –v options is not specified.
cd
Used to change directories
chgrp
Changes the group that owns a file.
Chgrp [grou –id] [filename]
chmod
Allows file permissions to be changed for each user. File permissions can be changed
only by the owner (s).
Chmod [+/-][rwx] [ugo] [filename]
chown
Used to change the owner of a file.
The command takes a file(s) as source files and the login id of another user as the
target.
Chown [user-id] [filename]
cmp
The cmp command compares two files (text or binary) byte-by-byte and displays the
first occurrence where the files differ.
Cmp [filename1] [filename2]
-1 gives a long listing
comm.
The comm command compares two sorted files and displays the instances that are
common. The display is separated into 3 columns.
Comm. filename1 filename2
first displays what occurs in first files but not in the second
second displays what occurs in second file but not in first
third displays what is common in both files
continue statement
The rest of the commands in the loop are ignored. It moves out of the loop and moves
on the next cycle.
cp
The cp (copy) command is used to copy a file.
Cp [filename1] [filename2]
cpio(copy input/output)
Utility program used to take backups.
Cpio operates in three modes:
-o output
-i input
-p pass
creat()
the system call creates a new file or prepares to rewrite an existing file. The file pointer
is set to the beginning of file.
#include<sys/tyes.h>
#include<sys/stat.h>
int creat(path, mode)
char *path;
int mode;
cut
used to cut out parts of a file. It takes filenames as command line arguments or input
from standard input. The command can cut columns as well as fields in a file. It
however does not delete the selected parts of the file.
Cut [-ef] [column/fie,d] filename
Cut-d “:” –f1,2,3 filename
Where –d indicates a delimiter specified within “:”
df
used to find the number of free blocks available for all the mounted file systems.
#/etc/df [filesystem]
diff
the diff command compares text files. It gives an index of all the lines that differ in the
two files along with the line numbers. It also displays what needs to be changed.
Diff filename1 filename2
echo
The echo command echoes arguments on the command line.
echo [arguments]
env
Displays the permanent environment variables associated with a user’s login id
exit command
Used to stop the execution of a shell script.
expr command
Expr (command) command is used for numeric computation.
The operators + (add), -(subtract), *(multiplu), /(divide), (remainder) are allowed.
Calculation are performed in order of normal numeric precedence.
find
The find command searches through directories for files that match the specified
criteria. It can take full pathnames and relative pathnames on the command line.
To display the output on screen the –print option must be specified
for operator
The for operator may be used in looping constructs where there is repetitive execution
of a section of the shell program.
For var in vall val2 val3 val4;
Do commnds; done
fsck
Used to check the file system and repair damaged files. The command takes a device
name as an argument
# /etc/fsck /dev/file-system-to-be-checked.
grave operator
Used to store the standard the output of a command in an enviroment variable. (‘)
grep
The grep (global regular expression and print) command can be used as a filter to
search for strings in files. The pattern may be either a fixed character string or a
regular expression.
Grep “string” filename(s)
HOME
User’s home directory
if operator
The if operator allows conditional operator
If expression; then commands; fi
if … then…else… fi
$ if; then
commands
efile; then
commands
fi
 
kill
used to stop background processes
in
used to link files. A duplicate of a file is created with another name
LOGNAME
displays user’s login name
ls
Lists the files in the current directory
Some of the available options are:
-l gives a long listing
-a displays all file{including hidden files
lp 
used to print data on the line printer.
Lp [options] filename(s)
mesg 
The mesg command controls messages received on a terminal.
-n does not allow messages to be displayed on screen
-y allows messages to be displayed on screen
mkdir 
used to create directories
more
The more command is used to dispay data one screenful at a time .
More [filename]
mv
Mv (move) moves a file from one directory to another or simply changes filenames.
The command takes filename and pathnames as source names and a filename or
exiting directory as target names.
mv [source-file] [target-file]
news
The news command allows a user to read news items published by the system
administrator.
ni
Displays the contents of a file with line numbers
passwd
Changes the password
paste
The paste command joins lines from two files and displays the output. It can take a
number of filenames as command line arguments.
paste file1 file2
PATH
The directories that the system searches to find commands
pg 
Used to display data one page (screenful) at a time. The command can take a number
of filenames as arguments.
Pg [option] [filename] [filename2]…..
pipe
Operator (1) takes the output of one commands as input of another command.
ps
Gives information about all the active processes.
PS1
The system prompt
pwd
(print working directory) displays the current directory.
rm
The rm (remove) command is used to delete files from a directory. A number of files
may be deleted simultaneously. A file(s) once deleted cannot be retrieved.
rm [filename 1] [filename 2]…
sift command 
Using shift $1becomes the source string and other arguments are shifted. $2 is shifted
to $1,$3to $2 and so on.
Sleep
The sleep command is used to suspend the execution of a shell script for the specified
time. This is usually in seconds.
sort
Sort is a utility program that can be used to sort text files in numeric or alphabetical
order
Sort [filename]
split
Used to split large file into smaller files
Split-n filename
Split can take a second filename on the command line.
su
Used to switch to superuser or any other user.
sync
Used to copy data in buffers to files
system0
Used to run a UNIX command from within a C program
tail
The tail command may be used to view the end of a file.
Tail [filename]
tar 
Used to save and restore files to tapes or other removable media.
Tar [function[modifier]]
[filename(s)]
tee
output that is being redirected to a file can also be viewed on standard output.
test command 
It compares strings and numeric values.
The test command has two forms : test command itself
If test ${variable} = value then
Do commands else do commands
File
The test commands also uses special operators [ ]. These are operators following the
of are interpreted by the shell as different from wildcard characters.
Of [ -f ${variable} ]
Then
Do commands
Elif
[ -d ${variable} ]
then
do commands
else
do commands
fi
 
many different tests are possible for files. Comparing numbers, character strings,
values of environment variables.
time
Used to display the execution time of a program or a command. Time is reported in
seconds.
Time filename values
tr
The tr command is used to translate characters.
tr [-option] [string1 [string2]]
tty
Displays the terminal pathname
umask
Used to specify default permissions while creating files.
uniq 
The uniq command is used to display the uniq(ue) lines in a sorted file.
Sort filename uniq
until
The operator executes the commands within a loop as long as the test condition is
false.
wall
Used to send a message to all users logged in.
# /etc/wall message
wait 
the command halts the execution of a script until all child processes, executed as
background processes, are completed.
wc
The wc command can be used to count the number of lines, words and characters in a
fine.
wc [filename(s)]
The available options are: 
wc –[options] [filename]
-1
-w
-c
while operator
the while operator repeatedly performs an operation until the test condition proves
false.
$ while
Ø      do
commands
Ø      done
who
displays information about all the users currently logged onto the system. The user
name, terminal number and the date and time that each user logged onto the system.
The syntax of the who command is who [options]
write
The write command allows inter-user communication. A user can send messages by
addressing the other user’s terminal or login id.
write user-name [terminal number]

Introduction
The find command allows the Unix user to process a set of files and/or directories in a
file subtree.
You can specify the following:
 where to search (pathname)

 what type of file to search for (-type: directories, data files, links)

 how to process the files (-exec: run a process against a selected file)

 the name of the file(s) (-name)

 perform logical operations on selections (-o and -a)

Search for file with a specific name in a set of files (-name)


find . -name "rc.conf" -print
This command will search in the current directory and all sub directories for a file named
rc.conf.
Note: The -print option will print out the path of any file that is found with that name. In
general -print wil print out the path of any file that meets the find criteria.
How to apply a unix command to a set of file (-exec).
find . -name "rc.conf" -exec chmod o+r '{}' \;
This command will search in the current directory and all sub directories. All files named
rc.conf will be processed by the chmod -o+r command. The argument '{}' inserts each
found file into the chmod command line. The \; argument indicates the exec command
line has ended.
The end results of this command is all rc.conf files have the other permissions set to read
access (if the operator is the owner of the file).
How to apply a complex selection of files (-o and -a).
find /usr/src -not \( -name "*,v" -o -name ".*,v" \) '{}' \; -print
This command will search in the /usr/src directory and all sub directories. All files that
are of the form '*,v' and '.*,v' are excluded. Important arguments to note are:
 -not means the negation of the expression that follows

 \( means the start of a complex expression.

 \) means the end of a complex expression.

 -o means a logical or of a complex expression.


In this case the complex expression is all files like '*,v' or '.*,v'
The above example is shows how to select all file that are not part of the RCS system.
This is important when you want go through a source tree and modify all the source
files... but ... you don't want to affect the RCS version control files.
How to search for a string in a selection of files (-exec grep ...).
find . -exec grep "www.athabasca" '{}' \; -print
This command will search in the current directory and all sub directories. All files that
contain the string will have their path printed to standard output.
If you want to just find each file then pass it on for processing use the -q grep option.
This finds the first occurrance of the search string. It then signals success to find and find
continues searching for more files.
find . -exec grep -q "www.athabasca" '{}' \; -print
This command is very important for process a series of files that contain a specific string.
You can then process each file appropriately. An example is find all html files with the
string "www.athabascau.ca". You can then process the files with a sed script to change
those occurrances of "www.athabascau.ca" with "intra.athabascau.ca".
Advanced Unix Commands

ACCTCOM
See the commands of all users acctcom | tail -20
See the commands of a particual user acctcom -u <username> | tail -20
Show entries for a specific commandpattern acctcom -n <pattern> | tail -20
Show all entries for commands staring with "l" acctcom -n '^l' | tail -30
Swho the output in reverse order acctom -b | more
AGREP
Find words with possible misspellings (here 2) agrep -2 'macropperswan' <file>
AT
Execute a command once in the future at now + 5 days < scriptfile
AWK
Take first column of a file awk '{print $1}' <file>
Take first two colums inverted awk '{print $2,"\t",$1}' <file>
Print sum of first two colums awk '{print $1 + $2}' <file>
Find lines with "money" and print last column awk '/money/ {print $NF}' <file>
Find lines with "money" in second column awk '$2 ~ /money/ {print $0}' <file>
Find lines without "A" at end of 3-rd column awk '$3 !~ /A$/ {print $0}' <file>
For awk programming structures see separate
Per Kistlers Awk page
page
BASH
Bourne again shell. Best interaktive shell right after zsh
BC
Calculate sin(5) echo 's(5)' | bc -l
BG
Put last stopped job into the background bg
BREAK
Leave the inermost loop (while/until/for) break
CANCEL
Stop a print job allready started cancel <jobid> ( as found with lpstat -o)
CASE in ESAC
Selective structure in sh/bash/ksh
CC
Compile a file.c cc -o <outfile> <infile>
CHGRP
Change group of a file chgrp <newgroupname> <file>
CHOWN
Change owner of a file chown <newowner> <file>
CMP
Act on the difference of two files cmp <file1> <file2> || <command>
COL
Printing the man pages without thousand "^H" man <command> | col -b | <printcommand>
CRONTAB
See your crontab file crontab -l
Edit your crontab file crontab -e
Every monday on 05:10 do /home/fred/foo.ksh 10 5 * * 1 /home/fred/foo.ksh
CRYPT
Encrypt a file with a password crypt password < infile > cryptfile
Decrypt the above file crypt password < cryptfile > cleanfile
CSH
Oldest Berkly shell
CUT
Get the hostname field from the last output last | cut -c11-40
DATE
Set the date (root only) date <mmddhhmm>
Special format of date (e.g. month only) date +%m
DF
See the used space of the disks in kB df -k
DIRCMP
Compare two directories dircmp <dir1> <dir2>
DTKSH
dtksh is a ksh93 with X11 graphics dtksh
DU
du = diskusage du -ks
ED
Commandline editor. Only used if all else fails ed <file>
EGREP
Grep with "or" egrep '(A|B)' <file>
Exclude a and B egrep -v '(A|B)' <file>
EX
ex -s file <<EOF
Edit a file from within a shell script g/money/s//cash/
EOF
Edit a file with a script ex -s file < scriptfile
EXPR
Calculate modulus expr 10 % 7
Check for string in variable expr $var : 'string'
Show first group of digits in string expr $var : '[^0-9]*\([a-z]*\)'
FG
Put the last stopped job into the foreground fg
FGREP
Find a string which is not a pattern fgrep '*,/.()' <file>
FILE
See the file type (e.g. ascii) file <file>
FIND
Find a file in the whole computer find / -type f -name <file> -print
Find a file pattern find . -type f -name "*<foo>*" -print
Delete all cores in the system find / -type f -name core -exec /bin/rm -f {} \;
Find all files with a word in them find . -type f -exec grep -l <word> {} \;
Find files modified longer than a month ago find . -type f -ctime +30 -print
Use found files more then once with xargs find . -name "*.c" -print | xargs -i cp {} {}.bak
Don't search in nfs mounted filesystems find . -local ...
Follow the links while searching find . -follow ...
Look for files larger than 1 megabyte find /path -size 1000000c -print
Run find but discard the "permission denied"'s find ... 2>/dev/null ( in sh/bash/ksh only)
Find all manualpage directories find / -type d -print | egrep '.*/(catman|man)$'
Find all directories with write permissions find / -type d -perm -002 -print
GAWK
The gnu version of nawk
GREP
Find patterns in lines of files or stdin grep '[a-z][0-9]' <file>
Find lines without pattern grep -v '^From' <file>
Find files which contain a pattern grep -l '^[cC]' *.f
Count lines with pattern grep -c '[Ss]uccess' <file>
Search while ignoreing case grep -i 'lAbEgF' <file>
Print a line number in front of the line grep -n 'mo.*y' <file>
HINV
Get infos about your host on silicon graphics hinv -v
IF then else ENDIF
Branching structure in csh/tcsh
IF then else FI
Branching structure in sh/bash/ksh if [[ condition ]];then commands;fi
KSH
Korn shell. (ksh88) See Per Kistlers ksh script guide
KSH93
ksh93 with real number arithmetics ksh93/ksh...depends on the system
LINE
Reprint lines until eof (sh/bash/ksh) while line;do :;done
LN
Make a hard link b to file A ln a B
Make a symbolik link b to file A ln -s a B
Romove link B rm B
LP
Print file on default printer lp <file>
Print file on specific printer lp -d <destination> <file>
LPSTAT
Show all printers lpstat -a
Check the printer queue lpstat -o
Show defoult printer destination lpstat -d
Show printer status lpstat -p
Show sceduler status lpstat -r
MAKE
Make the first target of a makefile make
Make a specific target of a makefile make <target>
Make according to another file than makefile make -f <mymakefile>
Just show what would be done but don't make -n <target>
MKDIR
Make a directory with subdirectories at once mkdir -p <path>/<path>/<path>
MOUNT
See what is mounted mount
See what is mounted, but formated mount -p
Mount a cdrom to /cdrom mount /dev/cdrom /cdrom
Mount a diskpartition to /usr mount /dev/dsk/c0t3d0s5 /usr
NAWK
Enhanced version af awk
NL
Number text lines from a file nl -bt -nln <file>
NOHUP
Start a job imune to logouts nohup <command> &
OSVIEW
View system activity on SGI osview
PACK
An old form of compress. Use gzip instead. pack <file>
PASSWD
Change your password passwd
Delete password of a user (as root) passwd -d <username>
Change password of a user (as root) passwd <username>
PASTE
Put single col files into one file with as many cols paste <file1> <file2> > <newfile>
PERL
Programming language which can also be used from the commandline or from ksh scripts.
See Per Kitlers perl programing introduction: perl
PR
Format an ascii file for printing (76 lines) pr -l76 -h"title" <filename>
pr -l76 -h"title" <file> | vpp -des=rz
Print page formated via vpp (ETH only)
-dev=printer
RCP
rcp <comp1>:/<path>/<file>
Copy a file from one computer to another
<comp2>:/<path>/
REGCMP
Compile a regexp from a file regcmp <file>
Entry in the file above (example) varname "^[a-z].*[0-9.*$"
RESET
Reset the terminal after having messed it up reset
RPCINFO
Get portinfo from <host> rpcinfo -p <host>
RSH
Execute a command on a remote computer rsh <host> <comand>
RUSER
See who is logged in in the local network rusers
RWHO
Like rusers, but mostly doesn't work
SCRIPT
This logges all which passes the screen script <logfile>
SED
Substitute a string in a file sed -e 's/fred/john/g' <file>
Substitute a pattern in a file sed -e 's/[0-9]+/number/g' <file>
sed -e 's!X!<font color="#FF0000">X</font>!
Change all "X" to red in a html file
g;
Rename files with suffix .suf1 to files with suffix .suf2
ls -1 | grep '\.suf1$' | sed -e 's/\(.*\.\)suf1/mv & \1suf2/' | sh
Change a to b but only on lines with C sed -e '/C/s/A/B/' <infile> ><outfile>
Delete all lines which contain "you owe me" sed -e '/you owe me/d' <infile> > <outfile>
Have many editing commands in a file sed -f <commandfile> <infile> > <outfile>
SH
Shell. The oldest AT&T shell, which is standard for universal shell scripts. Ksh is it's successor.
SHUTDOWN
Stop the system shutdown -h now
SLEEP
Tell ashell script to pause for 10 seconds sleep 10
SORT
Sort lines of a file alphabetically sort <file>
Sort lines of a file numerically sort -n <file>
Sort and reverse the order sort -r <file>
Sort and take only one of equal lines sort -u <file>
Show the used user ID's from /etc/passwd sort +2n -t: /etc/passwd | cut -d: -f3
SPELL
Check for misspelled words in a file spell <file>
Check, but ignore words from okfile spell +<okfile> <file>
SPLIT
Split a big file for putting on floppy split -b1m <file>
Put splitters together if their name starts with x cat x* > <newfile>
STRINGS
Read ascii strings from a binary file strings <file>
STTY
Show the terminal settings stty -a
Change the deletions chatachter to "^H" stty erase "^H"
Do no more show what is typed in scripts stty -echo
Show the typeing again stty echo
SU
Become root with own environment su
Become root with root environment su -
As root become another user su <username>
TAIL
Report certain lines from a growing file tail -f <file> | grep <pattern>
TAR
Pack together a whole directory tar cvf <outfile>.tar <dir>
Unpack a tar file tar xvf <file>.tar
Unpack and untar a file with normal tar gzip -dc <file>.tar.gz | tar xvf -
Unpack and untar a file with gnutar tar xzvf <file>tar.gz
Set the tape variable in the .cshrc for tar tape=/dev/rmt/0mbn
Put a dir onto the tape tar cv <dir>
Retrieve the dir from the tape tar xv
Retrieve only a single file from the tape tar xv <file>
Get table of contents from tape tar t
Copy a directory with links and propper permissions
(cd fromdir && tar -cBf - . ) | ( cd todir && tar -xBf - )
TCSH
Good interaktive shell from Berkly. Only second to bash.
TEE
Put output on screen and append to file who | tee -a > <file>
TEST
Check for a file test -a <file>
Check for beeing root test -O /usr/bin/su
Check for astrin beeing non null test -n "$foo"
Compare two strings numerically test $var1 -gt $var2
In a ksh script one uses "test" indirectly if [[ -a <file> ]];then ...;fi
TIME
See how much time a command needs time <command>
TOUCH
Protect against the the crontab find /myscratch -exec touch {} \;
TR
Replace a with x, b with y and c with z tr '[a-c]' '[x-z]' < infile > outfile
TRAP
Catch "^C" etc. and execute a subroutine trap "mysub;exit" 0 1 2 15
TRUE
Make a non extisting command to return 0 ln -s /usr/bin/true ranlib
TRUSS
See what system calls a command uses truss <command> > /dev/null
TYPSET
Show the functions which are active typset
TTY
See the device for your terminal tty
ULIMIT
Show the max file size you can write ulimit
UMASK
Show your umask for new files umask
Set a save umask umask 077
UNIQ
Find a line of each equal ones an say how many sort <file> | uniq -c
Find uniq lines sort <file> | uniq -u
UPTIME
Show how long the computer is running uptime
UUENCODE
uuencode decodedname namenow >
Encode a file for mailing
codedname
UUDECODE
Decode a uuencoded file uudecode <file>
WAIT
Wait for a background job to terminate wait $jobid
VI
The main unix editor vi <file>
A vi introduction on the net: vi-www-page
WC
Count lines in a file wc -l <file>
XARGS
Execute a command for each line from pipe <command> | xargs grep 'pattern' {}
XON
Get an xterm from another computer xon <host>
Get anything from another computer xon <host> <X-client>
ZSH
Inhanced ksh. But ksh93 and dtksh are now still better.

Command ps

Description The "ps" command (process statistics)


lets you check the status of processes
that are running on your Unix system.
Note - the ps command may be slightly
different on your system, depending on
the type of system you have. The
examples shown here work on systems
derived from AT&T's original Unix System
V ps command.

Examples ps
The ps command by itself
shows minimal information
about the processes you are
running. Without any
arguments, this command
will not show information
about other processes
running on the system.

ps -f
The -f argument tells ps to
supply full information
about the processes it
displays. In this example,
ps displays full information
about the processes you are
running.

ps -e
The -e argument tells the
ps command to show every
process running on the
system.
ps -ef
The -e and -f arguments
are normally combined like
this to show full information
about every process
running on the system. This
is probably the most often-
used form of the ps
command.

ps -ef | more
Because the output
normally scrolls off the
screen, the output of the ps
-ef command is often piped
into the more command.
The more command lets you
view one screenful of
information at a time.

ps -fu fred
This command shows full
information about the
processes currently being
run by the user named fred
(the -u option lets you
specify a username).

You might also like