| Selectorweb.com |
Unix
| On this page: | Other pages: | ||
| • intro,
manpages, tutorials
• books • prompt & terminal • more • unix flavors Linux, Solaris, BSD, SCO, AIX, HP, Digital, IRIX • commands examples |
• shell
scripting
• tcsh • Bourne sh_short • Bourne sh_tutorial • vi_mode_commands.html • emacs_mode_commands • command_line_editing_tips • vi-ref - vi-ref.pdf |
• less
•
• awk • sed • grep • Tcl/Tk • Learning the UNIX Operating System • unix hints and hacks • my page for linux • more commands (random flow) • network_admin• less • • make • |
| intro, tutorials | home - top of the page - email |
Unix - runs behind ~70% of the Internet, very stable, originally written in C. It is (was) simple, small and open. This allowed it to mutated like a virus and to spread onto various platforms. Why Unix is better or how to hate Unix - read more on Operating Systems page.
Some links:
- www.iki.fi/era/unix/
- History, Useless Use Of ... Awards, etc
- www.iki.fi/era/unix/shell.html
- Steve Bourne's original tutorial.
- www.ocean.odu/edu/ug/shell_help.html
- quickly written by the looks of it, but seems to have the important stuff.
- www.mpi-sb.mpg.de/~uwe/lehre/unixffb/quoting-guide.html
- a pretty definitive document on quoting and escape characters.
Examples of tutorials:
• www.google.com/search?q=unix+tutor+commands
• www.emba.uvm.edu/CF/basic.html
- - basic unix commands with short descriptions
man pages:
| The easiest way to find many man pages for a command is by searching
google for: manpage command
• www.engin.umich.edu/htbin/mangate?manpage=perl - perl • www.engin.umich.edu/htbin/mangate?manpage=ls - ls • www.engin.umich.edu/htbin/mangate?manpage=troff
- troff
from the prompt:
Reformatting documentaion on unix prompt
|
Good starting tutorials:
| • www.ora.de/catalog/unixcd/chapter
- Unix Commands (from O'Reilly "Unix in a Nutshell, Chapter 2)
• www.webreference.com/programming/unix/ - tutorials • www.infojack.com/ - tutorials, books and tests • www.itspace.com/ - unix resources • www.oase-shareware.org/shell/ - all about Unix shells • kulichki.rambler.ru/moshkow/ - many books in Russian |
| unix books | home - top of the page - email |
| • Unix : Visual Quickstart Guide (Visual
Quickstart Guide Series) by Deborah S. Ray, Eric J. Ray
• UNIX For Dummies - by John R. Levine, Margaret Levine Young • Learning the UNIX Operating System - (Nutshell Handbook, O'Reilly) - short • Programming With Gnu Software (Nutshell Handbook) • Unix in a Nutshell: A Desktop Quick Reference for SVR4 and Solaris 7 (3rd Edition) - by Arnold Robbins, Daniel Gilly • UNIX Power Tools Programming With Gnu Software (Nutshell Handbook) • UNIX System Administration Handbook - by Evi Nemeth, et al (Paperback - August 2000) • Essential System Administration : Help for Unix System Administrators (Nutshell Handbook) • The UNIX Programming Environment - by Brian W. Kernighan, Rob Pike (Contributor), Robert Pike • Advanced Programming in the Unix Environment
(Addison-Wesley Professional Computing Series) W. Richard Stevens
• Interprocess Communications in Unix :
The Nooks and Crannies - by John Shapley Gray
|
See more books listed on pages devoted to shells, misc. tools, sys.
administration, network, email, and Linux.
| editing on the prompt | home - top of the page - email |
When you start working on the prompt - you want to select the shell
to use (usually ksh or bash) and editing mode
(vi or emacs).
Ask your sysadmin to set it up for you (edit /etc/passwd
file and .profile or
.bash_profile in your
home directory).
| Here are some commands in .profile file for Korn shell:
EDITOR=vi VISUAL=vi # this overrides EDITOR set -o vi # this is the same again PS1='$LOGNAME'@`uname -n`:'$PWD $ ' Command line editing is usually done in one of 2 modes: vi or emacs.
vi-mode is not intuitive for many people. Arrows don't work as
you would expect them to work. You have to constantly switch between command
and insert modes. Here are some sites to help you love vi: If you are not a vi lover - then you probably will be
much happier with emacs mode:
For modern linux-es default is bash in emacs
mode.
|
Using xterm - examples:
| dtterm -d 10.3.3.101:0.0 -fg black -bg white
&
xterm -d daddypc:0.0 -fg green -bg black & xemacs -d daddypc:0.0 & alias term='xterm -d daddypc:0.0 -fn -*-Fixed-Medium-R-*-*-*-120-75-75-*-*-ISO8859-1 -bg DarkCyan -fg White -geom 90x30 -cr red &' alias term0='xterm -d daddypc:0.0 -fg black -bg white &' alias term1='xterm -d daddypc:0.0 -fn -*-Fixed-Medium-R-*-*-*-120-75-75-*-*-ISO8859-1 -bg black -fg LemonChiffon -geom 90x30 -cr red' alias term2='xterm -d daddypc:0.0 -fn -*-Fixed-Medium-R-*-*-*-140-75-75-*-*-ISO8859-1 -bg black -fg LemonChiffon -geom 100x40 -cr red' |
You can get syntax color coding in vim via CRT-telnet (www.vandyke.com):
| - set CRT-telnet session to ansi emulation (you can change ANSI
colors in Global settings).
- set $TERM to ansi on unix - in vim settings file .vimrc add command :syntax on |
• www.cs.utk.edu/~shuford/terminal/unix_terminal_news.txt
- discussion about using terminals
• www.unm.edu/cirt/introductions/unix/unix10.html
- using X-windows
• www.chemie.fu-berlin.de/chemnet/general/aboutx.html
- FAQ about X-windows
• www2.ncsu.edu/cc/pub/tutorials/unity_intro/31_colors.html
- setting colors in X-windows
| more on unix | home - top of the page - email |
POSIX - (Portable Operating System Interface) is a set of standard operating system interfaces. It was based on the UNIX operating system partly because it was "manufacturer-neutral." Read on www.whatis.com
More on Unix:
• USENET
FAQs
• Unix
Programming FAQ
• Unix
Links
• The
Unofficial Guide to Solaris
• OO
Network Prgming with Unix
• Unix
systems programming
• sockets
• Vi
FAQ
• Advanced
Unix IPC
• unix
sockets programming in c
See also:
• www.gnu.org
- GNU software and compiler
• www.cerfnet.com/~mpcline/c++-faq-lite/
- C++ FAQ
• www.eskimo.com/~scs/C-faq/top.html
- C FAQ
| Unix flavors | home - top of the page - email |
Linux
• see
my page for
linux
• www.linux.org
-
Linux
• www.linux.org/dist/english.html
- misc distributions (Red Hat, Caldedra, Debian GNU/Linux, Slackware, S.u.S.E.
and many-many others).
• www.linux.org/vendors/retailers.html
- retailers in different countires (long list)
• www.redhat.com
- Linux
• www.suse.com
- Linux
Sun Solaris
• www.sun.com
- Solaris operating system (available for Intel-PC for $15).
( also
www.sunfreeware.com
- everything you need for operating system )
•
info.rutgers.edu/Techdir/solarisbody.html
- Solaris system configuration
•
www.fwi.uva.nl/pub/solaris/solaris2.html
- Solaris FAQ
•
http://docsun.cso.uiuc.edu/cgi-bin/nph-dweb/ab2
- Solaris Online Documentation Library - excellent resource
•
http://soldc.sun.com/
- Solaris Developer's Connection
BSD (Berkeley Systems Distribution)
• www.bsd.org
- lists several different BSDs (FreeBSD,
NetBSD,
OpenBSD,
BSDI
Internet Server (BSD/OS) )
for example, FreeBSD
is used by famous sites like Yahoo and HotMail ( http://freebsd.peon.net/
- tutorials )
• www.bsdi.com
- commercial expensive BSD
SCO (The Santa Cruz Operation, Inc.)
• www.sco.com
- good stable unix on Intel platform:
•
www.sco.com/unix/market.html
1987: AT&T + Sun
= System V, revision 4 (SVR4)
1993: AT&T sells its
unix to Novell
1995: sold to SCO.
AIX (An IBM unix)
• www.ibm.com/servers/aix/
- unix from IBM
HP-UX (Hewlett Packard unix)
• www.hp.com
- unix from Hewlett Packard - good choice (amazon.com uses HP servers)
DIGITAL UNIX
• www.compaq.com/enterprise/
( read also • www.operatingsystems.net/oses/decunix.htm
)
( ULTRIX -
a BSD based + some features from System V and DEC. It was made by
DEC, then replaced by Digital Unix ).
IRIX
• www.sgi.com/
- Silicon Graphics, Inc.
• www.microware.com/Products/Software/OS9.html - OS-9 - small, but very nice and robast UNIX-like RTOS
and many-many more types of Unix
| commands examples | home - top of the page - email |
You can combine several commands on one line using pipes and redirecting
input/output. Here are some examples:
sort < data > junk
tr a-z A-Z < in > out
ls -s | tail +2 | sort -rn | head -5
ps -ef | grep http
tar cvf - . | gzip -9 > mmm.tar.gz
gunzip < mmm.tar.gz | tar -xvf -
ps -ef | grep daemon | cut -c10-14
ls -l | grep "^d" | cut -c55-80
cat tt | sort | uniq -d
| ps -ef |
grep appl /usr/ucb/ps aux | head find . -type f -print | xargs fgrep -l 'pattern goes here' /dev/null/ find . -mtime -1 -print find . -name '*.pl' -exec perl -wc {} \; uname -a tail -f somelog - to see the tail of the
log as it changes |
| nslookup `hostname` netstat ifconfig /etc/hosts /etc/resolv.conf /var/spool/cron/crontabs/ ... |
| tar everything in current
directory: tar cvf mmm.tar . gzip -9 mmm.tar or in 1 line: tar cvf - . | gzip -9 > mmm.tar.gz now in oposite direction: gunzip mmm.tar.gz tar xvf mmm.tar or in 1 line: gunzip < mmm.tar.gz | tar -xvf - gzip -dc mmm.tar.gz | tar -xvf - or to just look what's inside: gzip -dc mmm.tar.gz | tar -tvf - ------------------------ gunzip -c mmm.tar.gz | tar xvf - file1 file2 file3 gzip -dc mmm.tar.gz | tar tvf - gzip -dc mmm.tar.gz | tar -xof - zcat < mmm.tar.gz | tar -tf - Recursive
operations - use -r ( or -R) option: |
| one-liners for Unix:
rename many files simultaneously (here it renames *.tar into *.tar7): ls -1 *.tar | perl -nle '$old=$_;s/(\.+)tar/$1tar7/;rename($old, $_);' - print help for all commands of perforce (p4) source control system: p4 help commands | perl -nle 'm/^\s+(\w+)\s/; print "$1\n";' - | xargs p4 help |
| if you received an tar.gz file uuencoded in the body of the message
between the begin..end lines (begin line contains real file name, for example
SelfGOL.tar.gz): save it as text file "file.txt" uudecode -p < file.txt | gunzip | tar -xzvf - or (step-by-step): |
| Get gcc (GNU C-compiler) binary - version 2.8.0 or better.
/appl/archives/gcc.tar.Z copy it into /appl/Archives directory, uncompress it and untar it (tar xvf ...) This will put all necessary binary files in their places. Test that the compiler is alive: gcc -v - should show the version When installing the software we will be running scripts which will
be looking for a C-compiler. Some scripts want to see ln -s 'whence gcc' /usr/local/bin/cc This may be OK if there are no other C-compilers used on this machine.
make CC=gcc Or you can define environment variables before running make or configure script: CC=gcc;export CC (sh) Now you can test: env For some scripts it works better if you CC=gcc; export CC; ../dist/configure
(sh) |
To sync directory from old computer to a new computer:
|
-- -- more commands (random flow) -- --
cat /proc/meminfo
cat /proc/cpuinfo
sudo - utility to run a command as root ( example: sudo hdparm
-t /dev/hdb5 - to show disk speed )