Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have portable homedir. I want to include some code to .bashrc, but I want it to be executed on specific models only.
It is keybindings code (xmodmap) which reassigns some of keys, so it should be executed on my laptop only or any other Thinkpad X220

Can you suggest a reliable way to detect the thinkpad model?

I could bind it to a network interface MAC or CPU, but it would be cool to find out model name.

share|improve this question

closed as off topic by mdpc, Khaled, dunxd, Scott Pack, Alex Jan 8 '13 at 16:09

Questions on Server Fault are expected to relate to professional server, networking, or related infrastructure administration within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

add comment

1 Answer

Start with the output of dmidecode -t 1, and use that to help differentiate between systems.

[root@LAS ~]# dmidecode -t 1
# dmidecode 2.11
SMBIOS 2.7 present.

Handle 0x0100, DMI type 1, 27 bytes
System Information
        Manufacturer: HP
        Product Name: ProLiant DL380 G6
        Version: Not Specified
        Serial Number: 2UX95306KT      
        UUID: 36363135-3335-5532-5839-353330364B54
        Wake-up Type: Power Switch
        SKU Number: 516653-005      
        Family: ProLiant
share|improve this answer
    
dmidecode -s system-version does exactly what I want. But, unfortunately I requires root:kmem permissions. As I want to put this code into .bashrc it's not an option :( –  Max Tsepkov Jan 8 '13 at 13:01
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.