I'm starting my first Linux program and I cant really figure out how to start something like this. I'm not familiar with /proc or any linux commands and the program I am working on wants me to search through the /proc directory and find this information
" 1 Machine name (hostname) (look in /proc/sys/kernel directory)
2 System date and time (use "time" function as shown in the Linux Intro programming example "myprog.cpp".)
3 Linux kernel version (Should be something like "Linux version 2.6.xxx) (look in /proc/version)
4 Memory usage( used and free memory) (Look in /proc/meminfo)
5 Identify the number of CPUs on this machine. (Look in /proc/cpuinfo. For this information, you will need read through the file and count the number of times that a different processor is identified.)"
and then output it. Not familiar with linux and I'm about to boot up my linux box and try to understand /proc. Any ideas?
/proc is kind of cool. I don't know if there's a Windows equivalent. But basically it's a "real" directory. It just houses a bunch of dynamic data for processes.
The best way to learn this stuff is just to mess around. Man pages are your friend. It looks like it tells you where to look, so that's a plus.
Commands you'll be using are cd (change directory), ls (list directory), and some read command. Some people like more, less, cat, open a text editor and read (not really recommended), might use grep but that might be ahead of where you're at.
I don't think so. The good thing is that you just use regular file/directory operations to access it, so it's easily accessed from a script. An API is a concrete interface you can rely on across versions. Also, /proc isn't POSIX so isn't standard even when present.