Using the Linux Desktop - PowerPoint PPT Presentation

1 / 21
About This Presentation
Title:

Using the Linux Desktop

Description:

Using the Linux Desktop. In this lecture you will learn: How to navigate a Linux desktop ... IDEs vs command line tools. GCC. GCC- Gnu Compiler Collection ... – PowerPoint PPT presentation

Number of Views:42
Avg rating:3.0/5.0
Slides: 22
Provided by: openmig
Category:
Tags: desktop | ides | linux | using

less

Transcript and Presenter's Notes

Title: Using the Linux Desktop


1
Using the Linux Desktop
  • In this lecture you will learn
  • How to navigate a Linux desktop
  • How to add and remove software
  • How to use essential command line tools
  • and the basics of Linux programming

2
First Steps
  • Starting desktop applications
  • Click the 'Applications' menu bar
  • Under 'Accessories', find 'Text Editor'
  • Click on it.
  • Now try to find and run Firefox
  • Go to OpenMigration.net

3
Installing applications
  • Click on the 'System' tab at the upper left hand
    corner of the screen
  • Under 'Administration', click on 'Synaptic
    Package Manager'
  • Search for 'kenolaba'
  • Click on it and select 'mark for installation'
  • Hit the 'apply' button

4
Using the terminal
  • To start the terminal, go to
    Applications-gtAccessories-gtTerminal
  • To run an application, type its name, then its
    arguments, then hit enter
  • Try it out with 'ls'. It will print a list of the
    contents of the current directory.

5
Special Characters
  • Tabs are used for automatic command completion
  • is the 'wildcard' character
  • 'command ' runs command in the background
  • 'command gt filename' pipes the output of command
    to filename
  • 'command1 command2' pipes the output of
    command1 to the input of command2
  • '' references the current user's home directory

6
Basic Commands
  • Use 'man commandname' to find out more about a
    command
  • Use 'apropos keywords' to find commands related
    to the keywords
  • 'sudo command' allows you to run command as root

7
Aside root
  • On every Linux machine, there is a user named
    root
  • root is a user with total privilege- ie, they can
    run any program, edit any file, format any disk
  • root powers can turn an innocent mistake or minor
    mischief into an absolute disaster
  • Use root only as absolutely necessary

8
File Commands
  • 'ls' lists the current directory
  • 'cd directory' changes the current directory to
    directory
  • 'find name' finds files by name
  • 'rm filename' removes filename
  • 'mkdir name' makes a directory called name
  • 'cp name destination' copies file to destination
  • 'mv name destination' moves file to destination

9
File Commands II
  • 'chmod options filename' changes the file
    permissions on filename
  • 'chown username filename' makes username the
    owner of filename
  • 'chattrs options filename' changes extended file
    attributes on filename

10
Aside permissions
  • File permissions are a fundamental part of Linux
    security
  • Base file permissions are read(4), write(2), and
    execute(1), and are set for the owner, owning
    group, and everybody else
  • Ex 'chmod 754 test.txt' marks test.txt readable,
    writeable, and executable by its owner, readable
    and executable by members of the owning group,
    and readable by everyone else

11
Process Control
  • 'ps' lists processes and has a LOT of options-'ps
    -aux' and 'ps axjf' are the most common
    invocations
  • 'pgrep expression' uses a regular expression to
    match processes
  • 'top' interactively lists the top processes
  • 'kill' sends signals to running processes

12
Linux Directory Structure
  • It makes sense, I promise- just not at first.
  • The top of the hierarchy is called '/'- Linux
    doesn't use '\'
  • There are no such things as drive letters- it's
    one big tree.
  • Files are separated by what they do, not where
    they came from

13
Linux Directory Structure II
  • User stuff goes in /home
  • Variable data goes in /var
  • User applications go in /usr
  • System binaries go in /bin
  • System static binaries go in /sbin
  • System libraries go in /lib
  • Configuration files go in /etc

14
Linux Directory Structure III
  • Just about everything in Linux is a file.
  • There are several special directories for special
    'files'
  • /proc stores data about the running system,
    including hardware configuration and process
    data.
  • /dev stores all device pseudo-files, including
    hard disks, CD-ROMs, and terminals.

15
Linux Directory Structure IV
  • A handful of useful commands
  • 'mount device directory' adds the device's
    filesystem below the named directory
  • 'umount device' reverses the above
  • 'fdisk device' formats the device
  • 'du filename' determines the amount of disk space
    occupied by the file

16
Programming on Linux
  • Linux programming can be very different from
    programming on Windows
  • Heavy use of free external libraries and
    utilities
  • Very little static compilation
  • Reliance upon coding standards
  • Configuration files vs registry
  • IDEs vs command line tools

17
GCC
  • GCC- Gnu Compiler Collection
  • Part of the build-essentials package
  • Basic C invocation 'gcc filename'
  • Simple C invocation 'g filename'
  • Java invocation 'gcj filename'
  • Also supports Fortran, Ada, and others

18
GCC II
  • Substitute the appropriate compiler, ie, g for
    C
  • Multiple source files 'gcc source1 source2'
  • Named output file 'gcc source -o output'
  • Debugging symbols 'gcc -g source'
  • Compile but do not link 'gcc -c source'
  • Report all warnings 'gcc -Wall source'
  • Optimize by size 'gcc -Os source'
  • Optimize lots 'gcc -O3 source'

19
Scripting
  • Start every script with '! /path/to/interpreter'
  • Some consider '! /usr/bin/env interpreter' a
    more portable alternative
  • Common languages include Bash shell, Python,
    Perl, and PHP
  • Make sure to mark scripts executable 'chmod x
    file'

20
Debugging
  • GDB- the Gnu DeBugger
  • Must compile with the -g option 'gcc -g code'
  • Invoke with 'gdb /path/to/executable'
  • Use strace to trace system calls
  • Standard invocation 'strace filename'
  • Use gcov/gprof for coverage and profiling
  • If in doubt, -v and -

21
Further Reading
  • OpenMigration.net/downloads.html
  • For desktop help, try the official Ubuntu book,
    available at Books-A-Million or free online
  • For a more in-depth look, try the Ubuntu Linux
    Toolbox, a handy (but non-techical) look at
    practical Ubuntu
  • For help with writing code for Linux, try The
    Definitive Guide to GCC and Advanced Programming
    for the Linux Environment.
Write a Comment
User Comments (0)
About PowerShow.com