TOPICS

:
y y

Whatis UNIX Filesystem - navigating - modifying - permissions - archiving / compression

y

Helpers, alias and communication commands - helpers - commands - process - communication

y

File processing - simple commands - piping - devices

Whatis UNIX
UNIX is a so called operating system for workstations and has mainly ben developped at Berkley University (BDS-UNIX). One of the striking difference between UNIX ans many other operating systems is, that it has been a multiuser and multiprocess environment from the very beginning. Multiprocess / multiuser means that different tasks can be run on the same system by different people with different priviliges at the same time. The system used by SGI is a derivate from the original UNIX, a so called dialect, named IRIX.

Filesystem
The following commands are all crucial for navigating in the structure of the filetree. Unlike other systems, in UNIX a filesystem cannot only incorporate files and directorys that are stored locally on the hard drive. It can also merge (shared) drives on other systems (hosts) or external devices like tape drives or printers, keyboards etc.

. df -k Display disk usage in kblocks Modifying Cp cp [ -irp ] file1 [file2 ..] Summarize disk usage du -k du -ks * Show disk usage in kblocks (1024 bytes) Summarize all directorys (*) and show as kblocks Df df [-b][-f][-i][-k][-l][file-system . named file2 Creates a copy of all files starting with "old" into the directory archive cp -R letters archive/. Shows usage of disks.] Report number of free disk blocks... . .Creates a copy of all files under ³letters" and puts them into archive . /usr/lib doc/letters Change Change Change Change Change to to to to to home directory home directory parent directory absolute path /usr/lib relative path doc/letters Du du [-sarklmL] [name ./mydir List in short form All files (including . Usefull to find out if there is enough room to save / copy a project or file.] target Copy files or directory structures cp file1 file2 cp old* archive/ Creates a copy of file1.Navigation Ls ls [-RadLCxmlnogrtucpFbqisf1AM] [names] Lists the content of a directory ls -ls ls -la ls .-files) List content of mydir Pwd pwd Print working directory name pwd Cd cd [ directory ] Change working directory cd cd cd cd cd ~ ..

