Download presentation
Presentation is loading. Please wait.
Published byElaine Ellis Modified over 9 years ago
1
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands Major part of the of learning UNIX is to master the essential command set. When you run a command, the __________ is loaded in __________, and the __________ starts executing the instructions contained in the program. UNIX is case sensitive; command names are generally in lower case The command names are seldom __________ characters long. __________ is the most special command!
2
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands The PATH: Locating Commands __________ maintains the environment variable in its own environment. apache[kkhan:16] echo $PATH /net/core/export/home/cs/001/k/kkhan/bin:/usr/local/bin:/usr/bin:/u sr/ccs/bin:/usr/ucb:/usr/dt/bin:/usr/openwin/bin:/opt/bin:/usr/xpg4/ bin:
3
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands apache[kkhan:18] netscape Error: Can't open display: You have not accepted the Binary Software Evalution Agreement. Exiting Where is the Command? 3 commands in UNIX that provides clues to the location of another command. which, whereis, and type which which abandons the search the moment it locates the file name grep. _________ does not require the utility
4
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands apache[kkhan:21] which grep /usr/bin/grep whereis Unlike which, which confines its search to the directories in the PATH, whereis looks up a larger list. It finds 2 versions of ls on this Solaris system. __________ does not support it. apache[kkhan:23] whereis ls ls: /usr/bin/ls /usr/ucb/ls /usr/man/man1/ls.1 /usr/man/man1b/ls.1b
5
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands All UNIX commands are not files; some are built into the __________ apache[kkhan:33] which echo /usr/bin/echo The information output by which is only half true; type is more authentic; the ambiguity, however, only arises when the command is also a builtin command in the SHELL. Shell will ignore the disk version in preference to the builtin command. However, we can override this preferential behavior. HOW? apache[kkhan:27] type echo echo is a shell builtin.
6
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands The UNIX Command structure: apache[kkhan:43] ls -l -t foo foo.sh -rw------- 1 kkhan cs 5 Jan 14 18:40 foo.sh -rw------- 1 kkhan cs 5 Jan 14 18:37 foo command line: ls -l -t foo foo.sh command Arguments – separated by whitespace Arguments beginning with hyphen (-) are called options options change the default behavior of the command
7
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands ls – covered in detail in chapter 4 bash-2.05$ ls -l -a –t OR bash-2.05$ ls -lat There are some characters in the command line that are not really arguments – for example, |, <, and <. Covered in chapter 7 apache[kkhan:66] who > foo
8
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands UNIX provides a full-duplex terminal separate channels for input/output users do not have to wait for a command to complete before typing the next one; just continue typing even if the output of the previous command clutters the display who ; ls not – 2 commands separated by a metacharacter ; apache[kkhan:72] echo "This is >a three-line >text message" This is a three-line text message
9
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands the same command in c-shell apache{kkhan}10: echo "This is\ a three-line\ text message" This is a three-line text message When you encounter > or ? due to absence of matching quotes you can interrupt with Ctrl-c or Ctrl-u
10
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands Command output need not always be seen on the terminal. apache[kkhan:79] who > userlist.txt apache[kkhan:80] who | wc –l print the line count - m: print the character count
11
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command man: On-Line Help the most complete and authoritative guide to UNIX system also available of the internet to view wc command apache[kkhan:80] man wc
12
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands Reformatting page. Please Wait... done User Commands wc(1) NAME wc - display a count of lines, words and characters in a file SYNOPSIS wc [-c | -m | -C] [-lw] [file...] DESCRIPTION The wc utility reads one or more input files and, by default, writes the number of newline characters, words and bytes contained in each input file to the standard output. The utility also writes a total count for all named files, if more than one input file is specified. wc considers a word to be a non-zero-length string of char- acters delimited by white space (for example, SPACE, TAB). See iswspace(3C) or isspace(3C). --More--(23%)
13
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands man –k and man –f man - k who displays manual without stopping searches the keyword in all the manuals available man -f grep displays a one line header from the NAME section Pages are traditionally referred to using the notation “name(section”); the same page name may appear in more than one section of the manual. For example, exit(1), exit(2) grep grep (1) - search a file for a pattern
14
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Commands printf: Alternative to echo Like echo, it exists as an external command except Bash has it built in unlike echo, you must use \n – escape sequence {csblade310:~} printf "Testing" Testing{csblade310:~} printf "Testing\n" Testing {csblade310:~} printf "My current shell is %s\n" $SHELL My current shell is /bin/ksh
15
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command script – Recording Your Session Virtually unknown to many users lets you “record” your login session in a file not included in the ___________ standard keeps the log of your activities
16
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command {csblade310:~} script Script started, file is typescript $ ls Mail foo public_html userlist.txt PUTTY.RND foo.sh typescript $ echo $SHELL /bin/ksh $ exit Script done, file is typescript {csblade310:~} cat typescript Script started on Wed Jan 23 18:21:26 2008 $ ls Mail foo public_html userlist.txt PUTTY.RND foo.sh typescript $ echo $SHELL /bin/ksh $ exit script done on Wed Jan 23 18:21:40 2008
17
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command passwd: Changing Your Password {csblade310:~} passwd passwd: Changing password for kkhan Enter existing login password: uname: Machine’s Name and Operating System {csblade310:~} uname SunOS uname -r: The Current Release 5.10 uname -n: The machine name csblade310.utdallas.edu
18
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command who: Know the Users who am I date date +%m - month date +%h – month name stty: When Things Go Wrong
19
second edition Your UNIX: The Ultimate Guide Das © 2006 The McGraw-Hill Companies, Inc. All rights reserved. UNIX Command {csblade310:~} stty -a speed 9600 baud; rows = 24; columns = 80; ypixels = 370; xpixels = 730; csdata ? eucw 1:0:0:0, scrw 1:0:0:0 intr = ^c; quit = ^\; erase = ^h; kill = ^u; eof = ^d; eol = ; eol2 = ; swtch = ; start = ^q; stop = ^s; susp = ^z; dsusp = ^y; rprnt = ^r; flush = ^o; werase = ^w; lnext = ^v; -parenb -parodd cs8 -cstopb hupcl cread -clocal -loblk -crtscts -crtsxoff -parext -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl -iuclc ixon -ixany ixoff -imaxbel isig icanon -xcase echo echoe echok -echonl -noflsh -tostop echoctl -echoprt echoke -defecho -flusho -pendin iexten opost -olcuc onlcr -ocrnl -onocr -onlret -ofill -ofdel
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.