Sh1n1n9 L1f3

Menuju Hari Esok Yang Lebih Baik Dari Hari ini

Arsip untuk ‘Unix Tutorial’ Kategori

Unix File System Layout

Ditulis oleh Herman di/pada Oktober 6, 2008

Unix File System Layout

Seperti MS-DOS dan Kebanyakan system operasi lain, unix juga mempunyai directory yang diatus agar mudah untuk pengaturan secara lagical. Dengan mengetahui layout dari system unix akan memudahkan kita untuk mencari file-file tertentu, misalnya mencari file untuk pengaturan account pengguna, file pengaturan jaringan dan lain-lain:
Untuk Directori seperti /bin, /etc/, and /sbin Akan kita temukan pada setiap OS dari Unix.
Berikut beberapa directory yang ada pada system unix :
a. /bin (binaries) – essential system binary
ls, cp, mv, chmod, cat, kill, gzip, dan lain-lain
b. /sbin (system binaries) – system binaries, daemons, dan program administrasi.
fsck, mount, umount, adduser, shutdown, route, dan lain-lain
c. /dev (devices) -directory ini digunakan untuk pengaturan physical and logical device pada system unix.
Contohnya input/output device Pada system unix.
d. /etc Directori ini beris file-file konfigurasi system.
Contoh :
/etc/passwd – Berisi Informasin pengguna termasuk nama pengguna, user id, group id, home directory, dan shell
/etc/shadow – Berisi password yang di enskripsi, Informasi masa berakhirnya account user.
/etc/group – informasi user/group
/etc/security/ – Beberapa OS unix menggunakan directory ini untuk file file security.

e. home (home directori) - Tempat user menyimpan file dan tempat untuk melakukan aktivitas harian.
f. /lib (libraries) – bersi file-file library. Seperti .dll files pada OS windows
g. /proc (processes) – ‘proc’ adalah virtual file system. File pada proc disimpan di memori bukan pada drive. Berisi informasi tentang program-progra yang sedang berjalan.
h. /tmp (temporary) - Digunakan untuk temporari file. Pada beberapa Unix system, file pada folder ini akan di hapus pada saat booting.
i. /var (various) – merupakan direktori yang dikhususkan untuk berkas-berkas data variabel (berkas yang dapat diubah-ubah). Direktori /var dibuat untuk memungkinkan operasi mount pada direktori /usr secara read-only. Semua berkas yang ada di direktori /usr, yang ditulis selama sistem berjalan, harus diletakkan pada direktori “/var”
Contoh :
/var/adm – Beris data administrative.
/var/log – Berisi data logs system yang di rekam.
/var/spool – spool dir berisi incoming mail, outgoing mail, cron , dan lain-lain.
/var/man – Berisi file manual pada system binaries.

j. /usr (user) - Berisi subdirectory dan semua user dan tools administrasi
/usr/X11R6 – subdirectori dari X-Windows – berisi semua X-Win program dan file configurasi.
/usr/sbin – Hampir seperti “/sbin”, Direktori ini berisi perintah-perintah biner non-vital mana pun yang digunakan secara eksklusif oleh administrator sistem. Program administrator sistem yang diperlukan untuk perbaikan sistem, mounting /usr atau kegunaan penting lainnya harus diletakkan di /sbin.
/usr/bin – hamper seperti /bin, Direktori ini adalah direktori primer untuk perintah-perintah executable dalam sistem UNIX
/usr/etc – berisi file configurasi untuk system dan program
/usr/lib – berisi libraries tershare untuk aplikasi system
/usr/man – berisi halaman manual untuk system tools
/usr/local – Berisi file yang tidak terlalu penting untuk system dan users. Tapi kadang-kadang berisi file ekstra yang berguna, program “ssh” dan “pgp” biasanya secara default terisntal pada directory ini.

Ditulis dalam Unix Tutorial | Leave a Comment »

Command MS-DOS VS Unix/Linux

Ditulis oleh Herman di/pada Mei 14, 2008

Berikut ini beberapa command MS-DOS dan Unix/Linux yang mempunyai kesamaan tujuan :

MS – DOS

Unix/Linux

attrib

chmod

backup

tar

dir

ls

cls

clear

copy

cp

del

rm

deltree

rm –R

