Pages

Tuesday, April 9, 2013

catatan administrator part 2


ls  xxx 2> errorfile


===mount iso file==


mount -o loop Fedora-11-i386-dvd.iso /test/


===============


mount


network file system

mount -t nfs 192.168.0.50:/toro /test
umount /test

samba

mount -t cifs //192.168.0.50/toro /test
umount /test



If the Windows box requires a username/password you should use

Code:
mount -t smbfs -o username <your user name> password <your password> //servername/sharename  /mnt/sharename


============

ls > file                 : memasukkan output dr ls ke file

ls >> fileappended        : menambahkan isi direktori skrg ke fileappended


database < data          :    input data ke database


ls *.png | xargs rm       : output yang ada *.png di hapus


=   :  assign variable
==  :  question true / false


/dev/null   : linux trashbin , auto discarded.    -> digunakan sebagai spam email(dibuang).




============

history   : history


echo $HISTSIZE    : default 500

~/.bash_history

echo $PATH        : melihat path executable binary

TAB  :   complete command



=======================
backup restore commands.


rsync  sinkronisasi local filelist.

- with remote system
- can connect via secure shell
- rsync -aHvz -e ssh . 192.168.0.50:/home/toro/backup

=======================
ftp,lftp

example: lftp kernel.org

!ls = list local files

=======================

tar : creates archieves in linux

tar czf backupfiles.tar.gz   folder/

extract dengan tar xzf backupmail.tar.gz



cpio : copy input, output menjadi archieves          -> multiple files

find / -name*.doc  | cpio -o > docfiles

extract dengan cpio -i < docfiles


========================================
restore command for tape


dump

full backup-

dump 0f /dev/tapedevice  /directory

incremental backup-
dump 1f /dev/tapedevice /directory

differential backup-
dump 10f /dev/tapedevice /directory

reverse with restore


====================================

backup from partition

dd if=/dev/sda1 of=/dev/sdb1          -> input = if   output = of    (bit by bit copy)


backup from cd/dvd

cdrecord


===================================


ssh -X remoteserver

firefox    : menjalankan firefox via X server forwarded to client ( from remote )


alt+backspace  = logoff


===================================

window manager  //effect

gnome = compiz
kde   = kwin        

==============================

/etc/X11/xorg.conf

Xorg -configure   : create new x server config


==============================

7 run levels

0 1 2 3 4 5 6 7

/etc/inittab


0  =>  halt

ls /etc/rc.0d/      -> Kxxx  Kxxx         => list smua file yang di kill pada saat run level 0



1  =>  single user mode  => root auto-login

ls /etc/rc.1d/      ->


2  =>  redhat:  multiuser without networking
ubuntu/debian : with gui if installed


3 =>  debian/ubuntu ga pake level 3 4 5


3 =>  centos/redhat  multiuser with networking


4 => not used


5 =>  redhat : multiuser mode, networking + gui display manager

6 =>  reboot mode




select a runlevel


shutdown -h now =  init 0  (runlevel 0)          == halt

shutdown -r now =  init 6  (runlevel 6)          == reboot




================================================
cron


/etc/crontab


 * * * * * command
 1 2 3 4 5



1= minutes   00-59
2= jam       0-23        
3= tanggal   1-31
4= minggu    1-11
5= week      0-6         (0 =minggu)
command= command yang akan dieksekusi



contoh :   01 * * * *  ->  1 menit tiap jam
           02 4 * * *  ->  4.02 a.m  setiap hari
           22 4 * * 0  ->  4.22 a.m setiap minggu
           42 4 1 * *  ->  4.42 a.m setiap awal bulan



crontab -e


/etc/cron.allow
/etc/cron.deny        -> user boleh menggunakan cron untuk aplikasi xxx


============================

one time cronjob :  digunakan apabila membutuhkan job skali jalan (agar tidak lupa mendelete cron apabila menggunakan cron )

at now + 10 minutes

at 2:00am, at noon, at midnight
at teatime (4:00PM)
at tomorrow 3:00PM  , at +3days 4:00am
at 10/11/12 5:00 am     (october 11,2012)


at>  wget facebook.com       = examples
     ls > toro.txt
 
ctrl+d  (finished :D)


atq    =   review at jobs
atrm 1  =  delete job number 1



limit at by account ->   /etc/at.allow     /etc/at.deny


============================================
disk usage

top

vmstat      //hampir sama dengan top

sar      

iostat      //input output

uptime

du -a       //directory and size

df -h       //list mounted directory

fsck


========================================

file system and quota

membatasi quota by space / by number of files

/etc/fstab

/dev/sdb1        usrquota,grpquota     => hrs ada 2 ini d fstab


bikin konfigurasi quota

quotacheck -cug /home/          => nanti muncul aquota.group aquota.file

edquota toro
edquota -g group

softlimit, hardlimit

repquota /home  -> buat check


========================================
swap

page file for ram didalam hardisk

swap volume = 2x ram



fdisk /dev/sdb
t
2
l
w

mkswap /dev/sdb2
swapon /dev/sdb2

cat /proc/swaps    -> cek

No comments:

Post a Comment