1 / 31

Introduction to Unix: Fundamental Commands

Introduction to Unix: Fundamental Commands. What You Will Learn. The fundamental commands of the Unix operating system. Everything told for Unix here is applicable to the Linux operating system also. What is Unix.

yoko
Télécharger la présentation

Introduction to Unix: Fundamental Commands

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introductionto Unix: FundamentalCommands

  2. What You Will Learn • The fundamental commands of theUnixoperating system. • Everything told for Unixhere is applicable to theLinux operating systemalso.

  3. What is Unix • UNIXis a computer operating system, a control program that works with users to –runprograms, –manageresources, and –communicate with other computer systems. • Several people can use a UNIX computer at the same time; hence UNIX is called a multiusersystem. Any of these users can also run multiple programs at the same time; hence UNIX is called multitasking.

  4. Logging on to a UNIX machine • Because UNIX is a multiuseroperating system, you need to start by finding a terminal, computer, or other way to access the system. • Connect your terminal or PC to the UNIX system until the point where you see a login prompt(login:) on your screen. Use the phone and modem to dial up the computer if you need to.

  5. Connectinga PC (MS-Windows) toUnix System • The machinethatwearegoingtoconnect is calledhyperion.labs.itu.edu.tr • Select Start → RunandtypeSshClient in the emptybox • Thiswill start the SSH program

  6. ChooseQuickConnect, a newwindowwillcomeupto the screen • In the HostNamesection, typessh.itu.edu.tr • In the UserNamesection, enteryourloginname • Leave other parts as theirdefaultvalues.

  7. WhenyoupressConnectbutton, youwillsee a passwordprompt. • Enteryourpasswordexactlyandpress OK button. • Yourlogin name andpasswordarecase-sensitive.

  8. You are now logged into the computer and will have a prompt that reflects the computer's name. For example, if you connect to hyperionmachine, the prompt looks like this: [oztaysib@ssh ~]$ • Once you’ve successfully entered your account name and password, you are shown some information about the system, some news for users, and an indication of whether you have electronic mail. The specifics will vary. • At this point, you’re ready to enter your first UNIX command.

  9. ShellCommands of UNIX • Unix Commands • When you first log into a unix system, you are presented with something that looks like the following: [oztaysib@ssh ~] • That “something” is called a prompt.As its name would suggest, it is prompting you to enter a command. • Every unix command is a sequence ofletters,numbersandcharacters.But there are no spaces.

  10. Unix is alsocase-sensitive. ThismeansthatcatandCataredifferentcommands. • Theprompt is displayedby a special program calledtheshell. • Shellsacceptcommands, andrunthosecommands. • They can also be programmed in theirownlanguage. Theseprogramsarecalled “shellscripts”.

  11. Therearetwomajortypes of shells in unix: • Bourneshells • C shells. • Steven Bournewrote the original unixshellsh, and most shells since then end in the letters sh to indicate they are extentionson the original idea • Linux comeswith a Bourneshellcalledbashwrittenby the Free Software Foundation. • bashstandsforBourneAgainShelland is the defaultshelltouserunninglinux

  12. Whenyoufirstlogin, the prompt is displayedbybash, andyouarerunningyourfirstunix program, thebashshell. • As long as youarelogged in, thebashshellwillconstantly be running.

  13. Storinginformation • Unix providesfilesanddirectories. • Adirectoryis like afolder:it containspieces of paper, orfiles. • A largefolder can evenholdotherfolders-directories can be inside directories. • Inunix, thecollection of directoriesandfiles is calledthe file system.Initially, the file systemconsists of onedirectory, calledthe“root”directory • Inside “root” directory, there are more directories, and inside those directories are files and yet more directories.

  14. Each file and each directory has a name. • Ashort namefor a file could be joe, • while it’s “full name” would be /home/larry/joe.Thefull nameis usuallycalledthepath. • The pathcan be divideinto a sequence of directories. • For example, here is how /home/larry/joeis read:

  15. A pathcouldrefertoeither a directoryor a filename, sojoecould be either. • Alltheitemsbeforetheshort name must be directories.

  16. To seelinuxcommandspressTabkey, • If youwanttolearncommandsbeginningwith c you can write cthenpressTabkey/home/larry# c

  17. Obtaininghelp • The mancommand displays reference pagesfor the commandyou specify. • The UNIX manpages (man is short for manual) cover every command available. • To search for a manpage, enter manfollowed by the name of the command to find . [oztaysib@ssh ~]$ manls (press q toexit)

  18. ObtainingHelp • ToExitpress q

  19. man ((obtaininghelp)) • There is also a keywordfunctionin man. • For example; –If youareinterested in anycommandsthatdeal with Postscript, theprintercontrollanguageforAdobe • Type man -k psor man -k Postscript, • you’ll get a listing of all commands, system calls, and otherdocumented parts of unix that have the word “ps” (or “Postscript”) in their name or short description. • This can be very useful when you’re looking for a tool to do something, but you don’t know it’s name-or if it even exists!

  20. Lab. Extension

  21. Application 3 • A. ls: “listdirectorycontents” • ls –al: “Show allandlonglisting” • ls -F:Adds a slash after the name for directories, an asterisk for executables, and an at sign (@) for linked files. • B. man: displays online manualpages • C. mkdir BIL101E: Creat a directorynamed BIL101E • D. cd BIL101E: changedirectoryto BIL101E • E. touch: change file timestamps • touch deneme.txt: creates the file ifdoes not exist

  22. Application 3 • F. mkdir GECICI: Creat a directorynamed GECICI • G. cd GECICI: changedirectoryto BIL101E • H. ls: list the directorycontent • I. cd ..: change directory to mother directory • J. cp deneme.txt GECICI: copy deneme.txtto GECICI directory • K. mv Deneme.txt GECICI: move Deneme.txtto GECICI directory • L. mv deneme.exe GECICI • M. ls GECICI • N. : rm remove deneme.txt in the GECICI directory

  23. Application 3 • O. cd GECICI: goto GECICI directory • P. rm Deneme.txt: remove the file in GECICI 8without declaring the directory) • Q. mkdir YOK: create a newdirectorywith the name YOK • R. rmdir YOK: remove the directorynamed YOK • S. cd .. :Changedirectory

  24. EDITORS: joe-pico-vi • A4. picomyfile.txt [create file namedmyfile.txt] • Bu benim ilke editör kullanısım • (CTRL+ X) [close the file] • A5. catmyfile.txt [displays the contents of a file.] • A6. vimyfile.c • i • // Bu benim ikinci editorkullanısım • Shift-ZZ • catmyfile.c • A7. gccmyfile.c – o myfile.execompile the codeandcreate the exe file

  25. -trees – chmod- • A8. tree :list the content of directories in a tree-like format • A9. ls –la : showallandlonglisting • A10. permissions | filecount | user | group | size | date | filenamewithextension • -r-x-x-x 1 aribasuser 102 23 May 1996 myfile.c • Position 1 file type: d (directory) - (ordinary file) l (symbolic link) • Position 2-4 permissions for the owner: r (read), w (write) , x (execute) • Position 5-7 permissions for other users in the same group • Position 8-10 permissions for all other users • Read: 4 Write: 2 Execute : 1 • A11. chmod 700 myfile.txt: allrightsto the owner • A12. ls –la: showallandlonglisting • A13. chmod 744 myfile.txt: allrightsto the owner, onlyreadtoothers • A14. chmod 711 myfile.exe: allrightsto the owner, onlyexectoothers

  26. -trees – chmod- • A15. grep ‘Bu' myfile.c : searches the given file for lines containing a match to the given strings or words • A16. wc –l myfile.c : displays a count of linesin a file. wc –w myfile.c : displays a count of wordsin a file. • A17. spellmyfile.c : Looks through a text file and reports any words that it finds in the text file that are not in the dictionary. • A18. cmpmyfile.c myfile.txt: The cmp utility compares two files of any type and writes the byte and line numberat which the first difference occurred is reported. • A19. diffmyfile.c myfile.txt : find the differencesbetweentwofiles

  27. A20. tr a b translate specified characters into other characters or to delete them. • A21. gzipcompressorexpandfiles • A22. tar xvf panda.tar Extract files from panda.tar. • A23.? • A24. ls i?u • A25. ls –F > mylist.txt • A26. !1 – pine / email • A27. !2

  28. Network – storage- systemtools • A28. ps –aux: displays information about a selection of the active processes • A29. du –kh :Summarize disk usage of each FILE in mb • A30. df : Report how much free disk space is available • A31. who: show who is logged on • A32. uptime: tellhowlong the system has beenrunning • A33. whoami: user name associated with the current effective user ID • A34. where: • A35. w: Show who is logged on and what they are doing • A.36. pid: Retrieveprocessid

  29. Network – storage- systemtools • A37. kill % terminate a process • A38. kill -9 terminate a processbased on Process ID • A39. fg : Continues a stopped job by running it in the foreground, • A40. bg: Continues a stopped job in the background • A41. sshhyperion.labs.itu.edu.tr :OpenSSH SSH client (remote login program) • A42. finger : userinformationlookup program

  30. A43. bash : Bash is an sh-compatible command language interpreter that executes commands read from the standard input or from a file. • A44. tcsh: It is a command language interpreter usable both as an interactive login shelland a shell script command processor. • A45. sh: command language interpreter that executes commands read from the standard input or from a file • A.46. cat .profile • A.47 catbash.rc • EKLER ; tail ; head ; scp

More Related