Sunday, April 27, 2008

UNIX COMMANDS

Unixcommands

________________________________________
Useful commands:

cd................Change Directory
cp................Copy File(s)
cat...............Print Out A File Onto The Screen
mv................Move File(s)
mkdir.............Make A Directory
locate............Find A File(s)
ed................Editor
vi................Editor
ls -a.............List ALL Files
locate /..........List ALL Files on entire hard drive
rm................Delete
tar...............Untar (like zip) a file
netstat -r........Show all computers connected
pine..............Opens pine, and e-mail system
telnet............Program to connect to other computers
lynx..............Internet browser
who...............Show who you are
kill..............Stop a program
man...............Get help
passwd...........Change password

Another list:
ls ................. show directory, in alphabetical order
logout ............. logs off system
mkdir .............. make a directory
rmdir .............. remove directory (rm -r to delete folders with files)
rm ................. remove files
cd ................. change current directory
man (command) ...... shows help on a specific command
talk (user) ........ pages user for chat - (user) is a email address
write (user) ....... write a user on the local system (control-c to end)

pico (filename) .... easy to use text editor to edit files
pine ............... easy to use mailer
more (file) ........ views a file, pausing every screenful

sz ................. send a file (to you) using zmodem
rz ................. recieve a file (to the unix system) using zmodem

telnet (host) ...... connect to another Internet site
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

dos2unix (file) (new) - strips CR's out of dos text files
unix2dos (file) (new) - adds CR's to unix text files



display list of files dir/w dir ls
dir ls -l
display contents of file type cat
display file with pauses type filename | more more

copy file copy cp
find string in file find grep
fgrep
compare files comp diff
rename file rename OR ren mv
delete file erase OR del rm
delete directory rmdir OR rd rmdir
change file protection attrib chmod
create directory mkdir OR md mkdir
change working directory chdir OR cd cd
get help help man
apropos
display date and time date, time date
display free disk space chkdsk df
print file print lpr
display print queue print lpq


Unix commands reference card

--------------------------------------------------------------------------------

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

No comments:

Post a Comment