Discovering Linux

asked 2018-03-07 18:17:33 -0500

LINUX 101

Hello and welcome to the wonderful world of Linux. This tutorial assumes you've familiarized yourself with what Linux is and you've already installed your favorite flavor of Linux on your system. This tutorial is aimed at helping you solve the simple issues that most new Linux users face. In this basic Linux tutorial we will cover, Basic Linux Commands, File Sharing, and data manipulation, which includes viewing, copying, moving and deleting files.

Depending on which flavor you've installed and how you've installed it you may or may not have a gui (graphical user interface). For new users I highly recommend picking a flavor of Linux with a simple to use gui interface. Ubuntu, Redhat and Kubuntu come to mind. With a graphical interface you have the stability and power of Linux but you also have an interface similar to Windows and or OS X. With that said, let's get started with Basic Linux Commands. So let's open up a terminal.

The first command were going to examine is Hostname. Hostname is the program that is used to either set or display the current host, domain or node name of the system. These names are used by many of the networking programs to identify the machine.

hostname

Will display current hostname of the system.

Hostname --fqd
Hostname my_computer
Will display the fully qualified domain name.
Will change the hostname (computer name) to my_computer but will be reset back after the computer is rebooted.
Permanent hostname change on Debian based systems
Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script vps review (mouse click the up coming web site) /etc/init.d/hostname.sh
/etc/hostname server
So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then run:
/etc/init.d/hostname.sh start
to make the change active. The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script we used hostname.sh).
Permanent hostname change on RedHat based systems
RedHat based system use the file /etc/sysconfig/network to read the saved hostname at system boot. This is set using the init script /etc/rc.d/rc.sysinit
/etc/sysconfig/network
NETWORKING=yes
HOSTNAME="plain.domainname.com"
GATEWAY="192.168.0.1"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"
So in order to preserve your change on system reboot edit this file and enter the appropriate name using the HOSTNAME variable.
Use sysctl to change the hostname
Why would someone need a different method of doing the same thing as above? No idea, but here is anyway: use sysctl to change the variable kernel.hostname: Use:
sysctl kernel.hostname
to read the current hostname, and
sysctl kernel.hostname=NEW_HOSTNAME
to change it.

The second command I would like to address is ifconfig. The formal definition of ifconfig is as followed: ifconfig (short for interface configuration) is a system administration utility in Unix-like operating systems to configure, control, and query TCP/IP network interface parameters from a command line interface (CLI) or in system configuration scripts. Ifconfig originally appeared in 4.2BSD as part of the BSD TCP/IP suite.

In laymen's terms ifconfig will give you your ip address as well as other helpful network information.

ifconfig: To see running network card information.
ifconfig eth0 up|down: To enable|disable network interface

A basic ifconfig command can be used to help determine if your network card is working or not.

edit retag flag offensive close delete