punkwalrus (punkwalrus) wrote,
punkwalrus
punkwalrus

LPI 101 Exam notes: 21 days to exam

Since I goof off and LJ so much, I have decided to hijack the process and write my study notes and thoughts. But they are probably totally boring for those not interested in Linux. These notes may be very long and disjointed, so... I put them...

For those interested, think there needs to be corrections, have neat trivia, or have some things to say: COMMENTS ARE ENCOURAGED!!!
___________
So, where was I? You know, I never realized the man command has so much junk around it. I was curious why sometimes they had entries like, "See also smb.conf(8)." What does the "8" stand for? Oh, they are sections! Hah, cool.

I have already spent a few chapters of my main study guide as of this entry, filling in the gaps of my hardware knowledge, notably SCSI and USB.

Now I am learning all the stuff about the bash shell I should have known for these last few years. My first shell was csh, way before bsh, and then bash. I knew that $PS1 was the prompt, but I should type it to remember it. The command export SOMEVAR will make SOMEVAR an environmental variable. I have never needed this, because I mostly work with scripts that are in one shell, but it's nice to know.

There's a note that your last session is the one to write your history to ~/.bash_history. Man, there' also a good list here of commands that WOULD come in useful. Like:

!! - redo last command
!n - redo command n from history. I knew this, but I have never needed it because when I do "history," I just cut and paste from the terminal window.
!-n - Redo command of the last command, minus n. Again, see above.
!string - Redo command that starts with string
!?string - Redo command that contains with string

I think I shall use !?, !string, and !?string more now. Thanks LPI! This is exactly why I wanted to take this exam!

Bash also does Emacs bindings, but I never did Emacs because when given a choice between Emacs and vi, I chose vi because it was on EVERYTHING back in the day, and Emacs was considered a huge memory hog. Note to self: learn Emacs.

The "META" key on a PC keyboard is really the "ALT" key

[Control] + rstring is a handy search thing for a previous command. OooOOooh...

I knew about cut where -d is delimiter and -f is field, head, tail, and nl (number line), but I didn't know about:

expand, which converts tabs to spaces (handy). I has an opposite called unexpand
fmt, which manipulates paragraphs and text width.
od, dumps files in octal and other formats
join, which will join (text) files at various points
split, splits a (text) file into various parts
paste, pastes lines, which can have what to paste with (-d). This would be handy in creating e-mail address lists from /etc/passwd and making cvs files.
pr, which can take text and output them in columns with headers and nifty stuff that is lpr-friendly. This is WAY cool. Go play with it. Here's a command to start you off: ls -a | pr -n -h "Files in $(pwd)."
xargs, Okay, I know about and I use this, but barely understand how it works. I have a LOT of problems with -0 and -print0 and all that when dealing with stupid Windows files with spaces.
tee, which takes std output and puts it on the screen AND a file of your choosing
ps, I only ever do ps aux and ps, never anything else. It's far more flexible, like -Uuser for user, -f for tree, -w for wide (don't truncate), and -Ccommand for command
pstree is a lot like ps -f

They go into kill a lot, and I need to hunker down and study this. Sure, I use "kill -9" all the time, but kill can be used for so much more.

kill -HUP 1015 : Hang up process 1015. This used to be for modems, which would then reset and reload the config for the next call. But nowadays, it's more used for services where you just want the process config to be reread

kill -INT 1015 : Interrupt. This is really what's sent with "[control] + C."

kill -KILL 1015 : Infamous "kill -9" which is "terminate with extreme prejudice."

kill -TERM 1015 : Terminate nicely, if possible. Lets a service shut down gracefully.

kill -TSTP 1015 : Terminate and stop process, but leave it ready to go. It "pauses" the process in most cases, like "[control] + Z"

kill -CONT 1015 : Continue process from TSTP, like fg or fb from a [control] + Z

nice I have always had a weak spot for, since I rarely use it these days. The numbers range from -20 to +19 where, from left to right, are more powerful to weaker (it's counter-intuitive, so think of it like old AD&D Armor class where lower is better). A normal process starts out priority in the dead middle, 0. "Nice" set it to +10, unless you go nice --10 (notice 2 dashes) or nice -n -10, which will set the priority at -10, halfway up the high end of the scale.

renice is best when the program is already running. -u states ALL that users processes. renice -10 -u jdean would set all of jdean's processes to -10 (higher). renice never needs the second dash, BTW.


__________
Disclaimer: While I have been managing Linux systems for almost 10 years now, but I am mostly self-taught. I have a RHCT certification, but I am taking the LPI and CompTIA Linux+ exams to "flesh out" some of the gaps that occur from too much real-world experience versus my lack of good old fashioned book learnin'. This entry in no way assures you my thoughts are correct, I will have frequent misspellings, and they may or may not help you pass the LPI. HUGE parts of the exam will be missing because I already know half of it by heart, so using me as your only study guide is a terrikle idea. Please read this entry with a healthy amount of skepticim, and PLEASE feel free to correct or add comments! My ego is hardy enough to admit when I am wrong.
Tags: linux, lpi
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 4 comments