1 / 36

Operating Systems and Using Linux

Operating Systems and Using Linux. Topics What is an Operating System? Linux Overview Frequently Used Linux Commands Reading None. What is an Operating System (OS)?. A computer program Performs many operations, such as:

doyle
Télécharger la présentation

Operating Systems and Using Linux

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. Operating Systems and Using Linux Topics • What is an Operating System? • Linux Overview • Frequently Used Linux Commands Reading None.

  2. What is an Operating System (OS)? • A computer program • Performs many operations, such as: • Allows you to communicate with the computer (tell it what to do) • Controls access (login) to the computer • Keeps track of all processes currently running • At this point, your main concern is how to communicate with the computer using the OS

  3. What Is A Process? • A process is a task or program that you have requested the operating system do on your behalf. • That process is given an identifying number, called a PID (process ID).

  4. How Do I Communicate With the Computer Using the OS? • You communicate using the operating system’s user interface. • Graphical User Interface (GUI) – Microsoft Windows, Linux KDE • Command-driven interface - DOS, UNIX, Linux, Microsoft Command Prompt • We will be using the Linux operating system, which is very similar to UNIX.

  5. How Do I Communicate With the Computer Using the OS? (con’t) • When you log in to the Linux system here, a user • prompt will be displayed: • linux#[1]% _ • where # is the number of the Linux server that you have connected to. You may use any of the Linux servers. • The number in the brackets will change as you work. It is • the “number” of the command that you are about to type. • If this prompt is not on the screen at any time, you are not • communicating with the OS.

  6. User Prompt • While the normal (or default) prompt is:linux#[1]%you can change this. • To learn Linux well enough to do this, we recommend that you take CMSC121, a one credit course.

  7. Linux Overview • Files and Filenames • Directories and Subdirectories • Frequently Used Commands

  8. Files • A file is a sequence of bytes. • It can be created by • a text editor (xemacs or pico) • a computer program (such as a C program) • It may contain a program, data, a document, or other information . • Files that contain other files are called directories (sometimes called folders).

  9. Linux Filenames • Restrictions • May not contain blanks or other reserved characters. • Have a maximum length (however, make your filenames long enough to be useful and short enough to type without making a mistake. • Are case sensitive. • It is best to stick with filenames that contain letters (uppercase or lowercase), numbers, and the underscore ( _ ) for now. • Filenames that start with a period are hidden files, so that when see the files in a directory, they don’t show up.

  10. Directories • Directories contain files or other directories called subdirectories. They may also be empty. • Directories are organized in a hierarchical fashion, or directories can contain other directories. • They help us to keep our files organized.

  11. Directories (con’t) /afs/umbc.edu/users/j/d/jdoe28 junk recipes notes pies cookies CMSC104 apple peach choc_chip

  12. Directories (con’t) • One example is to have a directory for CMSC104. • Inside you could have a directory for each project, and whatever. • Rule of Thumb: Never have more files in one directory than fits on the screen when you list them.

  13. Directories (con’t) • Your home directoryis where you are located when you log in (e.g., /afs/umbc.edu/users/j/d/jdoe28). • The current directory is where you are located at any time while you are using the system. • Files within the same directory must be given unique names. • Paths allow us to give the same name to different files located in different directories. • Each running program has a current directory and all filenames are implicitly assumed to start with the name of that directory unless they begin with a slash.

  14. Subdirectories • Are used for organizing your files • For example, • make a subdirectory for CMSC104 • make subdirectories for each project CMSC104 project1 project2 . . . project8

  15. Moving in the Directory Tree • . (dot) is the current directory. • . . (dot-dot) is the parent directory. • Use the Linux command cd to change directories. • Use dot-dot to move up the tree. • Use the directory name to move down. • Use the complete directory name (path name) to move anywhere.

  16. Pathnames • Pathnames that start at the beginning (and start with a /): /afs/umbc.edu/users/j/d/jdoe28are called absolute pathnames. • Pathnames can be shorted, so that if jdoe28 is the current directory and we have a file in that directory call schedule, we can edit it with just the filename (a relative pathname):pico schedule

  17. Permissions • Files and directories have permissions. • There are three sets of permissions for three groups: • Read, write, execute (or, if a directory, access) • User, group, other • You are the user, and can set and change permissions.

  18. Frequently Used Linux Commands • passwd, man, lpr • pwd, ls, cat, more, cd, cp, mv, rm • mkdir, rmdir • ctrl-c, ctrl-z References: • Linux man pages • Links from the 104 homepage • Books and the Internet

  19. Linux Command Format • Fromat: cmd options arguments • Options and arguments are optional. • Options start with - or - - • Options are different for each command. • Arguments are different for each command. • When in doubt, look up the command in the on-line help, man.

  20. man • On-line help. • Argument is the command you wish to have help for. • Option –k is most common, which looks for a description that contains the argument. • When the description of a command takes more than one screen to display, press the space bar for more information and q to quit.

  21. man (cont’d) • Example:[burt@linux1 ~]$ man -k passwd htpasswd htpasswd (1) - Create and update user authentication fileskpasswd kpasswd (1) - change a user's Kerberos password mkpasswd mkpasswd (1) - generate new password, optionally apply it to a user passwd.nntp passwd.nntp (5) - passwords for connecting to remote NNTP servers saslpasswd saslpasswd (8) - set a user's sasl passwordsaslpasswd2 saslpasswd2 (8) - set a user's sasl password v5passwd v5passwd (1) - change a user's Kerberos password

  22. passwd • Used to change your password.NAME passwd - update a user's authentication tokens(s) SYNOPSIS passwd [-k] [-l] [-u [-f]] [-d] [-n mindays] [-x maxdays] [-w warndays] [-i inactivedays] [-S] [username]

  23. lpr • Used to print something on the printer. • You must pay per page. • Pick up your print-out at ECS-019.

  24. cd • Change directory. • With no argument, it will take you back to your home directory. • With a argument, it will set that directory to be your current working directory, assuming you have permission to access the directory.

  25. pwd • Print the current working directory. • Helpful when you forget where you are. • Has no options or arguments.

  26. ls • Lists the names of files in a directory. • Arguments are name(s) of file(s) and/or director(ies). • Normally, when you specify a directory, you get the contents of the directory.

  27. ls Options • -a all (including hidden files) • -d just show the directory, not the files in the directory • -F classify files as ordinary, directory (/), or executable (*) • --color classify with color • -l long format • -r show in reverse order • -R recursive, show the contents of all subdirectories.

  28. cat • Used to display the contents of a file. • If there is too much to fit on the screen, the first part scrolls off and leaves only the last screenful. • Argument is the name of a file or files. • Useful option is –n (or –number) to show the line numbers.

  29. more • More shows a screen full of a file at a time. SYNOPSIS more [-dlfpcsu] [-num] [+/ pattern] [+ linenum] [file]DESCRIPTION More is a filter for paging through text one screenful at a time. This version is especially primitve. Users should realize that less(1) provides more(1) emulation and extensive enhancements. • Less is a similar command with more features.

  30. cp • This allows you to create a new copy of an existing file. • Two mandatory arguments, source and destination. • Source is the name of the existing file. • Destination is the name for new file. • If you change the contents of the new file, you do not change the contents of the old file.

  31. ln • Allows you to create two names for one file by “linking” them, similar to a shortcut in Microsoft Windows. • Two mandatory options are the source and destination, just like for cp. • If you change the new version, you change the old version.

  32. mv • This allows you to rename a file and/or move it to a new location. • Two mandatory arguments, source and destination. • Source is the name of the existing file. • Destination is the new name and/or location for the existing file. • At completion, there is only one file.

  33. rm • Allows you to remove or delete a file. • Normally, once a file is removed, it is gone forever! • (UMBC has changed this and it moves the file to a backup directory, where you can recover it, if necessary. However, this is not a long-term option!)

  34. rm (cont’d) • The argument(s) are a list of files to remove. • Options include: • -i interactive, ask first (UMBC has set this as the default) • -r recursive, delete the files in the subdirectories and the subdirectories. • NOTE: rm –r directory will remove directories that are not empty!

  35. mkdir • Used to create a new directory. • Argument(s) is/are the name(s) of the new directory(ies).

  36. Wildcard Characters • You will find wildcard characters useful when manipulating files (e.g., listing or moving them). • The wildcard characters are * and ? • ? is used to represent any single character. • * is used to represent 0 or more characters.

More Related