03122014 Flashcards Preview

LPIC > 03122014 > Flashcards

Flashcards in 03122014 Deck (8)
Loading flashcards...
0

USING GREP TO FIND PATTERNS

Go to /tmp
Then output dmesg to a text file
Find pattern for "network"

cd /tmp
dmesg > dmesg1.txt
grep network dmesg1.txt
grep network dmesg1.txt

-i, --ignore-case ignore case distinctions

grep -i cdrom dmesg1.txt
echo $?

1

COMPRESSING FILES USING ZIP

TAR

# file packaging and compression

cd /tmp
mkdir lbooktemp
cd lbooktemp/
ls > f1.txt; route > f2.txt; dmesg > f3.txt
ifconfig > ifconfig.dat; dmesg > dmesg.dat
zip lbook1.zip f1.txt f2.txt f3.txt
zip lbook1.zip *.txt *.dat
mkdir test
cp lbook1.zip test
cd test
unzip lbook1.zip
ls -la

2

Syntax for ZIP is ___

"zip zipped-files files-to-zip"

3

You can also view the contents of a ZIP file without extracting anything,by running the following command:


unzip -l zipped-file

4

COMPRESSING FILES USING TAR

cd /tmp/lbooktemp
tar cvzf lbook1.tar.gz *.txt
file lbook1.tar.gz
cp lbook1.tar.gz test
cd test
tar xvsf lbook1.tar.gz
ls -la
tar tvsf lbook1.tar.gz
cd /tmp
tar cvzf lbooktemp1.tar.gz lbooktempcd

5

Suppose you have sent that file to someone that is running Linux System, and want to ensure it did not get corrupted along the way.

cd /tmp
dmesg > file1.txt
stat file1.txt
sum file1.txt

6

The first number is the ____ and the second is the _____ for that file. If the other person runs a sum on his copy of the file and sees the same info, the files are the same

checksum, number of blocks

7

Print or control the kernel ring buffer

dmesg