1 / 23

Welcome to Linux

Welcome to Linux. A quick overview of some ideas and commands of most frequent use to programmers using Linux. Two interface options. The ‘modern’ graphical desktop interface: Objects are represented as colorful icons Users operate mainly by clicking the mouse

stan
Download Presentation

Welcome 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. Welcome to Linux A quick overview of some ideas and commands of most frequent use to programmers using Linux

  2. Two interface options • The ‘modern’ graphical desktop interface: • Objects are represented as colorful icons • Users operate mainly by clicking the mouse • It’s ‘intuitive’ (like Macintosh or Windows) • The ‘legacy’ command-line interface: • Objects are accessed by their file-names • Users operate by typing in commands • It’s flexible and powerful, but demands knowledge!

  3. Toggle between interfaces • If your workstation is configured for the Graphical Desktop Interface by default (also known as ‘runlevel 5’), it is easy to switch to the Command-Line Interface by typing a keystroke-combination: <CNTRL><ALT>-Fn (for n = 1, 2, ..., 6) • You can return to your Graphical Desktop by typing: <ALT>-F7

  4. All Linux’s objects are ‘files’ • All ordinary files are sequences of ‘bytes’ • Some store data, others store programs • Also there are some ‘special’ files (such as ‘directories’, device-files, and pseudo-files) • Each file has a unique name • Each file has a specific ‘owner’ • Each file has a set of ‘access permissions’

  5. File ‘permissions’ Owner Group All r w x r w x w w x Legend r = ‘read access’ (1 = yes, 0 = no) w = ‘write access’ (1 = yes, 0 = no) x = ‘execute access’ (1 = yes, 0 = no) Bitmap-example: 110-100-100 Octal representation: 0644 ASCII-representation: rw-r--r--

  6. Directory Tree / /var /usr /etc /bin /boot /home Linux organizes its hundreds of thousands of files into a tree-like hierarchy. For a current Linux installation (such as Fedora Core 5), the topmost directory (named ‘/’) will typically contain only about two-dozen sub-directories.

  7. Directory Tree / /var /usr /etc /bin /boot /home … /root /parr /brooks /cruse superuser The ‘/home’ directory contains a sub-directory for each authorized user.

  8. Directory Tree / /var /usr /etc /bin /boot /home … /System.map /vmlinuz /grub compressed kernel The ‘/boot’ directory contains the files and directories that are needed to select, load, decompress, and begin executing the Linux kernel

  9. Directory Tree / /var /usr /etc /bin /boot /home … /X11 /hosts /fstab /inittab The ‘/etc’ directory stores files concerned with the system’s configuration-options.

  10. Directory Tree / /var /usr /etc /bin /boot /home … /mkdir /chown /kill The ‘/bin’ directory contains about a hundred of the most necessary and basic binary-executables (such as the programs which implement the minimal set of commands you need for system-recovery in the unlikely event of a ‘crash’ ).

  11. Directory Tree / /var /usr /etc /bin /boot /home … /local /lib /src /include /bin The ‘/usr’ directory contains about a dozen sub-directories which organize the vast majority of the various kinds files needed for a useful work-environment. Together these sub-directories contain tens of thousands of files and programs.

  12. Directory Tree / /var /usr /etc /bin /boot /home … /lock /log /spool The ‘/var’ directory contains about two-dozen sub-directories that pertain to various value-added resourses (such as system log-files or users’ email).

  13. Unique filenames • To give each file a name that’s unique, the directory-tree hierarchy is utilized: / /home /brooks /cruse /hello /hello ‘/home/cruse/hello’ ‘/home/brooks/hello’

  14. The online ‘manual’ • Linux offers online documentation for all of its commands (and for its library functions) • You type ‘man <command-name>’ to view the relevant page of this online manual • Example: $ man ls # view ‘ls’ options • Some commands have numerous options that are explained (but seldom illustrated)

  15. Command-usage examples: ‘ls’ • The ‘LiSt’ command: $ ls • $ ls # files in present working directory • $ ls / # files in the topmost (‘root’) directory • $ ls ~ # files in YOUR home-directory • $ ls –l # files with their attributes • $ ls –a # files (‘all’ including the ‘hidden’ ones) • $ ls *.c # files having the ‘.c’ filename-suffix • $ ls * # files in every immediate sub-directory • $ ls .. # files in the parent-directory • $ ls my* # files whose names begin with ‘my’

  16. My own ‘top-30’ commands • cd # Change Directory • cp # CoPy file (or files) • mv # MoVe file (or files) • rm # ReMove file (or files) • rename # RENAME a file (or files) • who # who else is using station • mkdir # MaKe a new DIRectory • rmdir # ReMove DIRectory

  17. My “top-30” (continued) • scp # Secure CoPy • ssh # Secure Shell • lpr # Line-Printer • cat # conCATenate file(s) • grep # global reg-expr printer • uname -r # shows kernel-release • ln –s # creates a ‘soft’ link

  18. My “top-30” (continued) • vi # VIsually edit a text file • gcc # Gnu C Compiler • g++ # Gnu C++ compiler • as # Assembler • ld # Linker • make # compile-and-link script • objdump -d # disassemble program

  19. My “top-30” (continued) • tar # uncompresses a file • diff # compares two textfiles • exit # terminates a user-session • time # time a program’s execution • chmod # change file’s access-mode • su # Substitute User • more # view textfile page-at-a-time

  20. Recommend keeping a ‘journal’ Some notes I find useful for reference… • For extracting a new Linux kernel release • $ tar –xvf linux-2.6.16.6.tar • For combining several files of a new project • $ tar –cvf linux-2.6.16.6.tar *

  21. Some practice exercises… • Switch from your Graphical Desktop to a Text-Mode Console Interface (6 choices) • Switch from one text-console to another • Login to that console • Type the ‘ls’ command • Log out from that console • Return to your Graphical Desktop

  22. Some exploration exercises… • Use ‘cat’ to look at one of the hidden files in your own ‘home’ directory, like this: $ cat .bash_history • Use ‘ls’ to look at the names of all the files in your own ‘Desktop’ directory, like this: $ ls -a Desktop • Use ‘cd’ to change your current directory to the ‘root’ directory, like this: $ cd /

  23. An ‘advanced’ exercise • Create a subdirectory named ‘bin’ in your own home directory, like this: $ cd ~ # ‘~’ is your home-directory $ mkdir bin # creates ‘bin’ sub-directory • Copy a program-file from a class-website, then compile it, move the executable into your ‘~/bin’ subdirectory, and finally execute it, like this: $ cp /home/web/cruse/cs630/dump.cpp . $ g++ dump.cpp -o dump $ mv dump bin $ dump dump.cpp

More Related