rmdir

edit

vi

pico

format

fdformat

mount

umount

move/rename

mv

type

Less<file>

cd

cd

chdir

more < file

more file

md

mkdir

win

startx

Ditulis dalam Unix Tutorial | Leave a Comment »

Membuat Script Input Output Sederhana

Ditulis oleh Herman di/pada Mei 13, 2008

Berikut ini contoh untuk membuat script Input output sederhana dengan menggunakan “read

Ketik script berikut pada sebuah editor, misalnya notepad atau langsung pada direktory anda yang ada pada system unix, disini menggunakan command cat untuk membuat script dan menyimpan file di directori “/hr ” dengan nama io1

Command :

hr$>cat<EOF>io1

kemudian tulis script berikut :

#Contoh script input output sederhana
# !/bin/sh
echo “*****************************************”
echo “** Contoh Script Input Output Sederahana ****”
echo “*****************************************”
#menampilkan perintah untuk memasukkan nama
echo “Masukkan nama anda !:”
#membaca input yang kita berikan
read nama
#menampilkan input yang kita masukkan
echo “$nama2 adalah teman $nama”
EOF

compile file io1 agar bisa di eksekusi

hr$> chmod +x io1

eksekusi file io1
hr$> io1

hasilnya :
********************************************
** Contoh Script Input Output Sederahana ****
********************************************
Masukkan nama anda !:
Herman
(input)
Hello Herman,lets be friends
hr$>

sama dengan cara diatas dengan, contoh untuk input 2 variabel :

#Contoh script input output sederhana
# !/bin/sh
echo “********************************************”
echo “** Contoh 2 Script Input Output Sederahana ****”
echo “********************************************”
#menampilkan perintah untuk memasukkan nama
echo “Masukkan nama anda !:”
#membaca input yang kita berikan
read nama
echo “Hello $nama,lets be friends”
#menampilkan perintah untuk memasukkan nama teman anda
echo “Masukkan nama teman anda !:”
read nama2
#menampilkan input nama teman yang kita masukkan
echo “$nama2 adalah teman $nama”

hr$> chmod +x io2

hasilnya :
hr$> io2
********************************************
** Contoh 2 Script Input Output Sederahana ****
********************************************
Masukkan nama anda !:
Herman
(input)
Hello Herman,lets be friends
Masukkan nama teman anda !:
Arif
(input)
Arif adalah teman Herman

hr$>

Selamat Belajar …

Ditulis dalam Unix Tutorial | Leave a Comment »

Menulis Script Sederhana

Ditulis oleh Herman di/pada Desember 27, 2007

contoh ini untuk membuat script sederhana

#cat<EOF>helloworld

echo “helloworld”

echo “Belajar Unix”

EOF

#chmod + x helloworld

#cp helloworld /bin

#helloworld (enter)

maka pada shell akan muncul

hello world

belajar unix

Ditulis dalam Unix Tutorial | Leave a Comment »

Basic Unix Command

Ditulis oleh Herman di/pada Desember 21, 2007

A
at : execute commands at a specified time/date.
awk: a scripting language, especially useful for manipulating text and automation.

B
bash : invokes the Bourne Again Shell (standard on most boxes).
batch: execute comands when load permits.
bc : interactive C-like calcultor (integers only).
C
cal : displays a calender, also lets you choose month/year using parameters.
calender : invoke a reminder service.
cancel : cancel request to calender.
cat : concatenate files (displays a file without scrolling ability. Simply dumps
it to the standard output. Can be useful when chaining multiple
applications to do complicated jobs, so one application can use another’s
output as input).
cd : change the current working directory.
chgrp : change group ownership of a file.
chmod : change access patterns (permissions) to files.
chown : change user ownership of files.
clear : clear the screen.
cmp : compare two files.
cp : copy files.
cpio : archive and extract files.
cron : clock deamon (executes “batch” and “at” commands).
crontab : schedules commands at regular intervals.
crypt : encrypt , decrypt files using altered DES, standard to Unix passwords
(restricted distribution).
csh : invoke the C shell.
csplit : split file into several other files.
cu : call up another unix terminal.
cut : cut selected fields from each line of file.

