1 / 24

Introducing the UNIX Operating System

Introducing the UNIX Operating System. What is UNIX ?. A family of operating systems. Multitasking. IRIX SOLARIS AIX LINUX Digital UNIX HP-UX. Multiuser. Runs more than one program at the same time.

Download Presentation

Introducing the UNIX Operating System

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. Introducing the UNIX Operating System EMBnet www.embnet.org

  2. What is UNIX? • A family of operating systems • Multitasking IRIX SOLARIS AIX LINUX Digital UNIX HP-UX ... • Multiuser Runs more than one program at the same time. A busy system can be running several hundred or even thousands of programs at the same time. • Networked Many different people can use the system at the same time. It is designed to be linked to other computers and to allow people to work over a network. The network IS the computer. EMBnet www.embnet.org

  3. users Xprog X · What does UNIX do? • Pointy, clicky program. • Any number of users can use any number of programs and methods to access the system from any number of remote machines at the same time. • The X Window System • Graphical interface (point, click, drag, drop etc.) • Network enabled • Can use many programs at once • Is a separate program • Easier to use than the shell but less powerful • User Interaction • Many different users, typically accessing the system from remote machines in different ways • The Shell (or command line) • Allows the user to interact directly with the computer by typing commands. • The shell interprets these and instructs the kernel accordingly. • Very powerful but can be intimidating • Controls access to the hardware. • Prevents programs interfering with each other. • Provides an easy way for programmers to talk to the electronics. • Controls data storage and protection. Disk storage Memory Network adapter Modem Screen Keyboard • Console programs • Run from the shell • Use one program actively at a time unix> help X Press ENTER to continue: UNIX Kernel The Computer EMBnet www.embnet.org

  4. Logging in Unix doesn’t really care where you log in from, though some system administrators might. You must have a username (login id) to use a unix system Have graphical output sent anywhere you have permission Log in from anywhere you have permission Every user is a member of one or more groups of users. This identifies you to the system so it can manage your work properly. This helps the system manage different types of user properly. EMBnet www.embnet.org

  5. Logging in Connect to the unix machine using a suitable program on your local machine. Connecting to embnet.org Connected. Welcome to the European Molecular Biology Network. Login: Telnet Xterm Secure Shell Kermit Other terminal emulators You may get some messages here from the system administrator. username Password: unix is case sensitive. username isnotthe same as Username orUSERNAME unix doesn’t show anything on the screen as you type your password. The system will be unavailable on friday afternoon for maintenance. You have new mail. username@embnet ~> EMBnet www.embnet.org

  6. The shell or command line Several different shells but they behave more or less the same 1. The Prompt. username@embnet ~> your username your present location the machine you are logged in to The prompt can be customised to look how you wish EMBnet www.embnet.org

  7. ls -ald *.txt ls -ald *.txt ls -ald *.txt ls -ald *.txt The first word is a command The subsequent words form a list of arguments to the command arguments beginning with - are options * is a special character. It means ‘any group of characters’ (including none). The shell finds all the filenames that match anything.txt and adds them to the list of arguments The shell or command line 2. Commands username@embnet ~> ls -ald *.txt The shell breaks the command up into individual words By default the boundary between words is a space. To get the shell to treat a phrase that includes spaces as a single word, put it in quotes like this: 'my word' or "my word". Options control how the program runs. '-a -l -d' is equivalent to '-ald' EMBnet www.embnet.org

  8. More Special Characters Any single character. word delineation Any group of characters including none. * ? " ' Redirect the commands output, eg. to a file Redirect a commands input. eg. from a file instead of the keyboard. Pipe. Pass the output of the command on the left as the input to the command on the right. Cause the process to run in the background & | > < Backticks (not '). Take the output of the command as an argument Backslash. Change the meaning of the next character. Semicolon Seperate commands typed in together. String or Dollar Treat the next word as a variable and write out its value `` $ \ ; Some special characters can lose their special meaning if they are inside quotes. EMBnet www.embnet.org

  9. Organisation "Everything is a file" • An ordinary file contains data. • A directory contains other files. • A link is a file that is a shortcut to another file. The data could be an image, a document, a set of instructions (a program) or any fixed information. • There are many other types of file . This is also known as a folder on some systems. A directory can contain other directories (which are then known as sub-directories.) Files can have more than one name, and be in different directories at the same time You don't need to worry about these. You probably won't come across one in normal use of the system. EMBnet www.embnet.org

  10. / bin usr home home username etc username prot prot letter project seq4 seq3 seq2 seq1 /home/username/prot /home/username/prot /home/username/prot /home/username/prot Organisation of the file system / The top of the file system is the directory '/', commonly known as the root directory Several subdirectories under the root directory An example users home directory with a subdirectory and several files Any file in the file system can be uniquely identified by describing the path to it from the root directory. Another subdirectory. EMBnet www.embnet.org

  11. / bin usr home etc username prot letter project seq3 seq2 seq1 seq4 /home/username Organisation of the file system Any process is located somewhere in the filesystem The command 'pwd' will tell you where. username@embnet ~> pwd '~' is a unix shortcut meaning 'your home directory' EMBnet www.embnet.org

  12. / bin usr home etc username prot letter project seq3 seq2 seq1 seq4 Looking at the file system 'ls' lists the files in a directory or directories There are many options to ls that allow you to select and control the information it presents. Without an argument, ls lists all the files that don't start with . in the current directory username@embnet ~> username@embnet ~> ls ls project prot letter project project: seq1 seq2 seq3 seq4 EMBnet www.embnet.org

  13. / bin usr home etc username prot letter project .. seq3 seq2 seq1 seq4 username@embnet ~> '..' means the parent directory. '.' means the current directory. /home/username/project /home/username/project /home/username repeat using the relative path Moving around the file system You can move to a different directory with the command 'cd directory ' 'directory' is the directory to which you want to move. The name can be written as the full path (from root) or as the relative path (from your current directory) username@embnet ~/project> username@embnet ~> username@embnet ~> cd /home/username/project cd project cd .. username@embnet ~/project> username@embnet ~> username@embnet ~/project> pwd pwd pwd EMBnet www.embnet.org

  14. / bin usr home etc username model prot letter project seq3 seq2 seq1 seq4 username@embnet ~> Changing the file system You can create a new subdirectory in the current directory with the command ' mkdir directory ' username@embnet ~> mkdir model EMBnet www.embnet.org

  15. model / username@embnet ~> bin usr home etc username model prot letter project seq3 seq2 seq1 seq4 username@embnet ~> Changing the file system You can delete an empty subdirectory with the command ' rmdir directory ' You can delete a file with the command ' rm file ' username@embnet ~> You can delete a subdirectory and its contents with the command ' rm -rfdirectory' rmdir model rm prot EMBnet www.embnet.org

  16. More about files: filenames Filenames can contain any normal text character including spaces and special characters. Filenames can be almost any length. It is best to stick to a-z, A-Z, _, -, and numbers. If a filename contains a special character or a space you may need to put quotes around the whole path. It is best to keep them short as it saves typing. Special characters in filenames can cause problems with some programs. EMBnet www.embnet.org

  17. More about files: reading files You can print the contents of one or more files to the screen with the command: 'cat file1 file2 ...' You can view the contents of one or more files a page at a time on the screen with the command: ' more file1 file2 ...' cat prints the whole file at once, so a file longer than just a few lines will run off the top of your screen. You can print the first few lines of a file with the command: 'head file1 file2 ...' more will let you search through a file, go backwards and forwards and has many other functions. The last few lines can be viewed with 'tail' EMBnet www.embnet.org

  18. More about files: editing files You can change the content of text files and create new files with a text editor. Text editors edit text. They do not try to format the text like word processors. PICO EMACS A novice friendly basic text editor used as standard on many systems. Start with the command 'pico filename' VI A powerful editing environment which can be programmed. It has many modes for auto layout of program code. Start with the command 'emacs filename' A powerful editor which can be somewhat confusing for newcomers. It is designed for rapid editing of text files and programming. Start with the command 'vi filename' EMBnet www.embnet.org

  19. More about files: copying files You can copy a file with the command 'cp oldfilename newfilename' If newfilename is a directory, then the file will be copied to 'newfilename/oldfilename' username@embnet ~> ls letter project username@embnet ~> cp letter draft username@embnet ~> ls draft letter project username@embnet ~> Warning: If a file called newfilename already exists then it will be overwritten. The command 'mv oldfilename newfilename' can be used to rename a file EMBnet www.embnet.org

  20. Owner Group World More about files: permissions • Every file is protected to a greater or lesser extent. • Permissions determine who can read, write, or execute a given file. The user who owns the file Other users in the same group as the user who owns the file. All the other users in the system. • Files can have read, write or execute permission for each of the three types of user. EMBnet www.embnet.org

  21. -rwxr--r-- username -rwxr--r-- -rwxr--r-- users 6048 Aug 17 16:07 letter Permissions for everyone else Permissions for the owners group The user who owns the file The date the file was last modified The files size The files name Permissions for the owner The files group More about files: permissions You can view the permissions for a file by listing it in long format with the command 'ls -l filename' username@embnet ~> ls -l letter -rwxr--r-- 1 username users 6048 Aug 17 16:07 letter The letter l The file type: - - ordinary file d - directory l - link (shortcut) EMBnet www.embnet.org

  22. chmod o-r letter chmod o-r letter chmod o-r letter For whom you are changing permissions: o - other g - group u - user a - all Permissions being changed: r - read permission w- write permission x - execute (run) permission How you are changing permissions: - - remove these permissions +- add these permissions = - set permissions to this More about files: permissions You can change the permissions for a file with the command 'chmod changefilename' change is the modification you want to make to the files permissions username@embnet ~> ls -l letter -rwxr--r-- 1 username users 6048 Aug 17 16:07 letter username@embnet ~> chmod o-r letter username@embnet ~> ls -l letter -rwxr----- 1 username users 6048 Aug 17 16:07 letter username@embnet ~> EMBnet www.embnet.org

  23. Getting help You can get help on a command by using the command ' man command' If you do not know what a command is called, use the option '-k' to get a list of commands that may be relevant 'man -k word' This will bring up the manual page and show it to you screen by screen This will find all manual pages containing word in the short description of the command. Try using the options '-h', '-help', or '--help' if you can't find the man page. EMBnet www.embnet.org

  24. Useful literature 'Learning the UNIX operating system', O'Reilly press. 'UNIX Quickguide' EMBnet EMBnet www.embnet.org

More Related