1 / 90

Date: DISPLAYING THE SYSTEM DATE

Features of UNIX 1. UNIX: A Multiuser System 2. UNIX: A Multitasking System 3. The Building Block Approach 4. The UNIX Toolkit 5. Pattern Matching 6. Programming Facility 7. Documentation. Date: DISPLAYING THE SYSTEM DATE. Echo : DISPLAYING MESSAGE. Printf : AN ALTERNATIVE TO echo.

yitta
Download Presentation

Date: DISPLAYING THE SYSTEM DATE

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. Features of UNIX1. UNIX: A Multiuser System2. UNIX: A Multitasking System3. The Building Block Approach4. The UNIX Toolkit5. Pattern Matching6. Programming Facility7. Documentation

  2. Date: DISPLAYING THE SYSTEM DATE

  3. Echo : DISPLAYING MESSAGE

  4. Printf: AN ALTERNATIVE TO echo

  5. Script: RECORDING YOUR SESSION

  6. banner: CREATES ART POSTER • $ banner Hello! • It prints characters in a sort of ASCII art poster.

  7. calendar: REMINDERS FOR THE DATE • This command reads the calendar file and displays only lines with current day. For example in the calendar file if we have this 12/20 Test new software. 1/15 Test newly developed 3270 product. 1/20 Install memory on HP 9000 machine. The above data must be set-up as a file called calendar in the home directory $ calendar On dec 20th the first line will be displayed.

  8. Passwd: CHANGING YOUR PASSWORD

  9. Who: WHO ARE THE USERS?

  10. Uname: KNOWING YOUR MACHINE’S CHARACTERISTICS

  11. tty: KNOWING YOUR TERMINAL

  12. stty: DISPLAYING AND SETTING TERMINAL CHARACTERISTICS

  13. sometimes user have to be away from his terminal, but don’t want to logout because a job is running in the background. This is done by ‘lock’ command. It requires you to enter a password when you decide to lock it. Syntax$ lockPassword : ****** Re-enter password : ****** Terminal locked by Ram 0 minutes ago lock – LOCKS THE TERMINAL

  14. The lock utility requests a password from the user, reads it again for verification and then will normally not relinquish the terminal until the password is repeated. • There are two other conditions under which it will terminate: it will timeout after some interval of time and it may be killed by someone with the appropriate permission. • The following options are available: • -n Do not use a timeout value. Terminal will be locked forever. • -p A password is not requested, instead the user's current login password is used. • -ttimeout The time limit (default 15 minutes) is changed to timeout minutes.

  15. tput- INITIALIZES A TERMINAL • tput utility initializes or resets the terminal or even clears the screen. • Examples: • $ tput clear : Clears the screen • $ tput cols : Prints the number of columns for the current terminal • $ tput cup 15 8 : Moves the cursor to row 15 and column 8.

  16. spell – SPELL CHECK • The spell command collects words from the named files and looks them up in a spelling list. Words that neither occur among nor are derivable (by applying certain prefixes or suffixes) from words in the spelling list are written to the standard output. • If there are no file arguments, words to check are collected from the standard input.

  17. Example:$ spell input.txt It spell Checks the file input.txt$ spellintoduction to UNIXintoduction$ spell This is the storryabuot an operating system that went from baad to wurseabuotbaadstorrywurse

  18. ispell – INTERACTIVE SPELL CHECK • $ ispell filename • In this case, for each word that does not appear in its dictionary, ispell will display the word at the top of the screen and allow you to change it. • If the dictionary contains any near misses (i.e., words that differ by only a single letter, a missing or extra letter, a pair of transposed letters, or a missing space or hyphen), ispell will display them on following lines. • As well as near misses, ispell may display other guesses at ways to make the word from a known root, with each guess preceded by question marks.

  19. ispell will print the line containing the word and the previous line at the bottom of the screen. ispell also highlights the word itself. You can replace the word completely, or choose one of the suggested words. Basic ispell commands include: r Replace the misspelled word completely. Spacebar Accept the word this time only. a Accept the word for the rest of this ispell session. i Accept the word, capitalized as it is in the file, and update the private dictionary. u Accept the word, and add a lowercase version to the private dictionary. 0, 1, ... n Replace with the suggested word corresponding to that number.

  20. pwd – CHECKING CURRENT DIRECTORY • Print Working Directory • We can move around from one directory to another , but any point of time , we are located in only one directory. This directory is known as current directory. • To know the current directory this command is used. • $ pwd/home/kumar

  21. cd – CHANGING THE CURRENT DIRECTORY • Change Directory command • We can move around in the file system using this command. • When used with an argument, it changes the current directory to the directory specified as argument, for instance, progs. • $ pwd/home/kumar$ cdprogsprogs must be in current directory$ pwd/home/kumar/progs

  22. cd – CHANGING THE CURRENT DIRECTORY • When we need to switch to the /bin directory where most of the commonly used UNIX commands are kept, we should use the absolute pathname. • $ pwd/home/kumar/progs$ cd /bin Absolute pathname required here because $ pwdbin isn’t in current directory /bin

  23. cd – CHANGING THE CURRENT DIRECTORY • cd can also be used without any arguments. • It switches to the home directory. i.e., the directory where the user originally logged into. • $ pwd/home/kumar/progs$ cdcd used without arguments $ pwd reverts to the home directory /home/kumar

  24. cd – CHANGING THE CURRENT DIRECTORY • if we wander around in the file system, we can force an immediate return to the home directory by simply using cd. • $ cd /home/sharma $ pwd/home/sharma$ cdReturns to home directory $ pwd/home/kumar

  25. mkdir – MAKING DIRECTORIES • Make Directory command • The command is followed by names of the directories to be created. • A directory patch is created under the current directory like this: • $ mkdir patch • We can create a number of subdirectories with one mkdir command. • $ mkdir patch dbs doc Three directories created

  26. mkdir – MAKING DIRECTORIES • Creates directory trees with just one invocation of the command. • The following command creates three subdirectories – pis and two subdirectories under pis named progs and data. • $ mkdirpispis/progspis/data Creates the directory tree

  27. mkdir – MAKING DIRECTORIES • The order of specifying the arguments is important. • We can’t create a subdirectory before creation of it’s parent directory. • $ mkdirpis/data pis/progspismkdir: Failed to make directory “pis/data”; No such file or directory mkdir: Failed to make directory “pis/progs”; No such file or directory • Note that even though the system failed to create the two subdirectories, progs and data, it has still created the pis directory.

  28. mkdir – MAKING DIRECTORIES • Sometimes, the system refuses to create a directory. • $ mkdir test mkdir: Failed to make directory “test”; Permission denied • The directory test may already exist. • There may be an ordinary file by that name in the current directory. • The permissions set for the current directory don’t permit the creation of files and directories by the user. • We can’t create directories in /bin, /etc or any other directory that houses the UNIX system files.

  29. rmdir – REMOVING DIRECTORIES • Remove Directory command • This command removes directories. • To remove the directory pis: • $ rmdirpisDirectory must be empty • It can also delete more than one directory in one shot. • $ rmdirpis/data pis/progspis

  30. rmdir – REMOVING DIRECTORIES • The following directory sequence is invalid in rmdir. • $ rmdirpispis/progspis/data rmdir: directory “pis”: Directory not empty. • Here rmdir has silently deleted the lowest level subdirectories progs and data. • We can’t delete a directory with rmdir unless it is empty. • We can’t remove a subdirectory unless we are placed in a directory which is hierarchically above the one we have chosen to remove. • $ cdprogs $ pwd/home/kumar/pis/progs$ rmdir /home/kumar/pis/progsTrying to remove the current directory rmdir: directory “/home/kumar/pis/progs”: Directory does not exist

  31. rmdir – REMOVING DIRECTORIES • To remove the directory, we must position ourself in the directory above progs. • $ cd /home/kumar/pis $ pwd/home/kumar/pis$ rmdirprogs • The directory progs removed. • mkdir and rmdir commands work only in directories owned by the user.

  32. ls – LISTING DIRECTORY CONTENTS

  33. ls – LISTING DIRECTORY CONTENTS

  34. ls – LISTING DIRECTORY CONTENTS

  35. ls – LISTING DIRECTORY CONTENTS

More Related