Bekerja Dengan Bash Shell

Slides:



Advertisements
Presentasi serupa
SHELL PROMPT 1.
Advertisements

Basic Issue In System Administration. Bassic Issue In System Administration Creating and managing accounts Performing administrative task Access control.
+ ADMINISTRASI SISTEM II Teknik Informatika Universitas Bunda Mulia Jakarta Indra Priyandono.
Command Line Interface
Shell Programming Oleh: Idris Winarno.
© aSup-2007 PENGENALAN SPSS   1 INTRODUCTION to SPSS Statistical Package for Social Science.
SISTEM FILE & DIRECTORY
Pemrograman Internet Mobile 7 PHP: Hypertext Preprocessors.
Alg&Pemrog 2B Sistem Komputer Variable  Variable dapat didefinisikan sebagai bagian dari memory untuk menyimpan nilai yang telah ditentukan.  Setiap.
Perbedaan LINUX dan UNIX Pengenalan LINUX
Learning Medium School : SMPN 1 Gotham City Subject : English
STRUCTURAL CONTROL STATEMENT  If  If…..else….  If ….elseif…else.
Javascript Javascript Javascript Javascript Javascript Javascript
SUBPROGRAM IN PASCAL PROCEDURE Lecture 5 CS1023.
1 Pertemuan 1 Introduction Matakuliah: sistem Operasi Tahun: 2010.
K-Map Using different rules and properties in Boolean algebra can simplify Boolean equations May involve many of rules / properties during simplification.
Shell Programming Oleh: Idris Winarno. Shell dan Shell Programming Shell adalah Command executive, artinya program yang menunggu instruksi dari pemakai,
Sistem Operasi.
REPETITION CONTROL STRUCTURES
PRAKTIKUM 3 PEMROGRAMAN BASIS DATA. Menghapus baris  Deleting rows- DELETE FROM Use the DELELE FROM command to delete row(s) from a table, with the following.
INTRODUCTION TO SPSS Statistical Package for Social Science 1.
BASIC CISCO. Memakai Cisco Cisco dapat dikonfigurasi melalui 3 cara : Console : menggunakan cable console yang dihubungkan melalui serial port dan menggunakan.
Perangkat Lunak Jaringan I SHELL SCRIPT. Perangkat Lunak Jaringan I PENDAHULUAN Shell script adalah suatu file yang berisi perintah-perintah yang harus.
SHELL SCRIPT KLOBODH + OLOAN.
Memulai dengan LINUX Sistem Operasi Berbasis Jaringan Chapter 01.
1 Pertemuan 5 Komunikasi antar Proses / Interprocess Communication (IPC) Matakuliah: T0316/sistem Operasi Tahun: 2005 Versi/Revisi: 5 OFFCLASS01.
HOW TO ACHIEVE 30% BLENDED LEARNING IN 1 HOUR. Objective To achieve 30% blended learning To achieve 30% blended learning.
BASH Erick, David © Sekolah Tinggi Teknik Surabaya 1.
9.3 Geometric Sequences and Series. Objective To find specified terms and the common ratio in a geometric sequence. To find the partial sum of a geometric.
IP Addressing Laboratorium Teknik Informatika Universitas Gunadarma Stefanus Vlado Adi Kristanto Version 1.4.
OPERATOR DAN FUNGSI MATEMATIK. Operator  Assignment operator Assignment operator (operator pengerjaan) menggunakan simbol titik dua diikuti oleh tanda.
Cursor MI2163 Dasar Pemrograman Basis Data. Introduction Cursor merupakan suatu variabel yang digunakan untuk menampung hasil query yang terdiri atas.
Samples: Smart Goals ©2014 Colin G Smith
Visual Basic for Aplications in powerpoint. What is Visual Basic for Aplications? Visual Basic for Applications (VBA) is a very powerful objectoriented.
Dasar query basis data dengan SQLite
Jartel, Sukiswo Sukiswo
Teknik. Pemrog. Terstruktur 2
PERINTAH DASAR SISTEM OPERASI LINUX
Konsep pemrograman LOOP
Rakhmadhany Primananda, S.T., M.Kom
Command Line Linux - UBUNTU
PROSES DAN MANAJEMEN PROSES (1)
Praktikum 7 Sistem Operasi
Pemrograman Berorientasi Objek
Kk ilo Associative entity.
Master data Management
Database User Account.
How to Set Up AT&T on MS Outlook ATT is a multinational company headquartered in Texas. ATT services are used by many people widely across.
How You Can Make Your Fleet Insurance London Claims Letter.
How Can I Be A Driver of The Month as I Am Working for Uber?
Things You Need to Know Before Running on the Beach.
How to Pitch an Event
Don’t Forget to Avail the Timely Offers with Uber
Teknik. Pemrog. Terstruktur 2
Group 3 About causal Conjunction Member : 1. Ahmad Fandia R. S.(01) 2. Hesti Rahayu(13) 3. Intan Nuraini(16) 4. Putri Nur J. (27) Class: XI Science 5.
V ERIZON SETTINGS FOR I P HONE, A NDROID, O UTLOOK, AND W INDOWS P HONE.
HughesNet was founded in 1971 and it is headquartered in Germantown, Maryland. It is a provider of satellite-based communications services. Hughesnet.
Here you'll find the complete solution about how to set up Roadrunner settings for iPhone, Android, Windows Phone and Outlook. Unable to set up Roadrunner.
Do you want to check your Zoho mail incoming or outgoing logs and unable to check, go through with this article and access Zoho mail incoming or outgoing.
 Zoho Mail offers easy options to migrate data from G Suite or Gmail accounts. All s, contacts, and calendar or other important data can be imported.
