welcome to linux
Download
Skip this Video
Download Presentation
Welcome to Linux

Loading in 2 Seconds...

play fullscreen
1 / 23

Welcome to Linux - PowerPoint PPT Presentation


  • 94 Views
  • Uploaded on

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

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'Welcome to Linux' - stan


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.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
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
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!
toggle between interfaces
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
all linux s objects are files
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’
file permissions
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--

directory tree
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.

directory tree7
Directory Tree

/

/var

/usr

/etc

/bin

/boot

/home

/root

/parr

/brooks

/cruse

superuser

The ‘/home’ directory contains a sub-directory for each authorized user.

directory tree8
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

directory tree9
Directory Tree

/

/var

/usr

/etc

/bin

/boot

/home

/X11

/hosts

/fstab

/inittab

The ‘/etc’ directory stores files concerned with the system’s configuration-options.

directory tree10
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’ ).

directory tree11
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.

directory tree12
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).

unique filenames
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’

the online manual
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)
command usage examples ls
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’
my own top 30 commands
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
my top 30 continued
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
my top 30 continued18
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
my top 30 continued19
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
recommend keeping a journal
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 *
some practice exercises
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
some exploration exercises
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 /

an advanced exercise
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

ad