Find the answer to your Linux question:
Results 1 to 5 of 5
heya! I would like know in which file is the machine name, os type and processor architecture stored in?? I wouldl like to know the path to those files where ...
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    8

    Exclamation help in searching the path of some basic HW values

    heya!

    I would like know in which file is the machine name, os type and processor architecture stored in??
    I wouldl like to know the path to those files where the value for os is i386 and machine i686 is something like this..... in which file the systemuser and the number of users of that system is stored

    /usr/src/redhat/RPMS/ ... in these files i686 and i 386 is stored as directories and not as values....
    but i want them as values in the file

  2. #2
    Linux Guru Irithori's Avatar
    Join Date
    May 2009
    Location
    Munich
    Posts
    2,099
    hostname:
    cat /etc/sysconfig/network
    hostname
    uname -n

    os type:
    Hmm, linux?
    The release number is here
    cat /etc/redhat-release

    processor architecture
    cat /proc/cpuinfo
    dmidecode

    i386 or i686
    Can be judged from the processor architecture

    systemuser(s)
    cat /etc/passwd
    wc -l /etc/passwd
    It is possible to store users in other places like ldap
    You must always face the curtain with a bow.

  3. #3
    Just Joined!
    Join Date
    Mar 2010
    Posts
    8
    Thank you ....
    but the problem is system calls are not supported... the command cant be used....so im keen on knowing the pathnames of the files that store all these values....

    /proc/sys/kernel/ostypes ... this gives me the kernel name....
    simillary i wanted to know file pathanmes that gives me the machine architecture and os type... whose values are i386 and i686..... which we get using the uname -i and uname -m

    /etc/passwd this gives a list of users ..... but I need the file that contains the current user name and his UID userNumber in a file??

    please help...

  4. #4
    Just Joined!
    Join Date
    Mar 2010
    Posts
    8
    Hello!
    In the previous post i meant to ask OS name.... where is that name stored in which file??


    on executing this program im getting segmentation fault....
    I dont whats wrong in declaration of variables.....

    #include<stdio.h>
    #include<stdlib.h>
    #include<unistd.h>
    #include<string.h>

    int main()
    {

    FILE * buf, *out;
    char var[500];
    char os[100];
    system("uname -o > out");
    buf=fopen("out","r");
    while(fgets(var,sizeof(var),buf));
    {
    strcpy(os,var);
    printf("os is: %s",os);
    }
    rewind(out);
    fclose(buf);
    return 0;

    }

  5. #5
    Linux User twoHats's Avatar
    Join Date
    Jan 2005
    Location
    NH, USA
    Posts
    276

    Test your pointers...

    Quote Originally Posted by ramziur View Post
    Hello!
    In the previous post i meant to ask OS name.... where is that name stored in which file??


    on executing this program im getting segmentation fault....
    I dont whats wrong in declaration of variables.....

    #include<stdio.h>
    #include<stdlib.h>
    #include<unistd.h>
    #include<string.h>

    int main()
    {

    FILE * buf, *out;
    char var[500];
    char os[100];
    system("uname -o > out");
    buf=fopen("out","r");
    while(fgets(var,sizeof(var),buf));
    {
    strcpy(os,var);
    printf("os is: %s",os);
    }
    rewind(out);
    fclose(buf);
    return 0;

    }
    Are you sure buf has a value when you use it? Always test pointers for value before use...
    - Clouds don't crash - Bertrand Meyer

    registered Linux user 393557

    finally - hw to brag about - but next year it will look pitifully quaint:
    Athlon64 X2 3800 - 1G PC3200 - 250G SATA - ati radeon x300
    circa 2006

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...