LinuxUNIX - PowerPoint PPT Presentation

1 / 35
About This Presentation
Title:

LinuxUNIX

Description:

rw-rw-r-- 1 john doc 2488 Aug 15 10:51 intro -rw-rw-r-- 1 carol doc 1605 Aug 23 07:35 macros ... dr-xr-xr-x 6 ftp anonymous 4096 Apr 26 19:27 sequin ... – PowerPoint PPT presentation

Number of Views:48
Avg rating:3.0/5.0
Slides: 36
Provided by: ssi9
Category:
Tags: linuxunix | apr | intro

less

Transcript and Presenter's Notes

Title: LinuxUNIX


1
Linux/UNIX Commands
The symbol of Linux
2
Networking Concept - Basics
3
Logging in
Unix doesnt really care where you log in from,
though some system administrators might.
You must have a username (login id) to use a unix
system
Every user is a member of one or more groups of
users.
4
Logging in
Connect to the unix machine using a suitable
program on your local machine.
Password
The system will be unavailable on friday
afternoon for maintenance. You have new
mail. username_at_linus gt
5
The shell or command line
Several different shells but they behave more or
less the same
1. The Prompt.
6
The shell or command line
2. Commands
ls -ald .txt
The shell breaks the command up into individual
words
7
More Special Characters

?
" '


gt
lt


\

Some special characters can lose their special
meaning if they are inside quotes.
8
Organization
"Everything is a file"
  • An ordinary file contains data.
  • A directory contains other files.
  • A link is a file that is a shortcut to another
    file.
  • There are many other types of file .

9
Organization of the file system
/
Any file in the file system can be uniquely
identified by describing the path to it from the
root directory.
10
Organization of the file system
pwd
11
Looking at the file system
ls
ls project
prot letter project
project seq1 seq2 seq3 seq4
12
Moving around the file system
cd /home/username/project
cd project
cd ..
username_at_linus /projectgt
pwd
username_at_linus /projectgt
pwd
username_at_linus gt
pwd
13
Changing the file system
mkdir model
14
Changing the file system
rmdir model
rm prot
15
More about files filenames
Filenames can contain any normal text character
including spaces and special characters.
Filenames can be almost any length.
If a filename contains a special character or a
space you may need to put quotes around the whole
path.
16
More about files reading files
You can print the contents of one or more files
to the screen with the command 'cat file1 file2
...'
You can view the contents of one or more files a
page at a time on the screen with the command '
more file1 file2 ...'
You can print the first few lines of a file with
the command 'head file1 file2 ...'
17
More about files editing files
You can change the content of text files and
create new files with a text editor.
PICO
EMACS
VI
18
More about files copying files
You can copy a file with the command 'cp
oldfilename newfilename'
ls
letter project username_at_linus gt
cp letter draft
username_at_linus gt
ls
draft letter project username_at_linus gt
19
More about files copy files
  • Scp Secure Copy (remote file copy program)

ls
letter project username_at_linus gt
scp letter coursedir1
username_at_linuss password
letter 100 9
scp coursemyfile .
username_at_linus gt
username_at_course gt scp -r mydir course
20
Grep power search utility - Basics
  • The grep program searches a file or files for
    lines that have a certain pattern. The syntax is
  • gt grep pattern file(s)
  • The simplest use of grep is to look for a pattern
    consisting of a single word. It can be used in a
    pipe so that only those lines of the input files
    containing a given string are sent to the
    standard output. If you don't give grep a
    filename to read, it reads its standard input
    that's the way all filter programs work

runs ls -l to list your directory. The standard
output of ls -l is piped to grep, which only
outputs lines that contain the string "Aug" (that
is, files that were last modified in August).
Because the standard output of grep isn't
redirected, those lines go to the terminal screen.
21
More about files sort
  • The sort command arranges lines of text
    alphabetically or numerically
  • sort doesn't modify the file itself it reads the
    file and writes the sorted text to the standard
    output.
  • sort arranges lines of text alphabetically by
    default.

