04-07-2008
Running UNIX Commands from C
Hi,
-How can I get number of files, cpu usage (percentage), memory usage, disk usage, ...etc, using C program ... I can use unix command ( system(command) )but I want the value to be returned back to my C program to use it in my code? How can I do that?
Thanks in advance ...
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all
How can I setup my shell so that I run a set of commmands or a script every time I login. I am using kshell. I tried putting a line in ./.bash_profile (does not work)
Ex.: I want to use vi as the commandline editor so, I want to run the command: set -o vi (3 Replies)
Discussion started by: skotapal
3 Replies
2. Shell Programming and Scripting
Hello,
We have a requirement to disable running shell commands via vi using "!".
Can anybody please suggest how to disable this option.
The requirement arises because we open up a xterm window with a config file in vi mode for the customer to edit. After the customer edits the config... (1 Reply)
Discussion started by: Umesh_Sharoff
1 Replies
3. UNIX for Dummies Questions & Answers
Hi, I need help again. When I run this shell script, it only runs the unld_date.sql piece and exits. How can I structure this to run all the way to the end? When I don't have the unld_date.sql piece in here, everything runs fine from the date compare piece all the way to the end. Thanks in... (5 Replies)
Discussion started by: siog
5 Replies
4. UNIX for Dummies Questions & Answers
I am able to run the UNIX commands in a Windows box from a UNIX box through "SSH" functionality. But whenever the SSH connection is established between UNIX and Windows, password for windows box is being asked.
Is there a way to avoid asking password whenever the SSH connection is made? Can I... (1 Reply)
Discussion started by: D.kalpana
1 Replies
5. Shell Programming and Scripting
I understand that in order to run basic unix commands I would normally type at the prompt, I would have to use the following format
system(ls -l);
or
exec(ls -l);
But when I actually try to use the command, the script fails to compile and keeps telling me there is an error with this line. ... (1 Reply)
Discussion started by: userix
1 Replies
6. Shell Programming and Scripting
Hi all,
In the directory '/temp/chris' the following files exist: chris.tar, chris.txt
What i am trying to do is to assign the 'chris.tar' filename in an argument through perl, in order to do that i use the system command:
$file=system("ls /temp/chris/*.tmp), but in the '$file' the exit... (2 Replies)
Discussion started by: chriss_58
2 Replies
7. Shell Programming and Scripting
Hello
I need to run some sed commands but it involves "/" in the substitute or delete, any ideas how I get round the problem.
Example:
cat file1.txt | sed -e '/</Header>/d' > file2.txt
This errors due to the forward slash before the Header text.
Thanks (3 Replies)
Discussion started by: Dolph
3 Replies
8. Shell Programming and Scripting
Hi,
I would like to write a script with include more than 6 unix commands.
my script like below:
echo " script started"
ls -ld
bdf | grep "rama"
tail -10 log.txt
...
..
...
now, i want to run above unix commands one by one.
example:
first the ls -ld command will be... (3 Replies)
Discussion started by: koti_rama
3 Replies
9. Shell Programming and Scripting
Executing two unix commads via perl script one after another
e.g: make clean
bsub -i -q short make
have tried using exec but the second command doesnt executes (1 Reply)
Discussion started by: rajroshan
1 Replies
10. Programming
Hi All,
Is there anything wrong with below syntax?
qx {perldoc -v ModuleName.pm | grep -i Description }
BTW, this question is related to Perl.
Thanks. (3 Replies)
Discussion started by: jal_capri
3 Replies
LEARN ABOUT DEBIAN
wmcpuload
WMCPULOAD(1) General Commands Manual WMCPULOAD(1)
NAME
wmcpuload - A dockapp to display CPU usage
SYNOPSIS
wmcpuload [options]
DESCRIPTION
This manual page documents briefly the wmcpuload command. This manual page was written for the Debian GNU/Linux distribution.
WMCPULoad is a dockapp that is supported by X window managers such as Window Maker, AfterStep, BlackBox, and Enlightenment. It displays the
current CPU usage, expressed as a percentile and a chart, and has an LCD look-alike user interface. The back-light may be turned on/off by
clicking the mouse button over the application. If the CPU usage hits a certain threshold, an alarm-mode will alert you by turning on back-
light.
OPTIONS
This program follows the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included
below.
-d, --display <string>
Attempt to open a window on the named X display. In the absence of this option, the display specified by the DISPLAY environment
variable is used.
-t, --title <string>
specify title name
-bl, --backlight
turn on back-light.
-lc, --light-color <color>
back-light color (rgb:6E/C6/3B is default)
-i, --interval <number>
number of secs between updates (1 is default)
-c, --cpu <number> (GNU/Linux / IRIX)
CPU number to monitor (Counting starts with 0).
-n, --ignore-nice (GNU/Linux / FreeBSD / OpenBSD / NetBSD)
ignore a nice value
-h, --help
show help text and exit
-v, --version
show program version and exit
-w, --windowed
run the application in windowed mode
-wp, --windowed-withpanel
run the application in windowed mode with background panel
-bw, --broken-wm
activate broken window manager fix
-a, --alarm <percentage>
activate alarm mode. <percentage> is threshold of percentage from 0 to 100.(90 is default)
-p, --ignore-proc <name><...>
ignore all processes specified by command name
AUTHOR
WMCPULoad was written by Seiichi SATO <ssato@sh.rim.or.jp>.
This manual page was written by Gordon Fraser <gordon@freakzone.net>, for the Debian GNU/Linux system (but may be used by others).
June 30, 2001 WMCPULOAD(1)