Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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 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.

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

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