more food
Afghani Cuisine Tio Pepe's Peppers Bangkok
Wok Sushi and Sashimi Mandalay Big Apple
Deli Isle of Java Sweet Tooth username_at_linus gt
Usage sort general options o outfile
key interpretation options tchar
kkeydeffilenames Option -n Sort
numerically (example 10 will sort after 2),
ignore blanks and tabs. -r Reverse the order of
sort. -f Sort upper- and lowercase together. x
Ignore first x fields when sorting. -m Merges
several input files
sort food
Afghani Cuisine Bangkok Wok Big Apple Deli Isle
of Java Mandalay Sushi and Sashimi Sweet
Tooth Tio Pepe's Peppers username_at_linus gt
22
Sort, grep, ls
username_at_linus gt ls -l grep "Aug" sort
4n -rw-rw-r-- 1 carol doc 1605 Aug 23
0735 macros -rw-rw-r-- 1 john doc 2488
Aug 15 1051 intro -rw-rw-rw- 1 john doc
8515 Aug 6 1530 ch07 -rw-rw-rw- 1 john doc
11008 Aug 6 1410 ch02 username_at_linus gt
This pipe sorts all files in your directory
modified in August by order of size, and prints
them to the terminal screen. The sort option 4n
skips four fields (fields are separated by
blanks) then sorts the lines in numeric order.
So, the output of ls (actually, the output of
grep) is sorted by the file size (the fifth
column, starting with 1605). Both grep and sort
are used here as filters to modify the output of
the ls -l command. If you wanted to email this
listing to someone, you could add a final pipe to
the mail command. Or you could print the listing
by piping the sort output to your printer command
(like lp or lpr).
23
More about files permissions
  • Every file is protected to a greater or lesser
    extent.
  • Permissions determine who can read, write, or
    execute a given file.
  • Files can have read, write or execute permission
    for each of the three types of user.

24
More about files permissions
You can view the permissions for a file by
listing it in long format with the command 'ls
-l filename'
ls -l letter
-rwxr--r-- 1 username users 6048 Aug 17 1607
letter
25
More about files permissions
You can change the permissions for a file with
the command 'chmod change filename'
ls -l letter
-rwxr--r-- 1 username users 6048 Aug 17 1607
letter username_at_linus gt
chmod o-r letter
username_at_linus gt
ls -l letter
-rwxr----- 1 username users 6048 Aug 17 1607
letter username_at_linus gt
26
Getting help
You can get help on a command by using the
command ' man command'
If you do not know what a command is called, use
the option '-k' to get a list of commands that
may be relevant 'man -k word'
Try using the options '-h', '-help', or '--help'
if you can't find the man page.
27
Finding commands quickly
123 1755 more food 124 1758 sort
food username_at_linus gt
less .bash_history
history grep man
username_at_linus gt
102 1504 man scp 125 1805 history
grep man
28
Finding commands quickly
  • gt history
  • gt less .bash_history
  • gt history grep man
  • You see a list of all the commands you type with
    the word man in them

29
Process Management
PID TTY TIME CMD 22244 pts/27 000
tcsh username_at_linus gt
top
last pid 22413 load averages 1.14, 1.20,
1.45 161931 1089 processes1064 sleeping, 2
running, 17 zombie, 2 stopped, 4 on cpu CPU
states idle, user, kernel,
iowait, swap Memory 4096M real, 3310M swap in
use, 7852M swap free PID USERNAME THR PRI NICE
SIZE RES STATE TIME CPU COMMAND 16417
lakshmin 1 53 0 28M 20M cpu0 307
1.09 netscape 13020 root 1 59 0 57M
42M cpu3 11424 0.91 Xsun 29164 root 1
32 0 2960K 1536K cpu1 61254 0.77 top
username_at_linus gt
kill -9 16417
30
Determining File Sizes and Space Usage
Filesystem 1k-blocks Used
Available Use Mounted on /dev/md/dsk/d0
4131866 2249730 1840818 55 / swap
7993840 16 7993824 0
/var/run /dev/md/dsk/d7 5017602 957225
4010201 19 /export/home linux/export/home
209198492 148520117 39758526 79
/net/linux/ export/home
username_at_linus gt df -h
31
Useful literature
  • Learning the UNIX operating system - O'Reilly
    Press
  • UNIX Quickguide - EMBnet
  • Running Linux, 3rd Edition OReilly Press

32
Useful Online Resource
  • http//www.freshmeat.net/
  • http//www.linuxiso.org/
  • http//www.redhat.com/
  • http//www.tldp.org/
  • http//www.linux.org/
  • _

33
Extra Slides
34
FTP File Transfer Protocol
ftp ftp.ncbi.nih.gov
  • Connected to ftp.ncbi.nih.gov.
  • 220 FTP Server ready.
  • Name (ftp.ncbi.nih.govhuynh)

anonymous
331 Anonymous login ok, send your complete email
address as your password. Password
230 Anonymous access granted, restrictions apply.
ftpgt bin 200 Type set to I
ftpgt ls -l
ftpgt cd blast
ftpgt ls -l
ftpgt cd executables
ftpgt ls -l
ftpgt mget blast.linux.tar.Z
mget blast.linux.tar.Z? y 200 PORT command
successful. 150 Opening BINARY mode data
connection for blast.linux.tar.Z (20222367
bytes). 226 Transfer complete. local
blast.linux.tar.Z remote blast.linux.tar.Z 202223
67 bytes received in 4.3 seconds (4579.68
Kbytes/s) ftpgt
35
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com