Difference between revisions of "Perintah Linux S"

From OnnoWiki
Jump to navigation Jump to search
Line 37: Line 37:
  
 
== Sintaksis Sed ==
 
== Sintaksis Sed ==
  #sed 'ADDRESSs/REGEXP/REPLACEMENT/FLAGS' nama_berkas
+
  $ sed 'ADDRESSs/REGEXP/REPLACEMENT/FLAGS' nama_berkas
  #sed 'PATTERNs/REGEXP/REPLACEMENT/FLAGS' nama_berkas
+
  $ sed 'PATTERNs/REGEXP/REPLACEMENT/FLAGS' nama_berkas<br>
 
 
 
  # s is substitute command
 
  # s is substitute command
 
  # / is a delimiter
 
  # / is a delimiter
 
  # REGEXP is regular expression to match
 
  # REGEXP is regular expression to match
  # REPLACEMENT is a value to replace
+
  # REPLACEMENT is a value to replace<br>
 
 
 
  FLAGS can be any of the following
 
  FLAGS can be any of the following
 
  # g Replace all the instance of REGEXP with REPLACEMENT
 
  # g Replace all the instance of REGEXP with REPLACEMENT
Line 61: Line 59:
 
  DROP TABLE petruk_tindakannc;
 
  DROP TABLE petruk_tindakannc;
 
   
 
   
  $ sed -i '/^DROP/s/;$/ CASCADE;/' mytable.sql
+
  $ sed -i '/^DROP/s/;$/ CASCADE;/' mytable.sql<br><br>
  
 
  ''Output''
 
  ''Output''

Revision as of 11:23, 10 April 2013

Indeks - A - B - C - D - E - F - G - H - I - J - K - L - M - N - O - P - Q - R - S - T - U - V - W - X - Y - Z

sane-find-scanner

scanadf

scanimage

scp

screen

script

sdiff

sed

stream editor for filtering and transforming text

Sintaksis Sed

$ sed 'ADDRESSs/REGEXP/REPLACEMENT/FLAGS' nama_berkas
$ sed 'PATTERNs/REGEXP/REPLACEMENT/FLAGS' nama_berkas
# s is substitute command # / is a delimiter # REGEXP is regular expression to match # REPLACEMENT is a value to replace
FLAGS can be any of the following # g Replace all the instance of REGEXP with REPLACEMENT # n Could be any number,replace nth instance of the REGEXP with REPLACEMENT. # p If substitution was made, then prints the new pattern space. # i match REGEXP in a case-insensitive manner. # w file If substitution was made, write out the result to the given file. # We can use different delimiters ( one of @ % ; : ) instead of /
  1. Tambahkan kata "CASCADE" untuk setiap baris yg diawali oleh kata "DROP" dan diakhiri karakter ";"
Isi file drop.sql
DROP TABLE petruk_line_produksi;
DROP TABLE petruk_kapasitas_produksi;
DROP TABLE petruk_status_mutasi;
DROP TABLE petruk_statusnc;
DROP TABLE petruk_tindakannc;

$ sed -i '/^DROP/s/;$/ CASCADE;/' mytable.sql

Output
DROP TABLE petruk_line_produksi CASCADE;
DROP TABLE petruk_kapasitas_produksi CASCADE;
DROP TABLE petruk_status_mutasi CASCADE;
DROP TABLE petruk_statusnc CASCADE;
DROP TABLE petruk_tindakannc CASCADE;

sendmail

sensors

seq

setfdprm

setkeycodes

setleds

setmetamode

setquota

setsid

setterm

sftp

sh

shutdown

restart atau shutdown komputer

shutdown -h now Mematikan komputer
shutdown -r now Merestart komputer

sha1sum

showkey

showmount

shred

shutdown

size

skill

slabtop

slattach

sleep

slocate

snice

sort

split

ssh

Login ke dalam remote machine

  • Login ke alamat ip 8.8.8.8 sebagai user petruk
ssh petruk@8.8.8.8

ssh-add

ssh-agent

ssh-keygen

ssh-keyscan

sshd

stat

statd

strace

strfile

strings

strip

stty

su

sudo

Digunakan agar pengguna biasa dapat menjalakan perintah dengan security privilege milik pengguna lain (biasanya sebagai superuser/root)

  • Hapus direktori document di /home/alif/document secara rekursif
sudo rm -rf /home/alif/document
  • Jalankan perintah terakhir sebagai root
sudo !!

sum

swapoff

swapon

sync

sysctl

sysklogd

syslogd