Linux Commands every day

Start,Stop,Restart,Status Service

 

/etc/init.d/httpd start

/etc/init.d/httpd restart

/etc/init.d/httpd stop

/etc/init.d/httpd status

You can change httpd with another service (vsftps, smb, bind....)


 

shutdown -r now

restart

init 0


 

/sbin/chkconfig --list (To see what services are enabled for each runlevel)

/sbin/chkconfig --level 35 httpd on (The following command turns httpd server for both runlevel 3 *AND* 5.)


 

Mount

NTFS read/write with ntfs-3g add in your fstab : /dev/sda1 /mnt/windows ntfs-3g users,auto,rw 0 0

mount samba share :

$ mount -t cifs //ipaddress/directoryshared /mount/point -o username=yourusername


 

Networking

basic configuration exempol

Red Hat based distro: 

in : /etc/sysconfig/network-scripts/ifcfg-eth1

# Realtek Semiconductor Co., Ltd. RTL-8169 Gigabit Ethernet
DEVICE=eth1
BOOTPROTO=static
BROADCAST=192.168.100.255
HWADDR=00:19:E0:72:59:F6
IPADDR=192.168.100.13
NETMASK=255.255.255.0
NETWORK=192.168.100.0
ONBOOT=yes
TYPE=Ethernet

with DHCP

# 3Com Corporation 3c905C-TX/TX-M [Tornado]
DEVICE=eth0
BOOTPROTO=dhcp
HWADDR=00:01:03:01:5F:07
ONBOOT=no

Turn On and Off

ifconfig eth1 down

ifconfig eth1 up

Debian based distro :

sun:/etc/network# more interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
        address 192.168.100.17
        netmask 255.255.255.0
        network 192.168.100.0
        broadcast 192.168.100.255
        gateway 192.168.100.254