Basic UNIX commands
=============================

>^Z -- suspend  a process
> fg -- recover the suspended process

>awk '{print $2 }'  file  -- show second field

>cat > foo  --write a short text
>...
>...
>^D

> cd .netscape/cache --Clear Netscape Cache
> pwd (Make sure you are in ~/.netscape/cache directory)

>chmod go+rx iwave.gif
>chmod go-rx iwave.gif --Change mode

>chown janet /users/jane/iamlost --change owner

>chgrp student /users/janet/iamlost --change group

>cp ~/cs351/lab03/makefile . (in own directory)
>cp ~cs207/DISK-207/Filename .  --Copy file

>df --display free and used disk space, and show all file systems
>df --also report the munber of used and free inodes
>df -l --report on locally mounted disks only

>df -k --report number of free disk blocks and files(att)
>df -k -a --report all file system

>du
>du -s
>du -a .|awk'{print $1}' | sort -n | uniq -c | awk '{print $2, $1}' > file
                     -- show current directory file size distribution data
>grap file1 | pic > file2(troff file) --draw a graph
>psroff -me -Pps file2  -- print out the graph file

>dump 5usdf 1700 1000 /dev/rst0  /work  -- backup file systems
>ufsdump 0uf /dev/rmt/2 /dev/rdsk/c0t3d0s5 --backup file systems(solaris)

>/tmp
>mt -t /dev/rmt/on fsf 2
>restore -i
>add username
>extexct
 

>find . -name makefile --Find a file
>find . -name 'list*'

>finger <user>  --displays user info, real name, GECOS field, +other stuff
>fsck -V -t ext2 /dev/fd0  -- check a file system

//compile c file
>gcc(cc) filename   --generate a.out excutable file
>gcc(cc) -c filename.c  --compile to produces filename.o or error messages
>e.g. gcc -c queuearr.cpp

 //compile c++ file
>g++ filename   --generate a.out excutable file
>g++ -c test6.cpp
>g++ -o executable-name x1.o x2.o --link the files to produce executable file
>e.g. g++ -o lab06e test6.o queuearr.o 

>g++ -c filename.c  --compile to produces filename.o or error messages
>e.g. g++ -c queuearr.cpp
>g++ -c test6.cpp
>g++ -o executable-name x1.o x2.o --link the files to produce executable file
>e.g. g++ -o lab06e test6.o queuearr.o

>xxgdb --Debug
>g++ sample.cpp -g

>ghostview pattern.ps --view *.ps file
>gv pattern.ps
 
>grog xx.ms > xx.ps  -- compile the file first
>groff   xx.ms(ms file) > xx.ps   -- convert troff file into ps file(

>gzip filename => filename.gz --Compress files with gzip
>gunzip filename.gz --Unzip gzip file

>id  --Show UID and GUID

>ifconfig  --
>route --

>kill (-9) (PID)process id  --Kill running process

>lastcomm  -- display last commands executed -- very large list

>ln /../../file1 (new)file2  -- hard link
>ln -s /../../file1 (new)file2  -- symbolic link

>lpq -Pps  --See Queue of current printing job
>lpqrm -Pps No --remove the printing job
>rsh pinon lprm -Pps.538

>lpquota  --See paper quota

>lpr -Pps filename(laser printer to print .ps file) --Printing
>lpr -Plp filename
>enscript -G filename( one colume in one page)
>enscript [-Pps] -2r [-G] filename(two columes in one page)
 

>ls      --List file
>ls -l  -- long list
>ls -lg --show the ownership of user and group(BSD only?)

>mcopy a: filename . --copy file from A drive to system
>mcopy filename a: . --from ssystem to A drive

>mail cs351@cs.unr.edu < output.shar --mail

>mformat a: -- format a disk in linux

>/sbin/mkfs -t ext2  /dev/fd0 --make a unix file system
>/sbin/mkfs -t msdos  /dev/fd0 --make a dos  file system

>mount -a  -- mount all file system in fstab
>mount /dev/fd0  /mnt/dosfloppy  -- mount file system /dev/fd0 on /mnt/dosfloppy

>netstat  -r(n)  -- show connectivity of network

>nohup executable file > datafile(result)& --Background run

>ping -s  --test reachability on the network, ping -l on BSD

>ps -x
>ps(not quit)
>ps -aux
>pd -elf --for solaris
>ps -aux | grep chen_z --Monitor running process
>ps -aux | grep usrname | awk '{print $2}' --list the process Id of the user

>passwd -- change the password
>passwd username -- add new user

>pwd  --show the pathname

>for i in '\ps -aux | grep usrname | awk '{print $2}''
>do
>kill -9 $i
>done

>quota -v   --See disk quota

>rm filename --Delete  a file

>rmdir directory  --delete an empty directory
>rm -r(f) directory(including the files) --Delete directory which is not empty

>~rob/bin/bundle cover.txt x.h x.cpp ...... script > output.shar --Bundle

>shutdown -h -now  --take the (linux)system down

>su  --become root or other user if the password given

>cd fromdir; tar cvpf - . | (cd  todir; tar xf -)  --copy a file system hierarchy  to a new location
>tar cvf - path-name > file.tar --create a backup file that can be send over the Internet
>tar tvf file.tar  --view a table of contents
>uname -a --display OS type, version, sustem name, etc

>uniq -c --remove duplicate lines from a sorted file

>vipw --locks the file and then invokes the text editor and avoid collide

>whereis <command> --locate command
>which <command>  --path to command - tell which one of many you get
>whoami --tell you your id

>w --Give list of users and what they are doing

>ypwhich  --give which computer passwd in which your user name is

>ypcat passwd | grep user_name  -- show the user entry in passwd