کامندهای مفید لینوکس PDF چاپ ایمیل
نوشته شده توسط kayvan   
سه شنبه ، ۱۱ اسفند ۱۳۹۴ ، ۱۳:۴۴

Round مقادیر و جمع آنها

while read line; do l2=`echo $line| awk '{print int($l2)}'`; sum=$(($sum + $l2)); done < wwws ;

فایلهای تغییر پیدا کرده بین دو تاریخ

find . -type f -newermt "2013-01-01" ! -newermt "2013-08-29" -ls | grep ".php" | more

منع دسترسی به فایلهای کد


Order allow,deny
Deny from all

change mail attachment size

postconf -e message_size_limit='26214400'

multi ssh login

apt-get install clusterssh

Reset Mysql Pass

/etc/init.d/mysql stop
mysqld_safe --skip-grant-tables &
mysql -u root
use mysql;
update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
flush privileges;
quit
/etc/init.d/mysql stop
/etc/init.d/mysql start
mysql -u root -p

config rsyslog + forensic

How to config clients to send log to log-server:

First install rsyslogd package:
sudo apt-get install rsyslogd

Please NOTE: this is rsyslogd package NOT syslogd
Then config your system to send logs to log server:
vim /etc/rsyslog.conf

add this line at the end of file:
*.* @192.168.1.169

And finally restart daemon:
/etc/init.d/rsyslogd restart

---------------------------
Ho to enable apache log forensic module:
a2enmod log_forensic
vim /etc/apache2/apache2.conf
add this line at the END of file:
ForensicLog /var/log/apache2/forensic.log
ErrorLog syslog:local1
LogLevel debug
apache2ctl restart
Add this line to /etc/rc.local
nohup tail -f /var/log/apache2/forensic.log | /usr/bin/logger -thttpd -plocal6.notice &

Reset linux password

edit boot menue & change to
init=/bin/bash
or
init=/bin/sh

Then press , and you're back at the kernel line, press (for boot) and the computer will proceed to boot to a root prompt.
At this point, the root file system is still mounted read-only, so enter the following command:

mount -n -o remount,rw /

Then type:

passwd

Enter your new password. Retype if asked to confirm.
Then restart the machine by typing:
reboot

git remote repository

mkdir reponame.git
git init --bare --shared=group

git client

git init

git remote add origin gituser@servername:/path-to-repo/reponame.git

git pull or / git clone origingituser@servername:/path-to-repo/reponame.git

some git commands

git add *
git commit -m "my init commit"

********* Pushes all the modified local objects to the remote repository and advances its branches.
git push origin master

********* Fetches the files from the remote repository and merges it with your local one. This command is equal to the git fetch and the git merge sequence.
git pull origin

********* reset to last changes
git reset --hard HEAD

********* remote repository file count
git gc

********* change username and email of user

$ git config --global user.name "John Doe"
$ git config --global user.email آدرس ایمیل جهت جلوگیری از رباتهای هرزنامه محافظت شده اند، جهت مشاهده آنها شما نیاز به فعال ساختن جاوا اسكریپت دارید

******** show changed files
git status

******** see differences between recentely added files and previous cimmit ****
git diff --cached

******** To see what you’ve changed but not yet staged, type git diff with no other arguments:
git diff

******** If you want to see what you’ve staged that will go into your next commit, you can use
git diff --cached

******** you can pass the -v option to git commit. Doing so also puts the diff of your change in the editor so you can see exactly what you did.)

git commit -v
******** Providing the -a option to the git commit command makes Git automatically stage every file that is already tracked before doing the commit, letting you skip the git add

git commit -a

******** remove file from stage aria

git rm --chached filename

******** rename files in git

git mv file_from file_to

or

$ mv README.txt README
$ git rm README.txt
$ git add README

****** show changes in lines also

git log -p

******* 2 last commit

git log -2

******* ignore commit change mode

git config core.filemode false

******* define output format for log

git log --pretty=format:"%h - %an, %ar : %s"

بهنگام کردن در چهارشنبه ، ۱۲ اسفند ۱۳۹۴ ، ۰۹:۴۵