Saturday, January 8, 2011

Text Processing 1

Let's just get down to it.


> Redirects a command's output to a file

>> Does the same as above but appends it to the end of the file instead of overwriting

The book mentions there are multiple ways to do things such as

sort <>

The | I just used is a pipe. It allows you to chain two or more program's output.

tee performs like > but it sends the output to a file while also passing it to console so you can monitor what is occuring.

sort is a command that can sort a file's contents.

nl is a command that can number lines in a file which can make it easier to troubleshoot source code (if for some reason you're coding in vim...)

Apparently there is a witty command by the name of tac that can display a file backwards...

sed. For some reason the book refuses to give a good explanation so here are examples of what it can do.

sed s/cat/tac/ file will replace the first instance of cat with tac. Add "g" after /tact/ and it will replace every instance of cat with tac. Me and Henry actually used this when editing the /etc/hosts hostsname files since it contained the hostname more than once.

grep in most simple terms can find a string or phrase and return it to you.

Next is chapter 9 the Software Installation chapter and then I'm done LPIC part one...

Wednesday, January 5, 2011

Recap of File Systems and Text Processing

The File System chapter was very long so I'm not going to cover everything there but here are the relevant bits (ha bits, because later I will talk about those).

locate can locate files. By default if you use locate myfile it will return myfile if it exists and any other file/directory that containts myfile. The locate command depends on a database so if you are looking for a new file locate may not be able to find it. To update manually use updatedb or slocate -u.

find is a command like locate but with many features. It can perform a search based on...

group - Group ownership

newer - Comparison of the dates to one file

user - User ownership

mtime - Modify time

atime - Access time

You can also run the -exec parameter so if find returns something it will be returned in place of the directory.

find /home -iname -exec -f {} /some/place the returned directory goes into the brackets.

Symlinks are like shortcuts which means you can access a file that is not actually stored on a system but is on another file system.

Bits (yay). File permissions are denoted by a trio of 3 bits. 4 is read (r), 2 is write (w) and 1 is execute (x). So if you were to use chmod which changes a file's permissions so that user could rwx, group could rw and "other" just r you would do chmod 764.

There is more to the file systems but these bits (ha) are the most pertinent and I still have to write about the next chapter. Also I don't know why blogger keeps double spacing for me.

Monday, January 3, 2011


Finish the last chapters. I finished reading File Systems and I read a bit into the next chapter which is text processing. According to Henry we can skip Xfree86 since it is no longer covered by the LPIC. After I'm done with the book I plan on doing some review on the commands since I have the concepts down but for the test you have to write out commands and they have to be exactly right so I have to get them down real good.