Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Thursday, August 13, 2015

Some commands for Ubuntu 14.10 Utopic Unicorn

Change hostname / Computer name

Temporary:-

hostname [NewComputerNameHere]

The command above will last until restart.

Permanently:-

sudo gedit /etc/hostname /etc/hosts
The command above will let you edit two files, /etc/hostname and /etc/hosts

1. For the /etc/hostname file can be easily done.
    Just rename the existing name to the new computer name you want.
    Then make sure you save your file.

2. For the /etc/hosts file, you have to look for the following line in the file.
    127.0.1.1 YOUR-HOSTNAME
    Replace your new computer name with the old name.
    Then make sure you save your file.
    Finally, reboot your system to let it take effect.

Check your network IP address

hostname -I

The command above will show all addresses for the host.

ifconfig

The command above will show quite an amount of information. For this section, we are interested in the network IP address, therefore, we will lookout for the keyword "inet addr". Beside this will be the IP address for this network interface. 

You might had notice that there are multiple inet addr on your terminal. 
One under wlan0, one under eth0 or one under lo.
1. wlan0 will normally be the first wireless network card that your system have.
2. eth0 will normally be the first wired network port that your system have.
3. lo is a loopback interface on your system that is normally use for testing and troubleshooting for
    software developers.

Check which account you are currently using

whoami
The command above will show which user are you currently. This command is useful when you switch users frequently using the su command and you had lost track of which account are you in currently.





Sunday, December 22, 2013

Linux Command: Find Out My Linux Distribution Name and Version

Normally these are the 2 commonly used command to be used. You can use any one of the following command to find out your Linux distribution and name:

cat /etc/*-release

or

lsb_release -a

In case you need the kernel information, these are the command commonly used.

uname -a

or

uname -mrs

here are a few more different ways to get some info:-

- In GUI Menu -> System  Settings -> System Info
- inxi -F
- lsb_release -a
- cat /etc/linuxmint/info
- cat /etc/issue
cat /etc/os-release

cat /etc/issue
cat /etc/issue





Tuesday, October 30, 2012

Linux: CentOS 6.3 - Guide to install GNOME Desktop from CLI using yum

1. You would need to install "X Windows System" first, as this is the based that provide GUI and rich input device capability before installing GNOME Desktop. This will take a while as yum would download packages from the net before installing, therefore please have your internet connection setup before executing. Command to execute :-
# yum groupinstall -y 'X Window System'
2. Next will be the command for installing GNOME Desktop Environment :-
#  yum groupinstall -y 'Desktop'
3.  Done. To start GNOME type the following command :-
# startx
Note: If you would like to start GNOME automatically after reboot, you would need to edit the /etc/inittab file by changing the line " id:3:initdefault: " to " id:5:initdefault: " in the file.


Linux: CentOS 6.3 - Force DHCP client to renew ip address

Here are a few commands that I used to renew the ip address that has DHCP configured.

1. ifdown and ifup command to restart network card eth0 as follows :-

# ifdown eth0
# ifup eth0
2. Restarting the networking services command :-
# /etc/init.d/networking restart
3. Restart network service using service command :-
# service network restart
4. This command is for releasing the ip address :-
# sudo dhclient -r
This command is for getting a ip address :-
# sudo dhclient 

Linux: CentOS 6.3 - Changing the hostname or computer name

First of all, you need the command to check what is your box computer name(hostname).

Please note that all the "#" sign shown are meant to be the start of the command prompt, therefore please ignore it.

To check your hostname, type the following command:
# hostname

I am using the following method to change the hostname of my linux box:-

1. Change the hostname by using sudo hostname command.
# sudo hostname 'newhostname'
(without the quotes)

2. Edit the network configuration file. Type this command to use vi editor.
vi /etc/sysconfig/network
2.2 Find the following line => hostname = localhost.domain.local
change the "localhost.domain.local" to your new hostname.
(note: in vi editor press i or the insert key to switch to insert/editing mode. Press "Esc" to exit insert/editing mode.)
2.3 Save and close the file.
(note: in vi editor type :wq! follow by enter to save and quit the editor)