Fix problems opening Norton  Fix problems opening Norton This problem can happen after you update Norton. To fix the matter, restart the computer. Fix.
If you are an user, then you know how spam affects your account. In this article, we tell you how you can control spam’s in your ZOHO.
CALL PC EXPERT How to Remove Adware, Pop- up Ads from Web Browser.
In this article, you can learn about how to synchronize AOL Mail with third-party applications like Gmail, Outlook, and Window Live Mail, Thunderbird.
Right, indonesia is a wonderful country who rich in power energy not only in term of number but also diversity. Energy needs in indonesia are increasingly.
Rank Your Ideas The next step is to rank and compare your three high- potential ideas. Rank each one on the three qualities of feasibility, persuasion,
2. Discussion TASK 1. WORK IN PAIRS Ask your partner. Then, in turn your friend asks you A. what kinds of product are there? B. why do people want to.
Wednesday/ September,  There are lots of problems with trade ◦ There may be some ways that some governments can make things better by intervening.
Transcript presentasi:

Bekerja Dengan Bash Shell Praktikum 6 Sistem Operasi

POKOK BAHASAN: History pada Bash Shell Membuat Bash Shell Script

Tujuan: Siswa mampu … Memahami shell pada sistem operasi Linux. Menggunakan feature history pada Bash Shell. Mengubah feature history pada Bash Shell. Mengubah prompt shell. Melakukan konfigurasi Bash Shell untuk menjalankan skrip secara otomatis. Membuat dan mengeksekusi shell script sederhana melalui editor vi. Memahami job control. Memahami stack. Menggunakan alias.

Why Shell? The commercial UNIX used Korn Shell For Linux, the Bash is the default Why Shell? For routing jobs, such as system administration, without writing programs However, the shell script is not efficient, therefore, can be used for prototyping the ideas For example, % ls –al | more (better format of listing directory) % man bash | col –b | lpr (print man page of man)

What is Shell? Shell is the interface between end user and the Linux system, similar to the commands in Windows Bash is installed as in /bin/sh Check the version % /bin/sh --version Kernel Other programs csh bash X window

Interactive Login ELSE IF ~/.bash_profile exists IF /etc/profile exist THEN execute /etc/profile ELSE IF ~/.bash_profile exists THEN execute ~/.bash_profile ELSE IF ~/.bash_login exist THEN execute ~/.bash_login ELSE IF ~/.profile exist THEN execute ~/.profile END IF

