Search Results

Search: Posts Made By: courteous
25,710
Posted By courteous
Brilliant. Seems like I'll have to take a look at...
Brilliant. Seems like I'll have to take a look at awk. Thanks.

EDIT: OK, seems like you can make it with grep also ... but what's the role of UNIX95 variable?
For my current level, I'll just...
25,710
Posted By courteous
Print 10 most CPU-intensive processes (wo/ top)
ps -eo pid,comm,%cpu lists all processes (in increasing PID number).

How to get only the top-10 most CPU intensive ones? I know about top: this is BASH exercise.

I tried redirecting above code...
2,687
Posted By courteous
You all deserve one BIG thank you. The...
You all deserve one BIG thank you.

The combination of .* is new to me: always seen these two in "XOR mode": look for one- (.) or many-(*) random characters.

find . -name 'oos*.txt' indeed works...
2,687
Posted By courteous
Why is the red dot (after "oos") needed? find ....
Why is the red dot (after "oos") needed?
find . -regex './oos.*\.txt'
2,687
Posted By courteous
find: "weird" regex behaviour
I have these two files in current dir:
oos.txt
oos_(copy).txt

I execute this find command:find . -regex './oos*.txt'And this outputs only the first file (oos.txt)! :confused:

Only if I add...
Forum: Programming 01-13-2011
4,407
Posted By courteous
But KERN_ALERT is on a higher, 2nd, log-level...
But KERN_ALERT is on a higher, 2nd, log-level than is KERN_CRIT! :confused:

Snippet from kernel.h:#define KERN_EMERG "<0>" /* system is unusable */
#define KERN_ALERT "<1>" /* action must be...
Forum: Programming 01-13-2011
4,407
Posted By courteous
"Hello!" IS in dmesg but NOT in /var/log/messages
Yes, 'hello' is in System.map (in /boot directory):
c015c3c0 T sys_hello

Yes, I did reboot (into the new kernel). :)

As 'hello' is in System.map, does that mean that something is wrong with...
Forum: Programming 01-09-2011
4,407
Posted By courteous
Adding custom ("Hello") system call: help
I'm trying to add a custom ("Hello world" :o) system call.
In /usr/src/linux/hello/ I put simple hello.c ...#include "linux/linkage.h" // for linking a system call
#include "linux/kernel.h" // for...
3,221
Posted By courteous
[SOLVED]
The solution is for dec.sh and inc.sh to lock counter.txt (and not as it is in OP). And also run both processes in for loop with ampersand (&). All this by trial&error ... will have to learn what...
3,221
Posted By courteous
Parallel processes to INC- and DEC-rement shared counter
QUESTION: How do I run processes in parallel, so that the counter (in counter.txt) would vary in value (instead of just "0" and "1")? That is, how to not sequentially run inc.sh and dec.sh?

The...
27,936
Posted By courteous
"lockfile: command not found"
Just tried out the following code from "Using lockfiles in shell scripts (http://www.madmadmod.com/programming/31-lockfile-conditional-semaphore-file-creator.html)":
#!/bin/bash

if [ -e...
1,723
Posted By courteous
Any way to know beforehand if SUDO is (going to be) needed?
I'm using virtual file-system in /proc/ to print out 1) current working directory (CWD): ls /proc/$PID/cwd

2) command line*: cat /proc/$PID/cmdline

and 3) # of open files: ls /proc/$PID/fdinfo...
2,655
Posted By courteous
I did that already, I thanked you in the code's...
I did that already, I thanked you in the code's comments above. Thank you. :b:

Below is the before-GREP output. IPs that GREP extracts are in blue.
PING www.l.google.com (209.85.135.147) 56(84)...
2,655
Posted By courteous
This is the code.
Hi Jim,
above isn't the code but terminal output.

This is the code (user enters target domain | defaults to google.com) which resembles traceroute:
#!/bin/bash
domain=${1-www.google.com};
...
2,655
Posted By courteous
Using GREP
PING www.l.google.com (209.85.135.99) 56(84) bytes of data.
From 209.85.253.26 icmp_seq=1 Time to live exceeded

--- www.l.google.com ping statistics ---
1 packets transmitted, 0 received, +1...
9,059
Posted By courteous
Help with grep
There isn't actual word "ECHO_REPLY" but a line that starts with "64 bytes from [...]" when the script reaches the target computer (eg. google.com). Now, how do you write an if statement like:if...
9,059
Posted By courteous
So, for emulating traceroute it should be -c 1,...
So, for emulating traceroute it should be -c 1, right?

Can you help me with my 2nd question: how could I "break" from the for loop when above quoted change (from TTL_EXPIRED to ECHO_REPLY)...
9,059
Posted By courteous
Hi ctsgnb, the "default option" works also...
Hi ctsgnb,
the "default option" works also without the colon. ;)

I'd be most grateful for any help on 2. question (on choosing max. TTL) ...
and of course any correction on my "thinking" in 1....
9,059
Posted By courteous
First, thank you for the reply. I've seen...
First, thank you for the reply.

I've seen other scripts that used, say, -c 2, but I don't (really) understand why (yes, I looked at man ping).

In ICMP's first 8 bits I'll be getting #11 (TTL...
9,059
Posted By courteous
Ping inside FOR loop
Hello,

I'm trying to write (my own primitive) traceroute command that would write out all IPs that packets are hoping through. :)

So I've put the ping command inside a for loop

#!/bin/bash...
Showing results 1 to 20 of 20

 
All times are GMT -4. The time now is 02:08 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy