Outils pour utilisateurs

Outils du site


issue147:certifie_linux

Ceci est une ancienne révision du document !


Where we are: https://www.lpi.org/our-certifications/exam-201-objectives (Measure and troubleshoot resource usage).

Welcome back learners, and a nod to those “just interested”. We are continuing from last issue with the very first topic, capacity planning. We are still busy with resource availability and troubleshooting. Last issue, we covered lsof and how you can use it to troubleshoot. Linux has lots of built-in tools and I think it’s time we looked at those.

Before we start: look at the manpages for ps and pstree please.

Okay, now press crtl + alt +f6 login in there. Type w You should see tty6 & tty7. Type pstree and watch it scroll by. Type ps and see only an entry for pts/0… Press ctrl + alt +f7 and repeat the exercise in a terminal. What have you learned?

I am going to assume that you read the man pages and know that there is a lot of “doubling up”. (-A and -e are the same, etc).

Now let’s do with ps what we did with lsof. Open a terminal and type ‘ps -ef’ and look at the column headings. We now not only have a PID, but a PPID too. Again, you can sort it into smaller chunks for easier processing, type: ‘ps -ef | grep kworker’ and see what you get. Do you see how this could be useful? There is a lot more to ps than just ‘ps -aux’! To see if a user is the problem, use the -u switch followed by the user name. (Do you see why I say – it is hard to hide what you are doing on a Linux machine from your Administrator?)

When you switched to tty6, did you run a pstree? If it looked funny, (it should not have if you were using a desktop OS, try running it with the -A option. Do it anyway to see what changes). This is what you had to do in the old dumb terminals, but not really used these days any more.

In your terminal – be it gnome terminal or xfce term or whatever – run pstree -h and look for YOUR terminal. Found it? In bold? Want to know its PID? Run pstree -hp and now each entry will be followed by its PID. Would you like to dig the rabbit hole deeper? You would? Type pstree -hpa – this will include arguments passed to processes. Like the ‘-hpa’ you just passed to pstree will show up, helping you to visually troubleshoot. Another way to visualise what is happening is the top command – most of you know his fancy cousin, htop. But where ps and pstree is static, top is constantly refreshing. Top is covered by LPIC level one, so I won’t go into lots of detail here. Just a reminder that you can customise top. While it is running, press the ‘f’ key. Learn those shortcut keys!

LPI exam is about more than Ubuntu; may I suggest running CentOS in VirtualBox and trying the same commands there.

Now let us look at some exam questions!

Which of the following commands will provide the PIDs of the processes sorted by which are using the most CPU cycles on the Linux system? A. top B. uptime C. ps aux D. vmstat E. freemem

If you said A, well done! Top always opens with CPU cycles as default sorting, unless you change it.

If you would like to jump ahead, or test your skills at an LPI exam, do a test paper here: https://www.itexams.com/exam/117-201. (These were once valid LPI questions and will ease you into the format).

* The new exam number is 201-400, 117-201 was the old one.

* The site does require signing up, but sign up with a temporary email (not your real email).

issue147/certifie_linux.1564434895.txt.gz · Dernière modification : 2019/07/29 23:14 de d52fr