Linux System Administrator Budi Santosa, ST Kurusetra Computer www.kurusetra.web.id
[email protected]
1
Login Linux Ubuntu Login Pertama Kali ubuntu login: budi Sandi lewat: ****** (Password Tidak Terlihat) Terakhir log masuk: Sen Mei 3 14:33:59 WIT 2010 pada tty1 Linux ubuntu 2.6.2416generic #1 SMP Thu Apr 10 13:23:42 UTC 2008 i686 The programs included with the Ubuntu system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. To access official Ubuntu documentation, please visit: http://help.ubuntu.com/ budi@ubuntu:~$ sudo su (Perintah login ke Root / Superuser) [sudo] password for budi: ******* (Password user budi instalasi pertama kali) root@ubuntu:~# passwd (Mengganti Password Superuser) Masukkan sandi lewat UNIX baru: Masukkan ulang sandi lewar UNIX baru: passwd: kata sandi diperbaharui dengan sukses root@ubuntu:~#
Konfigurasi Alamat IP Konfigurasi Alamat IP root@server:~# vim /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 192.168.0.71 netmask 255.255.255.0 auto eth1 iface eth1 inet static address 122.200.52.23 netmask 255.255.255.128 gateway 122.200.52.1 2
Restart Perangkat Jaringan root@server:~# /etc/init.d/networking restart Melihat status defaut gateway root@ubuntu:~# netstat nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.0.71 0.0.0.0 UG 0 0 0 eth0 Mencoba koneksi internet dan LAN root@ubuntu:~# ping 192.168.0.71 PING 192.168.0.71 (192.168.0.71) 56(84) bytes of data. 64 bytes from 192.168.0.71: icmp_seq=1 ttl=64 time=0.212 ms 64 bytes from 192.168.0.71: icmp_seq=2 ttl=64 time=0.220 ms 64 bytes from 192.168.0.71: icmp_seq=3 ttl=64 time=0.216 ms 64 bytes from 192.168.0.71: icmp_seq=4 ttl=64 time=0.206 ms (Akhiri Loop:: CTRL + c) 192.168.0.71 ping statistics 4 packets transmitted, 4 received, 0% packet loss, time 2999ms rtt min/avg/max/mdev = 0.206/0.213/0.220/0.015 ms root@ubuntu:~# ping 122.200.52.1 PING 122.200.52.1 (122.200.52.1) 56(84) bytes of data. 64 bytes from 122.200.52.1: icmp_seq=1 ttl=63 time=7.41 ms 64 bytes from 122.200.52.1: icmp_seq=2 ttl=63 time=65.2 ms 64 bytes from 122.200.52.1: icmp_seq=3 ttl=63 time=82.1 ms 64 bytes from 122.200.52.1: icmp_seq=4 ttl=63 time=42.8 ms (Akhiri Loop:: CTRL + c) 122.200.52.1 ping statistics 4 packets transmitted, 4 received, 0% packet loss, time 3001ms rtt min/avg/max/mdev = 7.418/49.413/82.162/27.976 ms Konfigurasi DNS root@server:~# vim /etc/resolv.conf nameserver 192.168.0.71 nameserver 202.46.1.2 nameserver 122.200.48.14 Mencoba konfigurasi DNS root@ubuntu:~# nslookup www.yahoo.com Server: 192.168.0.71 Address: 192.168.0.71#53 Nonauthoritative answer: www.yahoo.com canonical name = fp.wg1.b.yahoo.com. 3
fp.wg1.b.yahoo.com canonical name = anyfp.wa1.b.yahoo.com. Name: anyfp.wa1.b.yahoo.com Address: 98.137.149.56 Name: anyfp.wa1.b.yahoo.com Address: 72.30.2.43 root@ubuntu:~# ping www.yahoo.com PING anyfp.wa1.b.yahoo.com (72.30.2.43) 56(84) bytes of data. 64 bytes from ir1.fp.vip.sk1.yahoo.com (72.30.2.43): icmp_seq=1 ttl=51 time=224 ms 64 bytes from ir1.fp.vip.sk1.yahoo.com (72.30.2.43): icmp_seq=2 ttl=51 time=221 ms 64 bytes from ir1.fp.vip.sk1.yahoo.com (72.30.2.43): icmp_seq=3 ttl=51 time=221 ms 64 bytes from ir1.fp.vip.sk1.yahoo.com (72.30.2.43): icmp_seq=4 ttl=51 time=233 ms anyfp.wa1.b.yahoo.com ping statistics 4 packets transmitted, 4 received, 0% packet loss, time 3001ms rtt min/avg/max/mdev = 221.387/225.051/233.064/4.757 ms
Informasi Perangkat Keras Linux Informasi Prosessor root@ubuntu:~# cat /proc/cpuinfo processor : 0 vendor_id : AuthenticAMD cpu family : 15 model : 79 model name : AMD Sempron(tm) Processor 3000+ stepping : 2 cpu MHz : 1607.415 cache size : 256 KB fdiv_bug : no hlt_bug : no f00f_bug : no coma_bug : no fpu : yes fpu_exception : yes cpuid level : 1 wp : yes flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt rdtscp lm 3dnowext 3dnow up pni cx16 lahf_lm extapic cr8_legacy ts ttp tm stc bogomips : 3218.22 clflush size : 64
4
Informasi Penggunaan Memory root@ubuntu:~# cat /proc/meminfo MemTotal: 970380 kB MemFree: 304248 kB Buffers: 47712 kB Cached: 372272 kB SwapCached: 0 kB Active: 331596 kB Informasi Partisi Hardisk root@ubuntu:~# fdisk l (huruf L bukan angka satu) Disk /dev/sda: 40.0 GB, 40020664320 bytes 255 heads, 63 sectors/track, 4865 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Disk identifier: 0x025d025d Device Boot Start End Blocks Id System /dev/sda1 * 1 892 7164958+ 83 Linux /dev/sda2 1021 3570 20482875 83 Linux /dev/sda3 3571 4865 10402087+ 83 Linux /dev/sda4 893 1020 1028160 5 Extended /dev/sda5 893 1020 1028128+ 82 Linux swap / Solaris root@budidesktop:~# df Filesystem 1Kblocks Used Available Use% Mounted on /dev/sdb6 29223512 3541944 24216788 13% / udev 472944 4 472940 1% /dev tmpfs 192088 912 191176 1% /run none 5120 4 5116 1% /run/lock none 480212 76 480136 1% /run/shm /dev/sdb7 58485072 1176480 54378980 3% /home /dev/sdb5 30701232 10276512 20424720 34% /media/DATA Informasi Perangkat USB root@ubuntu:~# lsusb Bus 002 Device 001: ID 0000:0000 Bus 001 Device 002: ID 12d1:140c Huawei Technologies Co., Ltd. Bus 001 Device 001: ID 0000:0000 Infomasi Driver yang digunakan linux root@ubuntu:~# lsmod Module Size Used by nls_iso8859_1 4992 1 nls_cp437 6656 1 vfat 14464 1 fat 54556 1 vfat isofs 36388 1 5
ipv6 267780 17 rfcomm 41744 2 l2cap 25728 13 rfcomm bluetooth 61156 4 rfcomm,l2cap Task Manager Linux root@ubuntu:~# top (untuk quit tekan huruf q)
Informasi Jaringan Komputer Trafik Jaringan Internet dan LAN root@budidesktop:~# aptget install iftop root@budidesktop:~# iftop i ppp0 Trace Alamat IP root@budidesktop:~# aptget install traceroute root@budidesktop:~# traceroute www.detik.com traceroute to www.detik.com (203.190.242.69), 30 hops max, 60 byte packets 1 10.20.30.77 (10.20.30.77) 71.571 ms 81.518 ms 82.507 ms 2 * * * 3 10.20.161.40 (10.20.161.40) 114.432 ms 144.419 ms 145.380 ms 4 202.70.56.49 (202.70.56.49) 146.368 ms 92.326 ms 93.241 ms 5 202.70.56.17 (202.70.56.17) 93.222 ms 134.240 ms 134.226 ms 6 ip177141.moratelindo.co.id (202.43.177.141) 146.175 ms 147.172 ms 103.508 ms 6
7 218.100.36.2 (218.100.36.2) 109.434 ms 109.417 ms 118.434 ms 8 detik.openixp.net (218.100.27.192) 118.420 ms 148.375 ms 148.363 ms 9 203.190.244.6 (203.190.244.6) 171.371 ms 172.325 ms 187.844 ms 10 203.190.242.69 (203.190.242.69) 289.785 ms 380.763 ms 487.730 ms Informasi Domain Internet root@budidesktop:~# whois detik.com Domain Name: DETIK.COM Registrar: NETWORK SOLUTIONS, LLC. Whois Server: whois.networksolutions.com Referral URL: http://www.networksolutions.com/en_US/ Name Server: NS.DETIK.NET.ID root@budidesktop:~# whois 202.70.56.49 % [whois.apnic.net node5] % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html inetnum: 202.70.56.0 202.70.56.255 netname: SMARTTELECOMID descr: PT SMART TELECOM country: ID Melihat Trafik Jaringan root@budidesktop:~# aptget install ngrep root@budidesktop:~# ngrep d ppp0 Melihat Routing Table root@budidesktop:~# netstat nr Kernel IP routing table Destination 0.0.0.0 10.20.31.17 169.254.0.0
Gateway 10.20.31.17 0.0.0.0 0.0.0.0
Genmask 0.0.0.0 255.255.255.255 255.255.0.0
Flags UG UH U
MSS 0 0 0
Window 0 0 0
Konfigurasi Repository Aplikasi Alamat Repository Ubuntu http://dl2.fossid.web.id http://kambing.ui.ac.id http://ubuntu.cbn.net.id ftp://ftp.itb.ac.id http://komo.vlsm.org
(Telkom Speedy) (Univesitas Indonesia) (Provider Internet CBN) (Institut Teknologi Bandung) (Institut Teknologi Sepuluh November)
7
irtt 0 0 0
Iface ppp0 ppp0 ppp0
Konfigurasi Repository root@server:~# vim /etc/apt/sources.list deb http://kambing.ui.ac.id/ubuntu karmic main universe multiverse restricted deb http://kambing.ui.ac.id/ubuntu karmicupdates main universe multiverse restricted deb http://kambing.ui.ac.id/ubuntu karmicsecurity main universe multiverse restricted deb http://kambing.ui.ac.idubuntu karmicproposed main universe multiverse restricted deb http://kambing.ui.ac.idubuntu karmicbackports main universe multiverse restricted Update List Aplikasi Repository root@server:~# aptget update Hit http://kambing.ui.edu karmic Release.gpg Hit http://kambing.ui.edu karmic/main Translationid Ign http://kambing.ui.edu karmic/universe Translationid Hit http://kambing.ui.edu karmic/multiverse Translationid Pencarian Aplikasi yang diinginkan root@server:~# aptcache search vim exuberantctags build tag file indexes of source code definitions linuxdoctools convert LinuxDoc SGML source into other formats vim Vi IMproved enhanced vi editor vimcommon Vi IMproved Common files vimdbg Vi IMproved enhanced vi editor (debugging symbols) vimdoc Vi IMproved HTML documentation vimgnome Vi IMproved enhanced vi editor with GNOME2 GUI vimguicommon Vi IMproved Common GUI files vimruntime Vi IMproved Runtime files vimtiny Vi IMproved enhanced vi editor compact version Instalasi Aplikasi root@server:~# aptget install mysqlserver root@server:~# aptget install vim nmap ngrep root@server:~# aptget install inkscape dia xfig scribus root@server:~# dpkg i googlechrome1.0.deb root@server:~# aptget f install (Meng install depedensi yang belum terpasang) Menghapus Aplikasi root@server:~# aptget autoremovc nmap (Menghapus aplikasi tdk beserta konfigurasi) root@server:~# aptitude purge nmap (Menghapus aplikasi beserta konfigurasi) Pencarian Aplikasi yang terpasang root@server:~# dpkgquery W | grep vim vim 2:7.2.2452ubuntu2 vimcommon 2:7.2.2452ubuntu2 vimruntime 2:7.2.2452ubuntu2 vimtiny 2:7.2.2452ubuntu2
8
Pencarian direktori lokasi aplikasi root@server:~# dpkg L vim /usr/bin/vim.basic /usr/share /usr/share/lintian /usr/share/lintian/overrides /usr/share/lintian/overrides/vim Instalasi Driver Printer Contoh: Canon PIXMA IP3500
1. Langkah pertama cari di www.google.com
2. Download driver di alamat http://supportau.canon.com.au/contents/AU/EN/0100083401.html http://supportau.canon.com.au/contents/AU/EN/0100083501.html 3. Instalasi driver canon pixma ip3500 root@ubuntu:/home/budi/Downloads# dpkg i cnijfiltercommon_2.801_i386.deb root@ubuntu:/home/budi/Downloads# dpkg i cnijfilterip3500series_2.801_i386.deb 4. Konfigurasi printer, System > Administration > Printer > New Printer
9
5. Pilih Internet Printing Protocol
6. Masuk Pilihan Driver Canon
10
Pengelolaan User dan Group Login ke root budi@ubuntu:~$ sudo su [sudo] password for budi: root@ubuntu:~# Penambahan User root@ubuntu:~# adduser dono Menambhakan pengguna 'dono' ... Menambah grup baru `dono' (1001) ... Membuat direktori home '/home/dono' ... Menyalin berkas dari `/etc/skel' ... Masukkan sandi lewat UNIX baru: Masukkan ulang sandi lewar UNIX baru: passwd: kata sandi diperbaharui dengan sukses Mengubah informasi pengguna dari dono Masukkan nilai baru atau tekan ENTER untuk nilai bawaan Nama Lengkap []: Dono Warkop DKI Nomor Ruangan []: Telepon Kantor []: Telepon Rumah []: Lainlain []: Apakah keterangan tersebut benar? [y/T] y 11
Melihat User ID root@ubuntu:~# id budi uid=1000(budi) gid=1000(budi) kelompok=1000(budi),4(adm),20(dialout),24(cdrom),25(floppy),29(audio),30(dip),44(video ),46(plugdev),107(fuse),109(lpadmin),115(admin),124(sambashare) root@ubuntu:~# id dono uid=1001(dono) gid=1001(dono) kelompok=1001(dono) Mengganti Password User root@ubuntu:~# passwd dono Masukkan sandi lewat UNIX baru: Masukkan ulang sandi lewar UNIX baru: passwd: kata sandi diperbaharui dengan sukses root@ubuntu:~# passwd budi Masukkan sandi lewat UNIX baru: Masukkan ulang sandi lewar UNIX baru: passwd: kata sandi diperbaharui dengan sukses Menghapus user root@ubuntu:~# userdel uni (Hapus user uni tanpa dengan home dir) root@ubuntu:~# userdel r uni (Hapus user uni dengan home dir) Melihat User Login root@server:~# last root pts/2 192.168.0.2 Mon May 3 13:48 14:34 (00:46) root pts/0 192.168.0.2 Mon May 3 12:48 still logged in root@server:~# lastlog Username Port From Latest root pts/2 192.168.0.2 Sen Mei 3 13:48:02 daemon **Never logged in** bind **Never logged in** sshd **Never logged in** ardelindo tty2 Sen Apr 26 08:27:51
Menambahkan Group root@ubuntu:~# groupadd sales (Menambahkan group baru sales) root@ubuntu:~# gpasswd a eri sales (Menambah user eri ke group sales) Menambahkan pengguna eri ke grup sales root@ubuntu:~# gpasswd a dono sales (Menambah user dono ke group sales) Menambahkan pengguna dono ke grup sales
12
Memeriksa anggota group root@ubuntu:~# id eri uid=1002(eri) gid=1002(eri) kelompok=1002(eri),1003(sales) root@ubuntu:~# id dono uid=1001(dono) gid=1001(dono) kelompok=1001(dono),1003(sales) root@ubuntu:~# cat /etc/group | grep sales sales:x:1003:eri,dono Menghapus anggota dari group root@ubuntu:~# gpasswd d dono sales Mengeluarkan pengguna dono dari grup sales root@ubuntu:~# gpasswd d eri sales Mengeluarkan pengguna eri dari grup sales root@ubuntu:~# groupdel sales (Menghapus group sales) Login ke Root tanpa password root@ubuntu:~# groupadd wheel root@ubuntu:~# gpasswd a budi wheel root@ubuntu:~# vim /etc/pam.d/su #dihilangkan pagar di depan kata auth auth sufficient pam_wheel.so trust budi@ubuntu:~$ su root@ubuntu:~# < Langsung ke root / superuser tanpa password
Manajemen Direktori dan File Instalasi Tree root@ubuntu:~# aptget install tree Reading package lists... Done Building dependency tree Reading state information... Done tree telah berada dalam versi terbaru. Membuat direktori root@ubuntu:~# mkdir p kota/depok/bogor/solo/madiun root@ubuntu:~# tree kota/ (Melihat struktur direktori kota) kota/ ` depok ` bogor ` solo ` madiun
13
root@ubuntu:~# mkdir p kota/magetan/caruban/ngawi/bojonegoro root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | ` solo | ` madiun ` magetan ` caruban ` ngawi ` bojonegoro Autocomplete cd kota/[TAB]/[TAB]/[TAB] (Tekan tombol keyboard TAB) root@ubuntu:~# cd kota/depok/bogor/solo/madiun/ Berganti Direktori root@ubuntu:~# cd kota/depok/bogor/solo/madiun/ root@ubuntu:~/kota/depok/bogor/solo/madiun# pwd (Posisi direktori sekarang) /root/kota/depok/bogor/solo/madiun root@ubuntu:~/kota/depok/bogor/solo/madiun# cd ../ (Naik satu tingkat) root@ubuntu:~/kota/depok/bogor/solo# pwd /root/kota/depok/bogor/solo root@ubuntu:~/kota/depok/bogor/solo# cd ../../../ (Naik tiga tingkat) root@ubuntu:~/kota# pwd /root/kota Menghapus Direktori root@ubuntu:~# rm fr kota/magetan/caruban/ngawi/ root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | ` solo | ` madiun ` magetan ` caruban Menyalin direktori root@ubuntu:~# cp R kota/magetan/ kota/depok/bogor/solo/ root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | ` solo 14
| | madiun | ` magetan | ` caruban ` magetan ` caruban Merubah Nama Direktori root@ubuntu:~# mv kota/magetan/ kota/kediri (Rename magetan jadi kediri) root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | ` solo | | madiun | ` magetan | ` caruban ` kediri ` caruban Membuat Link Direktori root@ubuntu:~# ln s kota/kediri/ jatim root@ubuntu:~# ls la | grep jatim lrwxrwxrwx 1 root root 12 20100504 09:45 jatim > kota/kediri/ Membuat File Kosong root@ubuntu:~# cp filebaru.txt kota/depok/bogor/ root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | | filebaru.txt | ` solo | | madiun | ` magetan | ` caruban ` kediri ` caruban Menghapus File root@ubuntu:~# rm fr kota/depok/bogor/filebaru.txt root@ubuntu:~# tree kota/ kota/ | depok | ` bogor | ` solo | | madiun | ` magetan 15
Kepemilikan dan Hak Izin Akses Kepemilikan dan Hak Izin Akses root@ubuntu:~# touch percobaan.txt root@ubuntu:~# ls la percobaan.txt rwrr 1 root root 0 20100504 10:25 percobaan.txt
Merubah kepemilikan root@ubuntu:~# ls la percobaan.txt rwrr 1 root root 0 20100504 10:25 percobaan.txt root@ubuntu:~# chown R budi.sales percobaan.txt root@ubuntu:~# ls la percobaan.txt rwrr 1 budi sales 0 20100504 10:25 percobaan.txt Merubah Hak Izin Akses
root@ubuntu:~# ls la percobaan.txt rwrr 1 budi sales 0 20100504 10:25 percobaan.txt root@ubuntu:~# chmod R 760 percobaan.txt root@ubuntu:~# ls la percobaan.txt rwxrw 1 budi sales 0 20100504 10:25 percobaan.txt Super User ID root@ubuntu:~# ls la /bin/touch rwxrwxrx 1 root root 43740 20080404 13:42 /bin/touch root@ubuntu:~# chmod 4775 /bin/touch root@ubuntu:~# ls la /bin/touch rwsrwxrx 1 root root 43740 20080404 13:42 /bin/touch 16
budi@ubuntu:~$ touch dataku.txt budi@ubuntu:~$ ls la dataku.txt rwrr 1 root budi 0 20100504 14:02 dataku.txt Imunitas File root@ubuntu:~# touch test.txt root@ubuntu:~# chattr +i test.txt root@ubuntu:~# lsattr test.txt i test.txt root@ubuntu:~# rm test.txt rm: tidak dapat menghapus `test.txt': Operation not permitted root@ubuntu:~# chattr i test.txt root@ubuntu:~# rm test.txt
Pencarian file dan data Locate file root@ubuntu:~# updatedb root@ubuntu:~# locate passwd /etc/passwd /etc/passwd /etc/security/opasswd Perintah Find root@ubuntu:~# find /etc/ perm 755 type f (File yang hak izin akses 755) /etc/resolvconf/updatelibc.d/avahidaemon /etc/wpa_supplicant/ifupdown.sh /etc/wpa_supplicant/functions.sh /etc/mysql/debianstart /etc/cron.monthly/0anacron root@ubuntu:~# ls la /etc/X11/Xsession rwxrxrx 1 root root 3730 20080313 22:10 /etc/X11/Xsession root@ubuntu:~# find /etc/ name "*.sh" type f (File extension *.sh) /etc/lsbbaselogging.sh /etc/openoffice/soffice.sh root@ubuntu:~# find /etc/ type f mtime 2 (File yang diupdate 2 hari yang lalu) /etc/resolv.conf /etc/gshadow 17
root@ubuntu:~# date Sel Mei 4 14:25:01 WIT 2010 root@ubuntu:~# ls la /etc/resolv.conf rwrr 1 root root 196 20100504 12:17 /etc/resolv.conf Pencarian Text dalam File root@ubuntu:~# grep r smtp /etc/services smtp 25/tcp mail ssmtp 465/tcp smtps # SMTP over SSL root@ubuntu:~# grep r budi /etc/passwd budi:x:1000:1000:budi,,,:/home/budi:/bin/bash root@ubuntu:~# grep r sales /etc/group sales:x:1004: Pengalihan Arah Keluaran root@ubuntu:~# netstat nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.0.71 0.0.0.0 UG 0 0 0 eth0 root@ubuntu:~# netstat nr > file.txt root@ubuntu:~# cat file.txt Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.0.71 0.0.0.0 UG 0 0 0 eth0
Penyaringan Keluaran Perintah root@ubuntu:~# ls la /etc/ | grep r passwd rwrr 1 root root 1809 20100503 15:28 passwd rw 1 root root 1806 20100503 15:28 passwd root@ubuntu:~# ls la /etc/ | grep r gro drwxrxrx 2 root root 4096 20100323 10:34 groff rwrr 1 root root 1016 20100504 11:11 group rw 1 root root 1002 20100503 15:37 group rwrr 1 root root 599 20060620 01:21 logrotate.conf drwxrxrx 2 root root 4096 20100401 13:55 logrotate.d
Editor Vim Membuat file baru root@ubuntu:~# aptget install vim root@ubuntu:~# vim percobaan.txt
18
Mode Perintah Mode perintah hanya untuk menjalankan perintah vim, copy,paste, insert dan lain – lain, bukan untuk melakukan penyutingan file.
Mengedit File Untuk edit file tekan huruf “ i “ atau tombol keyboard Insert, sampai kursor paling bawah ada tulisan INSERT.
Menyimpan File dan keluar Untuk menyimpan file keluar dari mode edit dengan menekan tombol ESC hingga tulisan INSERT dibawah tidak tampak. Kemudian tekan tombol “ :wq” dan enter.
19
Perintah ViM standar: :w :wq :q! :set nu :set nonu %s/jakarta/depok/ :1,10y :23,40d
: Simpan file : Simpan dan Keluar : Keluar tanpa simpan : Munculkan nomor baris : Menghilangkan nomor baris : Ganti kata 'jakarta' dengan 'depok' : Copy baris 1 sampai 10 : Delete baris 23 sampai 40
Perintah ViM Console Manipulasi text Copy 1 baris Copy 5 baris Paste 1 kali Paste 5 kali Delete 1 kata Delete 4 kata Delete 1 baris Delete 5 baris Undo Redo Ganti 1 kata Ganti 3 kata
: : : : : : : : : : : :
SHIFT + y 5 + SHIFT + y p 5p dw 5dw dd 5dd u CTRL + r cw 3cw 20
Navigasi Ke Baris 13 : 13 + SHIFT + g Ke Halaman Pertama : 1 + SHIFT + g Ke Halaman Akhir : SHIFT + g Pencarian kata /kata_yang_dicari ?kata_yang_dicari n SHIFT + n
: : : :
Pencarian ke bawah Pencarian ke atas Pencarian berikutnya Pencarian sebelumnya
Pengelolaan Proses Melihat Proses yang aktif root@ubuntu:~# ps ax PID TTY STAT TIME COMMAND 1 ? Ss 0:01 /sbin/init 2 ? S< 0:00 [kthreadd] 3 ? S< 0:00 [migration/0] 4 ? S< 0:00 [ksoftirqd/0] 5 ? S< 0:00 [watchdog/0] 6 ? S< 0:00 [events/0]
root@ubuntu:~# ps aux | grep budi budi budi budi
5894 0.0 0.5 7464 3088 ? 5896 0.0 0.2 14272 1528 ? 5899 0.0 1.1 29088 5920 ?
S 08:05 0:01 /usr/lib/libgconf2-4/gconfd-2 4 S 08:05 0:00 /usr/bin/gnome-keyring-daemon -d --login Ssl 08:05 0:00 /usr/bin/gnome-session
Mematikan Proses Buka aplikasi Firefox Web Browser root@ubuntu:~# ps aux | grep firefox budi root
13809 8.8 21.0 380980 108616 ? Rl 14:19 2:36 /opt/firefox/firefox-bin 14439 0.0 0.1 3020 784 pts/1 R+ 14:48 0:00 grep firefox
root@ubuntu:~# killall s 9 firefoxbin root@ubuntu:~# killall s 9 firefoxbin firefoxbin: no process killed root@ubuntu:~# ps aux | grep firefox budi root
14993 29.9 15.9 294596 82072 ? Rl 15:17 0:05 /opt/firefox/firefox-bin 15035 0.0 0.1 3020 784 pts/1 R+ 15:17 0:00 grep firefox
root@ubuntu:~# kill s 9 15035 su: kill: (15035) No such process root@ubuntu:~# kill s 9 14993 Melihat proses server jaringan root@server:~# ps ax | grep apache 3900 ? Ss 0:00 /usr/sbin/apache2 k start 3904 ? S 0:00 /usr/sbin/apache2 k start 3905 ? S 0:00 /usr/sbin/apache2 k start
21
root@server:~# netstat ap | grep apache2 tcp6 0 0 [::]:www [::]:* LISTEN 3900/apache2
Penjadwalan menit 5 5 5 * *
jam * 12 1 * *
tgl * * 23 * *
bln * * * 2 2
hari * * * * *
CMD CMD CMD CMD CMD CMD
(CMD dijalankan tiap jam lebih 5 menit) (CMD dijalankan setiap jam 12 lebih 5 menit) (CMD dijalankan setiap tanggal 23 jam 01:05) (CMD dijalankan setiap bulan februari tgl 1) (CMD dijalankan setiap hari minggu)
root@ubuntu:~# crontab e 5 1 * * * tar czf /opt/etc.tar.gz /etc crontab: installing new crontab
Backup dan Restore Kompresi file dan direktori root@server:~# tar czvf etc.tar.gz /etc/ tar: Removing leading `/' from member names root@server:~# tar cjvf etc.tar.bz2 /etc/ tar: Removing leading `/' from member names root@server:~# zip r etc.zip /etc/ Kapasitas file kompresi root@server:~# du sk /etc/ 12080 /etc/ (Ukuran asli 12MByte) root@server:~# ls la etc.* (Satuan Byte) rwrr 1 root root 1377966 20100506 09:09 etc.tar.bz2 rwrr 1 root root 1507396 20100506 09:09 etc.tar.gz rwrr 1 root root 11511383 20100506 09:13 etc.zip
Restore file kompresi root@server:~# tar xzvf etc.tar.gz root@server:~# tar xjvf etc.tar.bz2 root@server:~# unzip etc.zip root@server:~# unrar e etc.rar
22
Membuat Partisi Baru Informasi hardisk root@budidesktop:~# fdisk l
Disk /dev/sdb: 160.0 GB, 160041885696 bytes 255 heads, 63 sektor/track, 19457 cylinders, total 312581808 sektor Units = sektor dari 1 * 512 = 512 bytes Ukuran sektor (logikal/fisikal): 512 bytes / 512 bytes Ukuran I/O (minimal/optimal): 512 bytes / 512 bytes Identifikasi disk: 0x5ac25ac2 Perangkat Boot Awal Akhir Blocks Id System /dev/sdb1 * 63 40965749 20482843+ 7 HPFS/NTFS/exFAT /dev/sdb2 40965811 284037119 121535654+ f W95 Ext'd (LBA) /dev/sdb5 40965813 102398309 30716248+ b W95 FAT32 /dev/sdb6 102400000 160991231 29295616 83 Linux /dev/sdb7 160993280 278177791 58592256 83 Linux /dev/sdb8 278179840 284037119 2928640 82 Linux swap / Solaris
Membuat partisi baru root@budidesktop:~# cfdisk /dev/sdb
23
root@budidesktop:~# fdisk l /dev/sdb /dev/sdb9 284037183 312581807 14272312+ 83 Linux root@budidesktop:~# reboot Format partisi baru root@budidesktop:~# mkfs.ext4 /dev/sdb9 Mount partisi baru root@budidesktop:~# mkdir /mnt/test root@budidesktop:~# mount /dev/sdb9 /mnt/test/
24