Posted by: sureshamrita | August 23, 2010

Linux Tips

  1. Display current hostname.
  2. changing the current hostname.
  3. Determining whether the CPU is 32/64 bit.
  4. Determining the whether the OS installed is 32/64 bit.
  5. Becoming a sudoer
  6. How to mount windows shares on your linux machine?

Diplay current host name :

hostname

Changing the host name : Edit the file /etc/hostname

Determining whether the CPU is 32/64 bit:

Method 1:

uname -m

Method 2:

cat /proc/cpuinfo|grep flags

The answer I get on my machine is:

flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx lm constant_tsc arch_perfmon pebs bts rep_good aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr pdcm lahf_lm tpr_shadow

In the above listing look at the colored flag. The flag “lm” means, Long Mode. (64bit Extensions, AMD’s AMD64 or Intel’s EM64T). For more information on CPU flags look at CPU feature flags and their meanings

Determining the whether the OS installed is 32/64 bit: uname -a

Becoming a sudoer: $/etc/sudoers file will show the groups which can do administrative tasks. In my machine it shows like this:

%admin ALL=(ALL) NOPASSWD:ALL

This means that all users belonging to the admin group can use sudo command. The NOPASSWD means that it will not ask for password when you use the sudo command.

$groups command will show what all groups you belong to. So if you are not a member of admin group, as shown by the groups command, just edit /etc/group file, add your user id to the admin group. My /etc/group file admin group entry looks like this.
admin:x:119:suresh
Now you are ready to use sudo.

How to mount windows shares on your linux machine?

mount -t cifs //windows_share /mnt/ -o user=your_domain\\your_user_name

The abouve command mounts the specified windows share as /mnt in your machine.

You may have to install smbfs as shown below if the above command gives an error message.

aptitude install smbfs
Advertisements

Responses

  1. Hi.

    Glad my page of cpu flags is helping one more guy.
    However, regarding the change of the hostname, you usually don’t do that by only changing /etc/hosts. Usually, you also need to edit /etc/hostname (on Debian systems for example) or some other file (I think it is /etc/sysconfig/network on RedHat/Fedora systems). Editing the 127.0.0.1 entry in /etc/hosts has the same effect in some aspects, but has negative effects in some other cases.

    regards,
    Sven

    • Hi Sven,
      Thanks for pointing it out. I am editing the page. It is /etc/hostname only. It was my mistake that I wrote /etc/hosts! Actually we edit /etc/hosts to change the ip address or add an alias etc.
      regards
      suresh


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Categories

%d bloggers like this: