TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login CONVERT LENGTH
login CONVERT TEMPERATURE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login WORK CALCULATOR
login CALCULATE LIFE

Linux commands, scripts, examples, tutorial

Page bottomNext article  ALL TOPICS

What is linux

 Linux is, in simplest terms, an operating system. It is the software on a computer that enables applications and the computer operator to access the devices on the computer to perform desired functions. The operating system (OS) relays instructions from an application to, for instance, the computer's processor. The processor performs the instructed task, then sends the results back to the application via the operating system.

Linux (often pronounced LIH-nuhks with a short "i") is a Unix-like operating system that was designed to provide personal computer users a free or very low-cost operating system comparable to traditional and usually more expensive Unix systems. Linux has a reputation as a very efficient and fast-performing system. Linux's kernel (the central part of the operating system) was developed by Linus Torvalds at the University of Helsinki in Finland. To complete the operating system, Torvalds and other team members made use of system components developed by members of the Free Software Foundation for the GNU Project.

Linux is the kernel of an operating system.
Linux was built on the Unix tradition.
Linux was originally developed by Linus Torwalds of Finland, who currenctly owns the Linux trademark.
Linux stands for Linus' Unix.
Using the open source code of the Linux kernel, people have been developing operating systems based on the Linux kernel. These are called the "Linux distributions".

Try this Linux bash commands, administration, programming quiz 
Page topNext article  ALL TOPICS


Guest:
Another example
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user    command
6 * * * * root    cd / && run-parts --report /etc/cron.hourly
11 3 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
44 2 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
42 2 14 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
*/5 * * * * root /_scripts/_cron_init/ping.txt
# */5 * * * * root /_scripts/wget/wget.txt
55 3 */2 * * root /_scripts/_cron_init/pdumpfs.txt
55 4 * * * root /_scripts/_cron_init/mysql_and_config_backup.txt
1 */2 * * * root /_scripts/_cron_init/chmod_chown.txt
1 */2 * * * root /_scripts/_cron_init/mysql_check.txt
15 4  * * * root /_scripts/_cron_init/du.txt
30 4  10 * * root /_scripts/_cron_init/wget_ip.txt
* * * * * root /_scripts/_cron_init/netstat.txt
# */5 * * * * root /_scripts/_cron_init/proxy_script.txt
1 1 * * * root /_scripts/_cron_init/mysql_delete_forum.txt


2013-06-07 11:13:21
Guest:
Use pdumpfs- easy way to local backup. It supprots hard links and logs changes:

d=`date '%m-%d'`
/usr/bin/pdumpfs /var_www /var_backups > /var_backups/var_www${d}.txt 2>/var_backups/var_www${d}_err.txt


2013-06-07 11:13:21
Guest:
pdumpfs creates logs. List new files from pdumpfs logs:

grep new_file /var_backups/* | grep 'taro' | grep -v sess_ | grep -v moodle | grep -v 'taro/cache' | grep -v '.png'> /_scripts/_logs/new.log

mail -s "new files" a[at]a.com < new.log


2013-06-07 11:13:21
Guest:
This example check, whether user data is changed or not. Text MYSQL log is used:

check_log_file='/_scripts/_cron_init/mysql_check.log'

mail_file='/_scripts/_cron_init/mysql_mail.log'

check=` grep UPDATE /var/log/mysql.log | grep admin | grep jos_users | wc -l `

grep -n UPDATE /var/log/mysql.log | grep admin | grep jos_users | tail -1  > $mail_file

check_log=` cat  $check_log_file `

# echo $check $check_log $check_log_file

if [ $check -ne $check_log ]

then
mail -s "mysql attack" [email protected] < $mail_file
echo $check > $check_log_file

fi


2013-06-07 11:13:21
Guest:
Check, if your server is infected with rootkit:
chkrootkit | grep -v "not found" | grep -v "not infected" | grep -v "nothing found"


2013-06-07 11:13:21
Guest:
Important to monitor disk useage:

d=`date '%m-%d'`
folder='/_scripts/_logs/du'

# Folder contains more than 20MB
du -sm /var_www/*  | awk ' $1 > 20 { print $0 } '  > $folder/du-$d.log

mail [email protected] -s "du" < $folder/du-$d.log


2013-06-07 11:13:21
Guest:
Lower priority for antivirus program:

> /var/log/clamscan.txt
nice -n 19 /usr/local/bin/clamscan  -r -i --log /var/log/clamscan.txt / &


2013-06-07 11:13:21
Guest:
Find files and show total size:
#!/bin/bash

p=$1
echo "JPG All file size:">log.txt
du -ch `find $p -name "*.jpg"`| grep "total" |awk '{print $1"B"}'>>log.txt
echo "PNG all file size:">>log.txt
du -ch `find $p -name "*.png"`| grep "total" |awk '{print $1"B"}'>>log.txt

exit 0



2013-06-07 11:13:21
Guest:
This code changes permissions:
#!/bin/sh

b=1

while [ $b ]
do


clear; echo ivesk failo varda ; read a

[ -e $a ] || ( touch $a; echo failas sukurtas )


if test -d $a
then

    echo cia katalogas

else

    echo "Pasirink:prideti x teises - taip,atimti - ne"
    read b
   
    if test $b = "taip"
    then
        chmod a x $a
        echo teises pridetos
    else
        chmod a-x $a
        echo teises atimamos
    fi
fi

sleep 3

done



2013-06-07 11:13:21
Guest:
Hello

count files:

ls -1 | wc -l

filter: 
ls -l | grep filename

sort by modification time, show all files (hidden files too):

ls -lAt
ls -l -A -t


2013-06-25 05:06:18
Guest:
Hello

Simple monitoring pannel using PHP

/bin/ps -o %p%c%C%z%x%t -e --sort -c

-o 
Show only the fields, can't be with -f,

--sort -c
Order by cpu descending
 
<?php

echo "<font color = \"006600\"><b>LOAD:</b></font><br />";
echo exec('/usr/bin/uptime');

echo "<br /><br /><font color = \"006600\"><b>PROC:</b></font><br />";
echo "<pre>" ; echo  passthru('/bin/ps -o %p%c%C%z%x%t -e --sort -c' ); echo  "</pre><br />";

?>


2013-09-27 12:30:17

 Use username: Guest, Anonymous, Programmer






QUOTES:
The secret of happiness is something to do.
John Burroughs
Be entirely tolerant or not at all; follow the good path or the evil one. To stand at the crossroads requires more strength than you possess.
Heinrich Heine
Marry for money, my little sonny, a rich man's joke is always funny.
Hebrew Proverb