Coding in Linux

16
Coding In Linux Masuk ke root linux(openSuse) Masuk ke root linux. dip5a@linux-lne0:~> whoami dip5a dip5a@linux-lne0:~> su Password: linux-lne0:/home/dip5a # su dip5a balik ke home user. linux-lne0:/home/dip5a # su dip5a dip5a@linux-lne0:~> buat mkdir dip5a@linux-lne0:~> mkdir Aman ls dip5a@linux-lne0:~> ls Aman Desktop Download Pictures public_html Videos bin Documents Music Public Templates masuk ke Aman dir dip5a@linux-lne0:~> cd Aman buat dir kat dalam aman dip5a@linux-lne0:~/Aman> mkdir oren 1 Ni adalah Kembali kepada dir home ada Buat mkdir dan senarai dir yg

description

command

Transcript of Coding in Linux

Coding In LinuxMasuk ke root linux(openSuse)Masuk ke root linux.

Ni adalah root dirdip5a@linux-lne0:~> whoamidip5adip5a@linux-lne0:~> su

Kembali kepada dir home ada simbol (~)Password: linux-lne0:/home/dip5a # su dip5abalik ke home user.linux-lne0:/home/dip5a # su dip5adip5a@linux-lne0:~>

buat mkdirdip5a@linux-lne0:~> mkdir Aman

Buat mkdir dan senarai dir yg di ciptalsdip5a@linux-lne0:~> lsAman Desktop Download Pictures public_html Videosbin Documents Music Public Templates

masuk ke Aman dirdip5a@linux-lne0:~> cd Aman

buat dir kat dalam amandip5a@linux-lne0:~/Aman> mkdir orendip5a@linux-lne0:~/Aman> lsorenbuat dir sekali gusdip5a@linux-lne0:~> mkdir Aman/puodip5a@linux-lne0:~> cd Amandip5a@linux-lne0:~/Aman> lsoren puo

padam dir guna rmdirdip5a@linux-lne0:~/Aman> rmdir puodip5a@linux-lne0:~/Aman> lsoren

kembali ke dir dip5adip5a@linux-lne0:~/Aman> cd..dip5a@linux-lne0:~>

padam dir aman dan dir oren sekali gusdip5a@linux-lne0:~> rm -r Amandip5a@linux-lne0:~> lsbin Documents Music Public TemplatesDesktop Download Pictures public_html Videos

Buat faildip5a@linux-lne0:~> touch f1dip5a@linux-lne0:~> lsbin Documents f1 Pictures public_html VideosDesktop Download Music Public Templates

Buat fail dan tulis data faildip5a@linux-lne0:~> cat > f2nama saya aman.Symbol ni tekan : Ctrl+C^Cdip5a@linux-lne0:~> lsbin Documents f1 Music Public TemplatesDesktop Download f2 Pictures public_html Videos

Fail tercipta

Papar data dalam fail f2dip5a@linux-lne0:~> cat f2nama saya aman.

Edit fail semula f2dip5a@linux-lne0:~> cat >> f2nama saya aman.saya pelajar puo.^Cdip5a@linux-lne0:~> cat f2nama saya aman.nama saya aman.saya pelajar puo.

guna vi

tekan i INSERT (masukkan data dalam fail)

Nak save fail vi

W nak save.f3 nama fail.Gunakan : Esc+Shift+:Masukkan huruf :W f3 nak save.

Dan tekan : Enter.

Fail ber jaya disimpan.

Keluar dari viGunakan : Esc + Shift +:

Masukkan huruf :q nak save.

Tercipta fail : f3Kembali ke :dip5a@linux-lne0:~> vidip5a@linux-lne0:~> lsbin Documents f1 f3 Pictures public_html VideosDesktop Download f2 Music Public Templatesdip5a@linux-lne0:~>

cipta fail

Cipta satu fail baru.dip5a@linux-lne0:~> cat >f4^C dip5a@linux-lne0:~> lsbin Documents f1 f3 Music Public TemplatesDesktop Download f2 f4 Pictures public_html Videos

Fail tercipta.

Padam faildip5a@linux-lne0:~> rm f4dip5a@linux-lne0:~> lsbin Documents f1 f3 Pictures public_html VideosDesktop Download f2 Music Public TemplatesFail f4 telah di padam.

Untuk lihat semua failDi desktop klik pada :

Buat compress fail gzipdip5a@linux-lne0:~> lsbin Documents f1 Music Public TemplatesDesktop Download f2 Pictures public_html Videosdip5a@linux-lne0:~> tar czvf Aman.gz f1 f2

Buat compress fail bzipdip5a@linux-lne0:~> tar cjvf Aman.bz2 f1 f2

Buat compress fail bzipdip5a@linux-lne0:~> tar cf Aman.tar f1 f2

Nak Extract compress faildip5a@linux-lne0:~> tar xvf Aman.tar

masuk Ke Root Untuk Tambah Userdip5a@linux-lne0:~> suPassword: linux-lne0:/home/dip5a # useradd -m amanlinux-lne0:/home/dip5a # passwd amanlinux-lne0:/home/dip5a # useradd -m orenlinux-lne0:/home/dip5a # passwd oren

DI Root Untuk buat grouplinux-lne0:/home/dip5a # groupadd diplinux-lne0:/home/dip5a # groupadd dip5a

DI Root Untuk buat primary grouplinux-lne0:/home/dip5a # usermod g dip5a aman

DI Root Untuk buat secondary grouplinux-lne0:/home/dip5a # usermod G dip aman

Untuk Change Permission Faildip5a@linux-lne0:~> chmod 744 f1userlinux-lne0:/home/dip5a # chmod 704 amangrouplinux-lne0:/home/dip5a # chmod 704 dip5a

Buat compress Di Ubuntu 11.10 dip5a@ubuntu:/$ sudo apt-get install zipReading pakage lists DoneBuilding dependency treeReading state information DoneZip is already the newest version.0 upgraded, 0 newly installed, 0 to remove and 107 not upgraded.dip5a@ubuntu:/$ zip Aman.zip f1 f2adding: f1 (stored 0%)adding: f3 (stored 0%)dip5a@ubuntu:/$ lsbin Documents f1 f3 Music Public TemplatesDesktop Download Aman.zip Pictures public_html Videos

Task 3

a.Installing Samba. Open terminal and execute sudo apt-get install samba .

b.To create password as PA$$woRd, open terminal and execute sudo smbpasswd -a nina command. Then, enter PA$$woRd. Example:

c.Open terminal and execute mkdir Desktop/SHARED to create a directory name SHAREDin desktop. To share the files using samba, add some command line at smb.conf file in directory /etc/samba/. To do this, Open terminal and execute the command sudo pico /etc/samba/smb.conf . Then insert the following words in bottom page of smb.conf :

[SHARED]comment = Share directory /nina/Desktop/SHAREDpath = /nina/Desktop/SHAREDguest ok = Yeslocking = No

Example:

d.To restart Samba, execute sudo restart smbd.Example:

e.To check syntax errors, execute sudo testparm .Example:

If presses enter, it will show;

1