Professional Documents
Culture Documents
Minimal Unix Commands
Minimal Unix Commands
File/directory commands:
cd chgrp chmod cp ls mkdir mv pwd rm rmdir change directory change group ownership change permissions copy file(s) list files make new directory move/rename file(s) present working directory remove/delete file(s) delete empty directory
page 1
sample usage
cd bin cd ~/2350/hw cd chgrp appm2350 index.html chmod 664 myfile.html cp thisfile newfile cp file* subdir/ ls -l ls -alrt *.html mkdir 2005fall mv a.out ProgramE mv file* subdir/ pwd rm -i *.aux rm -rf subdir/ rmdir 1999fall
sample usage
emacs mythesis.tex vi mythesis.tex nedit mythesis.tex pico mythesis.tex pine mailx mailx smith@hotmail.com latex mythesis.tex pdflatex mythesis.tex
sample usage
Text filters:
cat grep head more sort spell tail wc display text contents find word/string display first few lines display 20 lines at a time re-order text lines find misspelled words display last few lines word count
cat file1.txt file2.txt file3.txt grep keyword file1 file2 file3 head -5 file.txt more file.txt sort -r -n file.txt spell file.txt tail -5 file.txt wc file.txt cat *.tex | wc
sample usage
Other Utilities:
man cal date du echo look manual page calendar current date/time total size of directory print to screen suggest words
man ls man -k editor cal cal 12 2005 date du -k | sort -n echo "This is great stuff." look stri
over
page 2
sample usage
file * jobs kill 23098 nice ./a.out ps -ef | sort | more which netscape
kill -9 23098
Customizing:
alias finger passwd set setenv w who whoami command shortcut user identity change password variables variables user identities
sample usage
alias dir /bin/ls -al \!* | more finger smith finger @newton passwd set path=($path /usr/local/tex/bin) setenv TEXHOME /usr/local/tex w who whoami
sample usage
cc -o myprogram progA.c f90 -o myprogram progA.f90 diff file1.txt file2.txt strings a.out tar cf myarchive.tar file1 file2 dir3 dir4 gzip myarchive.tar gunzip myarchive.tar.gz
SYNTAX:
& > >> < | ; $VARIABLE * and ? !! $! run in background redirect to file append to file input from file pipe to another program separates commands variables wildcard characters last command, last word
sample usage
nice ./a.out & nice ./a.out > results.out & nice ./a.out >> more.out & nice ./a.out < input.dat > results.out & cat *.dat | more ./a.out < input1.dat ; ./a.out < input2.dat ; ls set ; echo $PATH ls *.tex ; ls a* ; ls *.??? ; ls file?.txt echo "!!"
FILES:
~/.cshrc ~/.login ~/.ssh/known_hosts initialization file initialization file ssh keys file
define shell variables and aliases set 1-time login information keys accepted from other hosts; sometimes needs editing