Linux Fundamentals - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

Linux Fundamentals

Description:

To decompress file use gzip -d foobar.gz or gunzip foobar.gz ... To decompress use unzip foobar.zip. 7. Installing Clean Tools. Checking the Hash ... – PowerPoint PPT presentation

Number of Views:339
Avg rating:3.0/5.0
Slides: 25
Provided by: justinp5
Category:

less

Transcript and Presenter's Notes

Title: Linux Fundamentals


1
Linux Fundamentals
Courtesy of Justin Peltier, Peltier Associates -
2005
2
Linux Commands
  • Basic Commands
  • cp instead of copy
  • mv instead of ren
  • ls for list of file
  • ls al for list of file including hidden files
    (starting with a .)
  • ps ef for a list of processes
  • pwd for print directory
  • pico to edit files
  • Current Directory not in the path value
  • Case Sensitive
  • Use the tab key for file or directory completion

3
How to run a file
  • Linux does not look in the current directory for
    a file
  • To run the file foobar
  • If you execute
  • foobar
  • It will not run
  • Execute this instead
  • ./foobar
  • The root of the filesystem is / or root not
    /root these are two different places

4
Unix filesystem

5
Networking Considerations
  • Networking as easy as SETUP
  • Straight to /etc/sysconfig/networking/devices/
  • Changes to networking files possible
  • You can use setup or neat in RedHat
  • Host files to speed DNS look-ups
  • Straight to /etc/hosts to aide testing speed for
    DNS lookups
  • About IPtables and IPchains
  • Built within the Linux Kernel
  • Stateful Firewall with GUI Configurator in
    X-windows
  • Not covered in this course but has to be verified
    on your real attack machine
  • All about closing unneeded services
  • Easiest to configure through GUI setup in RedHat
  • Use ntsysv if no GUI is installed

6
Linux File Archiving and Compression
  • In Linux, files are packaged and compressed in
    various ways. The common formats used are
  • GZIP is a standard compression (for files)
  • To compress file use gzip -9 foobar (where 9
    is max)
  • To decompress file use gzip -d foobar.gz or
    gunzip foobar.gz
  • TAR is a standard archiver used to store a
    directory as a file
  • To archive use tar cvf foobar.tar directory or
    file
  • To open the archive use tar xvf foobar.tar
  • To open a gzip archive use tar zxvf foobar.tar.gz
  • BZIP2 is a better compression algorithm
  • To compress use bzip2 -z foobar
  • To uncompress use bzip2 -d foobar.bz2 or
    bunzip2 foobar.bz
  • ZIP is like zip for Windows (for files only)
  • To compress use zip -9 foobar.zip foobar
    (where 9 is max)
  • To decompress use unzip foobar.zip

7
Installing Clean Tools
  • Checking the Hash
  • Using md5sum before installing a tool protects
    the user from installing possible Trojan Horses
  • md5sum OPTION FILE
  • Md5sum filename.tar.gz gt filename.md5
  • Always verify the signature of software you
    download

Example of verifying MD5 checksums for
sendmail Correct versions73e18ea78b2386b774963c
8472cbd309 sendmail.8.12.6.tar.gzcebe3fa43731b31
5908f44889d9d2137 sendmail.8.12.6.tar.Z8b9c78122
044f4e4744fc447eeafef34 sendmail.8.12.6.tar.sig
8
Installing Tools
  • Installations
  • Each type of file is installed differently
  • RPM The install files for RedHat and Mandrake
    Linux
  • GCC The compiler for the C and C programming
    languages
  • PERL Ready to run as is but may need libraries
    installed
  • SHELL Scripts Scripts are not installed but may
    need to be in the paths which are called by
    programs
  • Make Program recompiler for configuring to
    specific systems from the GNU C package

9
RPM
  • RPM
  • To install packages
  • rpm -i foobar-1.0-1.i386.rpm
  • To install the package via ftp
  • rpm -i ftp//ftp.redhat.com/pub/redhat/RPMS/foo-1.
    0-1.i386.rpm
  • To uninstall the package
  • rpm -e foobar
  • To upgrade the package
  • rpm -U foobar-1.0-1.i386.rpm
  • To see help on rpm options
  • rpm --help
  • To read the online manual page
  • man rpm
  • To make installation happen regardless of checks
  • rpm i foobar-1.0-1.138.rpm --force

10
GCC
  • GCC
  • To compile code
  • gcc foobar.c -o foobar
  • To see help on gcc options
  • gcc --help
  • To read the online manual page
  • man gcc
  • To read the c code
  • cat foobar.c more

11
SHELL Scripts
  • BASH SHELL
  • To run scripts
  • ./script.sh
  • sh ./script.sh
  • sh debug ./script.sh
  • To see help on script options
  • use a text editor like VIM or PICO
  • To read the online manual page
  • man command
  • man bash

12
Make
  • Make
  • To configure the Makefile before compiling
  • ./configure
  • To compile the configured Makefile
  • make
  • To install the binaries
  • make install (must be as root)
  • To see help on make options
  • make --help
  • To read the online manual page
  • man make

13
PERL
  • PERL
  • To run perl scripts
  • perl foobar.pl
  • To read perl scripts
  • use a text editor like VIM, PICO
  • To get libraries
  • use CPAN http//www.cpan.org
  • To see help on perl options
  • perl --help
  • To verify which version of PERL you have
  • perl -v
  • To read the online manual page
  • man perl

14
Your Logon Account
  • Logging on and off
  • The root account
  • Changing your password

15
The Logon Environment
  • Logon shell
  • Home directory
  • Environment variables

16
Linux File Name Conventions
  • Up to 256 characters allowed
  • No prohibition of the use of spaces
  • No formal rules related to file name extensions

17
The File System
  • Single tree of directories and subdirectories
  • Root directory represented by slash ( / )

18
Paths
  • Absolute paths
  • Relative paths and the current working directory
  • Periods, double periods, and tildes

19
Working with Directories
  • Listing directories
  • Long form listing
  • Changing the working directory
  • Creating subdirectories
  • Deleting subdirectories

20
File and Directory Permissions
  • Control of access at three levels
  • User
  • Group
  • Everyone (or other)
  • Changing permissions

21
Copying, Moving, and Deleting Files
  • cp copies files
  • mv moves and renames files and directories
  • rm deletes files

22
File Content-Listing Commands
  • more views text files page by page
  • cat prints the contents of files onto terminal
  • tac prints file contents in reverse order
  • head and tail views the first few or last few
    lines of a file
  • nl numbers the lines of a file
  • tee writes all output into a file

23
Simple Text File Utilities
  • wc displays a count of lines, words, and
    characters
  • diff reports differences between files
  • od displays a binary file in human-readable form
  • strings finds printable characters in a binary
    file

24
Miscellaneous Commands
  • date shows and sets time and date
  • w lists logon information about users
  • cal provides a monthly calendar
  • bc runs a calculator utility
Write a Comment
User Comments (0)
About PowerShow.com