Pada saat login, program akan menjalankan beberapa program yaitu : /etc/profile Berisi shell script yang berlaku untuk seluruh pengguna Linux. .bash_profile The personal initialization file, executed for login shells.bash_login .bash_login .profile Berisi shell script yang berlaku untuk pengguna tertentu. 5 .bashrc File ini akan dieksekusi untuk perpindahan dari satu shell ke shell yang lain melalui instruksi su.

Interactive Logout .bash_logout Pada saat logout, maka bash akan mencari file .bash_logout. Bila ada, file tersebut akan dieksekusi sebelum logout

Environment Variables Think of the shell as any other program that you write. Your program maintains information about its current state. Since the shell's main job is to act as a liaison between the kernel and the user, it maintains information about the computing environment. The environment variables hold this information.

Important Environment Variables HOME - your home directory. USER and LOGNAME - your login ID. HOSTNAME - the name of the host computer. PWD - the current working directory. MAIL - where your mail is located. PATH - a list of directories in which to look for executable commands. Certain applications and commands may communicate with the shell and reference the environment variables that it maintains. For example, it seems that frm and nfrm seem not to work if $MAIL is not defined. frm and nfrm are commands to list the contents of your inbox without logging into pine.

Checking environment variable $printenv Display value of each variable environmet $echo $<env_variable> $echo $HOME $echo $USER Mengeset value variable environmet $export var = value $ ORACLE_HOME=/usr/lib/oracle/11.2/client64 $ export ORACLE_HOME Mengeset PATH JAVA $ JAVA_PATH=/opt/jdk/bin $ export JAVA_PATH

How to Save Environment Variable If we type environment variable on the shell, when we restart the system, the environmet variable will disappear You can add it to the file .profile or .bashrc or your current shell profile file (located in your home directory). Then, each time you open your shell it will be loaded. If u want for all user, set it in /etc/profile

Prompt string $ echo $PS1 Output : \\u@\h \\W]\\$ Let us try to set the prompt so that it can display today’d date and hostname: PS1="\d \h $ “ Output : Sat Jun 02 server $ Now setup prompt to display date/time, hostname and current directory $ PS1="[\d \t \u@\h:\w ] $ “ Output : [Sat Jun 02 14:24:12 vivek@server:~ ] $

Sintax PS \a : an ASCII bell character (07) \d : the date in “Weekday Month Date” format (e.g., “Tue May 26”) \D{format} : the format is passed to strftime(3) and the result is inserted into the prompt string; an empty format results in a locale-specific time representation. The braces are required \e : an ASCII escape character (033) \h : the hostname up to the first ‘.’ \H : the hostname \j : the number of jobs currently managed by the shell \l : the basename of the shell’s terminal device name \n : newline

\r : carriage return \s : the name of the shell, the basename of $0 (the portion following the final slash) \t : the current time in 24-hour HH:MM:SS format \T : the current time in 12-hour HH:MM:SS format \@ : the current time in 12-hour am/pm format \A : the current time in 24-hour HH:MM format \u : the username of the current user \v : the version of bash (e.g., 2.00) \V : the release of bash, version + patch level (e.g., 2.00.0)

\w : the current working directory, with $HOME abbreviated with a tilde \W : the basename of the current working directory, with $HOME abbreviated with a tilde \! : the history number of this command \# : the command number of this command \$ : if the effective UID is 0, a #, otherwise a $ \nnn : the character corresponding to the octal number nnn \\ : a backslash \[ : begin a sequence of non-printing characters, which could be used to embed a terminal control sequence into the prompt \] : end a sequence of non-printing characters

Eksekusi Program Shell Membuat file p1.sh $ vi p1.sh echo “Program bash Script” Mengubah program menjadi executable $ ls –l p1.sh $ chmod +x p1.sh $ ls –l p1.sh  Menjalankan script $ bash p1.sh $ sh p1.sh $ . p1.sh $ ./p1.sh

HISTORY $export HISTCONTROL=ignoreboth:erasedups

Dirs : melihat stack directory Pushd : Memasukkan direktori tertentu ke stack Popd : Mengeluarkan direktory tertentu ke stack Alias : Melakukan alias untuk perintah tertentu Unalias

el