Download de presentatie
De presentatie wordt gedownload. Even geduld aub
GepubliceerdRenske Bakker Laatst gewijzigd meer dan 8 jaar geleden
1
LPI 2010 NLLGG Trainer: Jeroen van Pelt Bijeenkomst 2: Basistaken op de Commandoregel, Bestandsbeheer 27.2.2010
2
Terugblik bijeenkomst 1 LPI 103.1: Work on the command line Theorie Praktijk LPI 103.3: Perform basic file management Theorie Praktijk LPI 103.4: Use streams, pipes and redirects Theorie Praktijk Afronding en huiswerk Agenda
3
Candidates should be able to interact with shells and commands using the command line. The objective assumes the bash shell. Key Knowledge Areas Use single shell commands and one line command sequences to perform basic tasks on the command line. Use and modify the shell environment including defining, referencing and exporting environment variables. Use and edit command history. Invoke commands inside and outside the defined path. Boek: 1.6 – 2.1 – 2.2 – 2.3 – 2.4 LPI 103.1: Work on the command line
4
Bourne Shell: /bin/sh Bourne Again Shell: /bin/bash Bestanden en directories Aanvullen van opdrachten Variabelen Environment (/etc/profile - /home/user/.profile) Tijdelijk Exporteren (export, unset) History (ba)sh
5
Virtuele consoles ([Ctrl]-Alt-F1) Andere gebruikers worden (su [-]) Informatie opvragen (users, who, w, finger) /bin/passwd -d -l -u -e Gebruikers
6
Candidates should be able to use the basic Linux commands to manage files and directories. Key Knowledge Areas Copy, move and remove files and directories individually. Copy multiple files and directories recursively. Remove files and directories recursively. Use simple and advanced wildcard specifications in commands. Using find to locate and act on files based on type, size, or time. Usage of tar, cpio and dd. Boek: 2.7 LPI 103.3: Perform basic file management
7
pwd (Present Working Directory) cd (Change Directory – let op ‘-’) mkdir (Make Directory – let op ‘-p’) rmdir (Remove Directory – beter: rm –r[f]) Werken met directories
8
ls (list) rm (remove) cp (copy) mv (move – ook hernoemen) file (file type) touch (files maken/’touchen’) cat (files samenvoegen/’printen’) Werken met bestanden
9
find [subtrees] [conditions] [actions] -name [FNG] # Zoek naar File Name Glob -type c # Type bestand[bcdfl] -size [+-]# # Heeft een +- grootte in blocks (c: bytes, # k: kilobytes) -user [name] # Eigenaar is name -atime [+-]# # Accessed days ago. +n means the # file has not been accessed for the # last n days. -n means the file has # been accessed in the last n days. -mtime [+-]# # Veranderd dagen geleden -perm nnn # Heeft permissie vlaggen nnn Bestanden vinden met find - 1
10
Voorbeelden: find. -name '*.[ch]' -print find /var /tmp. -size +20 -print find ~ -type c -name '*sys*' -print find / -type f -size +2c -exec rm -i {} \; find / -atime -3 -print find ~jo ~toto -user chloe -exec mv {} /tmp \; Bestanden vinden met find - 2
11
anders dan met find whereis which locate Bestanden vinden
12
tar (Tape ArchiveR) -zxvf -zcvf tar Th0msn80Th0msn80 (Wikipedia)
13
cpio find. -depth -print | cpio -ov > tree.cpio (archival) cpio -t < tree.cpio (list) cpio -id < cpiofile (extract) Onderdeel van o.a. RedHat Package Manager cpio
14
Low level kopiëren en converteren van raw data Wikipedia: “dd is used to copy a specified number of bytes or blocks, performing on-the-fly byte order conversions”bytesbyte order dd
15
ISO maken van CDROM: dd if=/dev/cdrom of=/home/sam/myCD.iso bs=2048 conv=sync,notrunc Partittie dupliceren: dd if=/dev/sda2 of=/dev/sdb2 bs=4096 conv=notrunc,noerror Harde schijf/partitie wissen: dd if=/dev/urandom of=/dev/had Meer voorbeelden: http://en.wikipedia.org/wiki/Dd_(Unix) http://en.wikipedia.org/wiki/Dd_(Unix) dd voorbeelden
16
Candidates should be able to redirect streams and connect them in order to efficiently process textual data. Tasks include redirecting standard input, standard output and standard error, piping the output of one command to the input of another command, using the output of one command as arguments to another command and sending output to both stdout and a file. Key Knowledge Areas Redirecting standard input, standard output and standard error. Pipe the output of one command to the input of another command. Use the output of one command as arguments to another command. Send output to both stdout and a file. Boek: 1.6 LPI 103.4: Use streams, pipes and redirects
17
Basis 0 = &0 = standard input (STDIN) 1 = &1 = standard output (STDOUT) 2 = &2 = standard error (STDERR) Redirect STDOUT/ERR ls –l 2&1> allout STD*
18
tee xargs < << > >> | `` Redirecting & Piping
19
ls -l /dev | more ls -l /etc/*.conf | grep user | grep 500 ls -l /bin | mail `users` ls -l /dev | tee file ls -l /etc | tee -a file ls f* | xargs cat find ~ -name 'proj1*' print | xargs cat grep try /etc/* 2> /dev/null grep try /etc/* > /dev/null 2> /dev/null Voorbeelden
20
Lees in boek: 3.1: Mounten van schijven (p65-70) 3.2: Een overzicht van gemounte apparaten (p70-77) 3.6: Werken met links (p86-91) 18: Opstarten van Linux (p451-485) Herhaal de opdrachten van bijeenkomst 2 Huiswerk: 13.3.2010
Verwante presentaties
© 2024 SlidePlayer.nl Inc.
All rights reserved.