Presentation is loading. Please wait.

Presentation is loading. Please wait.

Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working.

Similar presentations


Presentation on theme: "Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working."— Presentation transcript:

1 Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working with Files: file, cat, more, less, grep, head, tail, cp, mv, ls sort, uniq, diff Communicating with Users who, talk, write, mesg, finger

2 Unix Structure The Linux operating system can be visualized in terms of layers: Unix Kernel controls the computer resources and schedules jobs Shell acts as a command interpreter that acts as an interface between users and the operating system Utilities (Commands) comprehensive set of utilities that are universally required by Unix administrators & users. Utilities are often referred to as commands

3 Linux Structure Hardware Linux Kernel The shell & other basic utilities Compilers Mail & message facilities Interpreters Database Mgmt System Formatters Editors Inventory control systems Spreadsheet applications Word processors Calendar systems

4 Utilities (Commands) For the remainder of this course, utilities and commands are considered the same. Linux commands are usually typed in lowercase followed by an argument (or arguments) Pressing ENTER or RETURN signals that you have completed giving an instruction and that you are ready for the OS to execute the command or respond to your message

5 Linux (Unix) Command Format command [arg 1] [arg 2] … [arg n] An argument is a filename, string or text, or some other object that a command acts upon An option is also an argument that modifies the effect of a command A space, a number of spaces, or a tab can be used to separate command from argument, or separate arguments.

6 Correcting Mistakes You can correct mis-typed command prior to pressing ENTER or RETURN Erase Characters Backspace or CTRL-Backspace or CTRL-h Delete a Word CTRL-w Delete an Entire Line CTRL-u

7 Correcting Mistakes Aborting Program Execution DELETE or CTRL-c Recalling Previous Commands Depends on shell &.profile setup Phobos (check.profile for VISUAL variable): if VISUAL=vi (K - up, J - down) if VISUAL=emacs Gothic: Up arrow, Down arrow

8 man A comprehensive online manual for common UNIX commands format: man [options] command Options: -k provides short (one-line) explanation relating to the commands matching the character string eg. man -k mkdir

9 passwd Used to change existing password format: passwd [options] Options: -f changes the user information accessed by the finger command

10 cal Used to display a calendar Format: cal [month] [year] (calendar for specified month & year) cal (displays calendar for current month) eg. cal 12 2000 (displays calendar month of December Year 2000)

11 date Used to display or set the time & date Format: date [option] [+format] +format argument specifies format of display After the + sign, can specify (within quotes) text as well as % followed by a field descriptor to indicate how date will be displayed

12 date Popular Field Descriptors: %A Full Weekday name %d Number of day %B Full month name %m Number of month %y Last 2 digits of year %Y 4-digit-year % I Hour %H Hour (Military time) %M Minutes %S Seconds %n New Line %r h:m:s with am or pm eg. date +”Today is %A” (note no space between + and “) %n is used to advance to the next line

13 whereis / which whereis is a utility that lists all directory paths that contains command or program For Example: whereis mv which is a utility that lists only the directory path that the shell will run the command or program (used to help avoid confusion if more that 1 command but perform differently. Example: which mv

14 Working with Files file, cat, more, less grep, head, tail cp, mv, ls sort, uniq, diff

15 file Used to classify the type of file: ASCII (text) or executable (binary) Format: file [options] file-list

16 cat Used to combine contents multiple files (“catenate” means to join together). Can be used to display contents of one file format: cat [options] [file-list] *Refer to on-line manual regarding options for cat command

17 more Displays a file, one screenful (spacebar) at a time or scroll one line at a time (RETURN) format: more [options] [file-list] Options: -d prompts user to continue at bottom of screen note: when searching for text within more process, user can type k/pattern? ENTER to initiate text search. In addition u for page up, d for down (can also use numbers to indicate amount of movement)

18 less Less is a program similar to more, but which allows backward movement in the file as well as forward movement (more movement options than more) Format: less [options] [file-list] Please refer to online manual for movement options

19 grep Used to search for a pattern which is stored in a file or files. Format: grep [options] pattern [file-list] Options: -c displays # of lines that contains a match -i ignores case sensitivity -n displays line number of file that contains a match -l displays only name of file that contains a match

20 head Display the beginning lines of a file format: head [-number] [file-list] * “-number” indicates the number of lines (from the beginning of the file) that you want to have displayed

21 tail Displays the tail or ending lines of a file format: tail [-number] [+number] [options] [file] * “-number” indicates the number of lines (from the bottom of the file) that you want to have displayed. “+number” indicates line number to display until end (tail) of file

22 cp Used to copy one or more files format: cp [options] sourcefile destinationfile Options: -r subdirectories & contents are copied -i prompts user to overwrite existing file

23 mv Used to move or rename files format: mv [options] oldfilename newfilename mv [options] existingfile-list directory mv [options] existingdirectory newdirectory Options: -i prompts user to overwrite existing file

24 ls Used to display information regarding a file or directory format: ls [options] [file-list] Options: -a short display of all files (incl. hidden files) -l detailed display of files (excl. hidden files) -al detailed display of all files -Fdisplays / after directory, * after executable file

25 sort Used to sort or merge files. Particularly useful as a filter to sort standard input. Format: sort [options] [field-specifier-list][file-list] Examples sort output.txt who | sort | more ls | sort > listing.txt

26 uniq Used to display lines from a file that are unique. Used after a sort, uniq will only display total “unique” lines of text uniq [options] [inputfile] [outputfile] Options: -c preceed line with # of occurrence line in input file -d display only lines that are repeated -u display only lines that are not repeated

27 diff Displays the differences between two files. Provides instructions as to editing steps to make files identical diff [options] [file1] [file2] diff [options] [directory1] [directory2] Options: -b ignore blanks

28 Communicating with Others who talk write mesg finger

29 who Used to display names of users logged into system Format: who [options] who or who am i or whoami Options: -H displays head above user information -i displays # of minutes user was idle -T displays message reception status

30 talk / write talk allows user to conduct a two-way text-based conversation. To initiate talk you type: talk phobos_user_id (use who -T to determine if user is receiving messages) write is used to send a message to another user. To send a message, type: write phobos_user_id (Mainly used to broadcast a message but can be used to chat - user who -T to check mesg status first)

31 mesg Used to “turn on” or “turn-off” reception of messages from other users. To turn on message reception status, type: mesg y To turn-off message reception status, type: mesg n

32 finger Used to display user names and related information format: finger [options] [user-list] Options: -l displays detailed information of all users -m matches names specified from user-list -q displays short report of users logged on -s displays a short report for each user incl.name

33 finger Interesting point: finger utility will display contents in file “.plan” and “.project” in the user’s home directory. These files are useful to provide additional information about the user eg. finger msaul (In phobos) finger jankul (In phobos) Note: you need to set the file permissons to allow group & others to read file!


Download ppt "Agenda Chapter 1: Linux (Unix) Features Commands (Chapters 2 & 3) Command Structure / Command line editing man, passwd, cal, date, whereis, which Working."

Similar presentations


Ads by Google