If the directory is not empty. They thus.] target Moves files to another location or rename them.4 according to their byte-positions: chmod 644 chmod 755 owner:rw owner. Permissions are coded into a 6-digit boolean string with the values 1.2.. use less diskspace. The permissions are coded into a 6-digit boolean string. to file2 Moves all files starting with "old" into the directory "archive" rm rm [-f] [-i] file Remove files rm file1 file2 rm old* rm -r unused/* Removes file1 and file2 Removes all files starting with "old" Removes all files recursively that are under "unused" mkdir mkdir [-m mode] [-p] dirname Make directories mkdir newthings Creates a directory named "newthings" rmdir rmdir [-p] [-s] dirname Removes an empty directory.] target Link files. ln -s /serve/sgi/tools ~/SGItools serve/sgi in your homedirectory symbolic link to mv mv [ -if ] file1 [file2 . Links are like pointers that "point" to the original location of the file. rmdir oldstuff Removes a directory named "oldstuff" Permissions Chmod chmod [-R] mode file Change the permissions of a file or directory...rwx group:r group:rx other:r (typical dir) other:rx (typical file) . To do so.. it will not be removed.ln ln [ -sif ] file1 [file2 . mv file1 file2 mv old* archive/ Renames file1. you have to be the owner of the file or directory.

tar Creates a file named arch.. ] gunzip [ -acfhlLnNrtvV ] [-S suffix] [ name .txt gzip -d oldfile. gzip oldfile.gz to . Tar is often used to either backup data or move complete directory-structures around.txt.gz Decompress oldfile. tar cvf arch.Z compress oldfile.Z Will compress every file in the uncompress uncompress [ -f ] [ -v ] [ -c ] [ name .File archiving / compression tar tar key [directory] [tapefile] [blocksize] [ name .tar and creates all the directories that have been packed into the tar file.txt compress * directory Will result in oldfile.txt Compress oldfile.tar docs/* tar xvf move. can thoug..txt to oldfile.Z uncompress * Will result in oldfile. Writes a single archive-file from a set of files.tar with anything under docs/ Explodes transport.. be rerouted with the f option to write to a file.txt...Z suffix uncompress oldfile..txt.txt Will decompress every .. Compress data.. Tar usually adresses a tape device. ] Compress or expand files.Z file in the directory gzip gzip [ -acdfhlLnNrtvV19 ] [-S suffix] [ name .txt. ] Tape archiver.gz oldfile.txt. Results will be stored into a file with the suffix . ] Expand data with the . Same as 'compress' but with a more efficient algorithm.

you think that a command should be executed. find manual entries by keyword man cp command man -k tape man man Will show the manpage for the copy ('cp') Will search for all helppages.. which ll Will tell you that 'll' is aliased to 'ls -la' (if defined like above) . Sometimes.. alias ll 'ls -la' Will create a command 'll' that executes 'ls -la' when you punch 'll' alias zipall 'gzip *' 'zipall' will gzip all files in the current directory which which [-a] [-f] [name.Helpers.. lookup the versions of installed programms. who owns the current shell? who who am i Show all logged users (optional -u) Displays the user of the current shell man man [-cdwWtpr] [-M path] [-T macropackage] [section] title man [-M path] -k keyword Print entries from the on-line reference manuals. if ever you have forgotten how to use 'man' Command interpretation alias INTERNAL SHELL COMMAND Creates an alias for a string.] Locate a program file including aliases and path (csh only!) Searches the command aliases and your binaries-path for the command that would have been executed if you had entered the requested string. but it is not. Then it is often useful to check your aliases with 'which'.. You can lookup the current user. who who [-uTlHqpdbrtas] [ file ] who am i Who is on the system. alias and communication commands The commands below will help you to identify your command shell environment. Useful if you want to create your own shell commands. in which the keyword 'tape' appears . find out about what command will be executed when you type something and last. 'alias' will simply list all your defined aliases.

To do so. kill 42310 yours kill -INT 42310 (ctrl-c) Kills the process with the number 42310 if Sends the process 42310 the INT signal Communication login login [ -d device ] [ name [ environ .. The most useful are: get document1 Fetches the file document1 to the local dir mget doc* Fetches all files named doc* to the local . Ftp also allows you to create and remove directorys remotely. Files with the same name will be overwritten without asking! ftp spielberg Opens a ftp connection to Spielberg For ftp-internal commands. You can get that. using either the 'ps' or the 'top' command. Changes the owner of the current shell or logs you into a system login ftp ftp [ -v ] [ -d ] [ -i ] [ -n ] [ -g ] [ host ] Internet file transfer program. you will have to ask either the owner of a superuser to shut down that process for you. type 'help' at the prompt. ]] Sign on. Be careful when using mput/mget. If the process is not yours. You can identify it using 'top' and close the application that causes the load. If your workstation seems to be very slow it is often due to a running process. One of the oldes ways of moving data from one server to another.Processes ps ps [ options ] Report process status ps ps -al ps -aledf List all active processes List all processes in long format List all processes in long format with additional information top top [ -i interval ] [ -D fullpathname ] Display processes having highest CPU usage. top top -i1 Updates every 5 seconds Updates every second kill kill [-signal] pid Terminate a process by default.. you need the PID (process ID).

dir ls cd lcd bin lists the remote dir changes the remote dir changes the local dir changes the transfer protocol from ascii to binary and back finger finger [-bfhilmpqsw] [name. Often used to pipe input into another process. Check if a user is logged in on the remote host. Also used to find out if someone has read email recently. and the chaining of them into complex command sequences in the 'redirection & piping' section that follows. cat letter3.] User information lookup program.txt in which 'ando' appears grep 'ando' archi/cv*. . . Prints arguments to the shell. finger scully@spielberg See if user 'scully' is logged in on host 'spielberg' File processing Since UNIX systems base heavily on plain text files for configuration.txt Return every line of archi. there are many powerful tools that allow you to process such files.txt .] Search a file for a pattern grep 'ando' archi. Below. Since processing such files often requires executing many commands after each other.txt cat letter*. You can thus execute command chains.. Simple commands echo echo [ arg ] Echo arguments.. you will find the simple commands first. without saving the intermediate results to a file.txt Print file letter3. echo hi Will print "hi" into your shell grep grep [options] limited regular expression [file .txt Print all files that match letter*. there is something called 'piping' that allows you to direct the output of a command into the input of the next command.txt Search in all cv* files under 'archi'for the string 'ando' cat cat [-u] [-s] [-v [-t] [-e]] file Concatenate and print files.

] Browse or page through a text file more longfile.txt sort units.txt Sort the file archi.] cut -flist [-dchar] [-s] [file . .txt > sorted.6 delimited by '/' sort sort [-cmu][-ooutput][-ykmem][-zrecsz][-dfiMnr][-btx][+pos1[-pos2]][Ttdir][files] Sort and/or merge files sort archi.txt as input for 'cat' Piping: Another thing is piping data streams through a multitude of commands. cut -c1-5 data.txt listing. . Redirected output: ls -la > listing.txt line cut -d/ -f1. .txt Get first 5 characters of every Get fields 1. Often used by piping output from another process.txt' Redirected input: cat < data.5.txt and output to Read the file data.4-6 data. is that you redirect input or output from / to processes.txt alphabetically diff diff [-lrs] [-Sname] [-cefhn] [-xpat] [-biwt] dir1 dir2 diff [-cefhn] [-biwt] file1 file2 Differential file and directory comparator diff oldfile newfile Searches the two files and seeks for differences line by line more more [-cdflrsuw] [-lines] [+linenumber] [+/pattern] [ filename .4.txt List dir and output to Sort units....txt 'sorted.cut cut -clist [file .] Cut out selected fields or characters of each line of a file..txt Prints your file screen by screen Piping and redirecting Redirection: The first thing you can do when interlinking processes.

txt and seeks for lines with 'apple' List all processes. find 'apple' and write .sort chaos. process through some commands and output to another file sort chaos |grep 'apple'> out to file 'out' Sort chaos.txt |grep 'apple' Sorts chaos. find lines field (PID) ps -edalf |grep media |cut -c14-20 with'media' and cut the second f Combined: Input a file.