Download presentation
Presentation is loading. Please wait.
Published bySheryl Wilcox Modified over 9 years ago
1
1 Advanced Unix Commands How Unix works along with some additional, useful Unix commands you might like to know.
2
2 Shells zWhat is a shell? zBourne shell yDeveloped by Steve Bourne at AT&T zKorn shell yDeveloped by David Korn at AT&T zC-shell yDeveloped by Bill Joy for Berkeley Unix zEZ-shell yDeveloped by somebody at UWM.
3
3 How the shell works zShell displays a prompt. zYou type in a command. zYou press the return key. zThe shell interprets the commands you typed and tries to find the correct programs to run. zThe kernel runs the requested programs and returns the results to the shell. zThe shell displays the command prompt again.
4
4 The Standard Input, Output and Error zStandard input ystdin yThe place the program normally looks for input. yThe keyboard. zStandard output ystdout yThe place where the program normally sends its output. yThe screen. z Standard error ystderr yUsed by programs to display error messages. yAlso the screen.
5
5 Redirection, >> z< yRedirects the standard input. x[command] < [file name] yThe command will open the file and use its content as its source of input.
6
6 Redirection, >> z> yRedirects the standard output. x[command] > [file name] yThe results of the command will be sent to the specified file. yWill create or overwrite the destination file. xcat june july aug > summer2000
7
7 Redirection, >> z>> zAlso redirects the standard output. y[command] >> [file name] zThe results of the command will be sent to the specified file. zWill append the results of the command to the existing file.
8
8 Grouping commands zExecuting one command at at time can be tedious. zUnix allows for grouping of commands by separating commands with a semi-colon (;). ypwd; cal 1 2000; date
9
9 | (pipe) zSimilar to redirection and grouping. zUsed to link commands. y[command] | [command] etc. zThe output of the first command is sent as the input to the second command, and so on, and so on … ywho | more
10
10 Wildcards zTyping in Unix can be tedious. zUnix supports three wild-card characters: yAsterisk (*): matches any string of characters including blanks. yQuestion mark (?): matches single characters. ySquare brackest ([]): Tells the shell to match any characters that appear inside the brackets. zQuoting special characters
11
11 wc zword count zUsed to display a word count of a file. ywc [-c l w] [file name(s)] zThe output you will see will be a line showing the number of lines, words and characters. zLimit display with the flags.
12
12 sort zSorts the contents of a file. ysort [-b f n r] [file name(s)] zTakes the contents of a file and displays it in sorted order. zFlags: y-b: ignores blanks y-f: folds upper- and lowercase letters together y-n: numeric sort y-r: reverse usual order
13
13 Job control zUnix works via jobs or processes. zEvery command or program is a separate job/process executed by a user. zJobs are usually run in the foreground, but can be made to run in the background. zJobs can be killed by the user who created them.
14
14 Job control zctrl-c: cancels a command/job zctrl-z: suspends a command/job zjobs yLists the jobs (programs) that you currently have running.
15
15 bg zForces a job to the background. zFirst, type a ctrl-z to suspend the job. zThen type bg and the job is forced to the background. zUse the jobs command to see it. zYou can force a job to the background immediately with the &.
16
16 fg zBrings a job to the foreground. zUse the jobs command to see the jobs you have running. zType fg %[number] and that job will be brought to the foreground.
17
17 kill zKills a job that you have running. zUse the jobs command to see what you have running. zType kill %[number]. zNot the most graceful way out, but it works.
18
18 Reading zChapters 10 and 11. zShell CustomizationShell Customization
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.