1 / 19

INTRODUCTION TO LINUX

INTRODUCTION TO LINUX. Jacob Chan. GNU/Linux. Consists of Linux kernel, GNU utilities, and open source and commercial applications Works like Unix Multi-user multi-tasking Networking GUI (Fedora, Linux Mint) Stable and robust, but it’s for free (open source) Written by Linus Torvalds.

rufus
Download Presentation

INTRODUCTION TO 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. INTRODUCTION TO LINUX Jacob Chan

  2. GNU/Linux • Consists of Linux kernel, GNU utilities, and open source and commercial applications • Works like Unix • Multi-user • multi-tasking • Networking • GUI (Fedora, Linux Mint) • Stable and robust, but it’s for free (open source) • Written by Linus Torvalds

  3. Comparison with Windows • Windows is easy to install. BUT it • Is unstable • Performs poorly • Crashes frequently • Linux is trickier to install and configure. BUT • Stable • Performs better than Windows • Crashes more rarely than Windows • It is also more flexible than Windows. • Linux takes time to master, but it is very powerful

  4. Typing Commands in Linux • Format:command -option --argument • Separated by whitespace • Commands work on the supplied arguments (much like behaves like a method) • Options modify the standard behavior (like the file is readable/writeable/executable)

  5. Creating a User Account • How: adduserlogin_name • Password will be prompted • You can log out then log in as the account you created • WARNING: Don’t use the system as the super user (root) • If you accidentally delete this, EVERYTHING will be gone (it’s the same as reformatting)

  6. Getting help from online sources • How • man command • info command • whereis command • apropos command • Try typing ls /usr/man/man1

  7. Files • ALL programs, data, hardware devices are considered FILES in the Unix system • Each file has a name. They are arranged in directories, which are also files • Each file belongs to an owner or a group • The owner, the group, and the rest of the world can either read, write, or execute, provided that they are permitted to do so by the file owner or the super user (root)

  8. File Types • Regular Files (-): executables, text files, data files, libraries • Directories (d): named references to other files • Character device files (c) • Block device files (b) • Symbolic links (l): file containing a pathname (which may or may not exist) • Hard links: directory entry that exists in same partition

  9. Pathnames • Name of a file together with names of directories and subdirectories it is contained • Absolute pathname: pathname relative to root (/var/) • Relative pathname: pathname relative to the current directory (cs162b/student_profiles)

  10. Root files /bin and /sbin – executables needed at boot time./boot – contains the Linux kernel and boot data./dev – contains device files./etc – contains the system configuration files./home and /root – home directories of users./lib and /usr/lib – contains the shared libraries./proc – contains info about running processes./tmp and /var/tmp – directory for temporary files./usr/bin and /usr/sbin – contains executables./var – contains data files for reading/writing./opt – contains optional packages.

  11. Create and View (Text) Files • File Creation vi filename edfilename emacsfilename • File Viewing cat filename more filename less filename

  12. File Manipulation • Moving files mv old new (rename old to new) mv file folder (move file to folder) • Copying files cporiginal duplicate (copy original file to duplicate) cp –a folder1 folder2 (copy all contents of folder 1 to folder 2; useful for backing up) • Removing files rm –f file (delete file forcibly) rm –rfdirectory (recursively delete directory and all contents)

  13. File Statistics wc –lwcfile (counts lines, words, characters in file) grep –v pattern file (prints all lines of file that has doesn’t have the pattern) sort –r file (sorts file in increasing/decreasing order) head –n file (prints first n lines of file) tail –n file (prints last n lines of file)

  14. File Statistics cut –cJ-K file (prints all characters in positions J to K of the file cut –dD –fJ-K file (prints all characters in positions J to K with D as the delimiter) cmpfile1 file2 (show location of first difference between file1 and file2) diff file1 file2 (show ALL differences between file1 and file2)

  15. Other File Commands ln –s filename linkname (create a symbolic link; NOTE: the file needs not to exist) lnfile newfile(create hard links of a file, in which newfile is the alias of the file) touch filename (create empty file or to update file’s date)

  16. Directory Commands pwd (print working directory) cd (home directory will be the working directory) cd dirname (dirname will be the working directory) mkdirdirname (create a new directory dirname) rmdirdirname(remove directory name)

  17. Permissions chmod (change permissions to a file) chmod 777 file (owner, group, world) for each digit: read write executable chown (change owner of file) chownowner.groupfile chgrp (change group of a file) chgrpgrpname file unmask (set file creation mask; what are not allowed in creating directories/files) unmask 022

  18. Next Week • Shell Scripting • First lab on shell scripting • More practice on Linux

  19. THE END

More Related