D
date : displays the time and date (can also change it if you’re root).
dd : convert and copy a file.
df : reports space (free, total etc’) on all mounted file systems.
diff : copare two files.
diff3 : compare 3 or more files.
dircmp : compare two directories.
du : report disk usage.
E
echo : echo argument to standart output.
ed : line oriented editor.
egrep : extended version of grep (searches for extended regular expressions).

expr : evaluate boolean and arithmetic expression.

F
fgrep : same as grep, only it interprets patterns as a list of fixed strings.
false : return nonzero (false) exit status.
file : report type of file.
find : find matching files and run specified programs on them (optional).
finger : report user information (operates remotely only if a finger server is running
on the remote host).
ftp : (file transfer protocol) a client for FTP servers.

G
grep : search files for regular expression matches.

H
haltsys : gracefully shutdown sytem (can only be run by root. halt in Linux).
head : display first 10 lines of a file.

J
join : display the combination (lines with command field) of two fields.

K
kill : send a signal to terminate a process.
ksh : invoke the korn shell.

L
line : read a specific line out of a file (shell script usage).
ln : create a link to a file/directory.
logname : gets your login name.
lpr : sends a request to printer.
lprint : prints on local printer.
lpstat : reports printer status.
lpq : same as above.
ls : lists the contents of directory.

M
mail : send and recieve mail.
man : displays manual pages.
mesg : grant or deny permissions to recieve messages from other users using the
write command.
mkdir : create a new directory .
mknod : build a special file.
more : display file one page at a time.
mount : mount a storage device.
mv : move or rename a file.

N
news : display news item from NNTP servers.
nice : change priorities of processes.
nohup : run a command after logout (ignores hangup signals).
nroff : format files for printing.
nslookup : retrieve information from DNS servers.

O
od : displays a file in 8-based octals.

P
passwd : create or change login password.
paste : merge lines of files.
pr : format and print file.
ps : reports status of active processes.
pstat : report system status.
pwcheck : check /etc/passwd (default) file.
pwd : display current working directory.

R
rm : remove (erase) files or directories (unrecoverable).
rmdir : remove an empty directory.
rsh : invoke Restricted Bourne Shell.

S
sed : the stream editor.
set : assign value to variable.
setenv : assign value to enviroment variable.
sh : invoke Bourne shell.
sleep : suspend execution of a command for a given period.
sort : sort and merge files.
spell : find spelling errors.
split : split file to smaller files.
stty : set options for a terminal.
su : spawns a subshell with a different username, requires other user’s
password,unless you’re root.
sum : compute checksums and number of blocks for files.

T
tabs : set tabs on a terminal.
tail : display last 10 lines of file.
tar : a simple compression tool that merges multiple files into a single one,
originally made to make backing up materials on backup tapes easier.
tee : create a tee in a pipe.
telnet : access remote systems using the telnet protocol.
test : test various expressions and files.
time : display elapsed time (execution, process, and system times) for a
command.
touch : change time/date stamps of files.
tr : substitutes sets of charecters.
translate : translates files to different format.
troff : format files to phototypester.
true : return zero (true) exit status.
tset : set terminal mode.
tty : report a name of a terminal.

U
umask : set file-creation mode (permissions) mask.
umount : unmount a device.
uname : display the name of the current system.
uniq : report any duplicate line in a file.
units : convert numbers from one unit to another.
unzip : extract files from zip archieve.
uptime : report system activety.
uucp : copy files between two unix systems (oldie but still beautiful).
uulog : report uucp status.
uuname : list uucp sites known to this site.
uudecode : decode to binary after “uuencode” transmission.
uencode : encode binary file for email transmission.
uustat : report status of uucp or cancel a job.
uupick : receive public files sent bu uuto.
uuto : send files to another public Unix system.
uux : execute command to remote Unix system.

V
vi : a screen oriented (visual) editor (cool ,but Vim is better).

W
wall : sends message to all users (root only).
wait : await completion of background process.
wc : count lines, words, bytes etc’ in one or more files.
who : report active users.
whois : search for user information.
write : send a message for another user (see mesg).
whoami : which user you are logged in as at the moment. If you, for example,
switch to a different user, logname will show the original username you
logged in as, and whoami will show the current user.

Z
zip : archieve file or files in zip format.

Ditulis dalam Unix Tutorial | Leave a Comment »