Tuesday, October 25, 2016

Linux Daily Use Command

How to check Whole folder size exclude particular sub folder

du --exclude=picture -sch *

Find all softlink inside parent folder

find . -type l -ls

Find particular word in side directory

grep -r ' asd' .

For find install php modules

php -m

for find php.ini file which in use.

php --ini

How to find which module are enable and install in apache/ httpd

apachectl -M

or

apachectl -t -D DUMP_MODULES


How to mount windows (CIFS) shares on Linux with credentials in a secure way

yum install cifs-utils

cat /proc/filesystems |grep cifs

Output : nodev cifs

ls /lib/modules/$(uname -r)/kernel/fs/*/*ko|grep cifs

Output :  /lib/modules/3.10.0-123.el7.x86_64/kernel/fs/cifs/cifs.ko

mount -t cifs //192.168.1.111/rns /rns -o user=username

Automatically mount the CIFS share

vi /root/.smbcred

domain=domainname
username=username
password=password

chmod 400 /root/.smbcred

vi /etc/fstab

//192.168.1.111/rns /rns cifs credentials=/root/.smbcred,defaults 0 0

How to define primary & secondary virtual host define in apache

Wildcard include your site configuration files:
Include path/to/site/confs/*httpd.conf
Organize your site conf files so they are loaded in an expected order. Example...
01-httpd.conf
02-site1-httpd.conf
03-site2-httpd.conf
etc...
Apache will read these in order. Then create one that will always load last to catch any unmatched virtual hosts and return a 404 instead of loading a default site.

0 comments:

Post a Comment