Linux Basic Commands

Linux Commands

$ps -aux | grep firefox -ists all firefox processes.

$lsb_release -a   -get current Ubuntu version

#grep -H -r "1click" /etc/apache2/  -izlistava sve fajlove koji u sebi sadrže 1click (-H ispisuje nazive direktorija, -r omogućuje pretraživanje direktorija)

 

 Start/stop services on boot (Ubuntu 14.04)

To see which services will start on boot:

#R=$(runlevel | awk '{ print $2}') for s in /etc/rc${R}.d/*; do basename $s | grep '^S' | sed 's/S[0-9].//g' ;done

To start or stop service on boot run:

#update-rc.d apache2 disable  -stops Apache on boot

#update-rc.d apache2 enable  -start Apache on boot

 

 

Better way is to install chkconfig service:

#sudo apt-get install chkconfig

Small fix on Ubuntu 12.04 is required: #ln -s /usr/lib/insserv/insserv /sbin/insserv

Then run:

#chkconfig --list

anacron                   0:off  1:off  2:off  3:off  4:off  5:off  6:off
apache2                   0:off  1:off  2:on   3:on   4:on   5:on   6:off
apparmor                  0:off  1:off  2:off  3:off  4:off  5:off  6:off  S:on

 

#chkconfig apache2 on -enable a service in runlevels 2, 3, 4, and 5

#chkconfig apache2 off

 

Processes

#ps -aux    -list all proceses with PID

#kill <pid>

#killall -9v node   -kills all node program processes

#killall -u john    -kills all user john processes