This file contains a few basic UNIX commands to enable you to create directories and files, move around to find specific files, and run a few simple commands.
passwd
yppasswd
or
something different, so ask around)
man
man chmod |
read about the UNIX chmod command |
man man |
read about the man command |
man fopen |
read about the Standard C library fopen command |
/home/www/CS400/index.html
is an
absolute pathname.
Absolute pathnames always start with / (which is
the name of the root directory), with one exception:
a tilde in front of a username represents the absolute pathname
of that user's home directory. For example,
~abrady/ProgLang
is an absolute name because the
system will expand ~abrady
to /home/abrady
.
myfile.c |
file in current directory |
progLang/myfile.c |
file in progLang directory, which is a subdirectory
of the current directory |
../myfile.c |
file in parent directory (.. means directory above
current directory) |
../progLang/myfile.c |
file in progLang directory, which is at same level
in hierarchy as the current directory (it is a child of my
parent directory) |
pwd
cd dirname
dirname
, e.g., cd ProgLang
or cd ../ProgLang
or cd ~abrady/ProgLang
mkdir dirname
dirname
rmdir dirname
dirname
(must be empty)
ls
.profile
, which are also
known as hidden files)
ls -aF
ls *.html *.c
.html
or .c
mv oldname newname
oldname
to newname
mv oldname ProgLang/newname
oldname
to directory ProgLang
,
giving it name newname
cp oldfile newfile
oldfile
, calling the copy
newfile
cp oldfile ProgLang/newfile
oldfile
; put in the
ProgLang
directory
rm filename
rm *
cat filename
cat
= concatenate)
cat f1 f2 >f3
f1
and f2
, calling combination f3
more filename
filename
to screen one page at a time (use
spacebar to go to next page; b
to back up)
lpr filename
pr filename
on some systems)
vi filename
filename
(but learning vi is another lesson!)
emacs filename
filename
(but learning emacs is another lesson!)
grep string *.c
.c
files contain string
, e.g.,
grep fcn3 *.c
cc, CC
gcc, g++
gcc -Wall -Wextra -Wpedantic -Wformat -Wshadow
-Wredundant-decls -Wstrict-prototypes
-W
options generate warnings about questionable
constructions; these sometimes indicate programmer confusion or actual
logic errors. (You can also use -Wtraditional
to catch
some non-traditional C constructs that GCC allows, or
-Wmissing-prototypes
to find functions that do not have
prototypes in header files.)
cflow, dbx, gdb
man
page for details):chmod
head
tail
banner word
cal
cal 9 1752
clear
date
echo
echo Hi!
or echo $PATH
exit, logout
wc
wc myfile
or
wc -l myfile
who
man
page for details):type command
command
? (could be a command or an
alias) e.g., type diff
or type l
whereis command
whereis man
grep
grep pat myfile
diff
diff old new
sort
find
ftp
ssh
scp
ssh
ps
kill
kill -9 14238