PERINTAH DASAR PADA LINUX
PENDAHULUAN
Linux adalah nama yang diberikan kepada sistem operasi komputer bertipe Unix.
Linux merupakan salah satu contoh hasil pengembangan perangkat lunak bebas dan
sumber terbuka utama. Seperti perangkat lunak bebas dan sumber terbuka lainnya
pada umumnya, kode sumber Linux dapat dimodifikasi, digunakan dan didistribusikan
kembali secara bebas oleh siapa saja.
LATAR BELAKANG
dibuatnya materi ini dikarenakan banyak sekali orang yang tidak tau perintah
perintah dasar linux
MAKSUD DAN TUJUAN
supaya
para pembaca bisa lebih mengetahui tentang perintah - perintah dasar
linux
perintah perintah dasar linux
mkdir -
membuat direktori.
sintaks :
mkdir [OPTION] DIRECTORY...
contoh :
$ mkdir data
ls - menampilkan isi dari
direktori.
sintaks :
ls [OPTION]... [FILE]...
contoh :
$ ls -ls
cd - berpindah direktori.
sintaks :
cd [DIRECTORY]
contoh :
$ cd data
pwd -
menampilkan tempat direktori yang sedang dikerjakan.
sintaks :
$ pwd
cp - mengcopy file dan
direktori.
sintaks :
cp [OPTION]... SOURCE DEST
contoh :
$ cp sample.txt sample_copy.txt
$ cp sample_copy.txt target_dir
mv - memindahkan atau merubah
nama file.
sintaks :
mv [OPTION]... SOURCE DEST
contoh :
$ mv source.txt target_dir
$ mv old.txt new.txt
rm - menghapus file atau
direktori.
sintaks :
rm [OPTION]... FILE...
contoh :
$ rm file1.txt , rm rf some_dir
find -
mencari file dalam sebuah direktori.
sintaks :
find [OPTION] [path] [pattern]
contoh :
$ find file1.txt, find name file1.txt
touch -
Update waktu akses dan modifikasi setiap BERKAS ke waktu sekarang. Argumen FILE
yang tidak ada menjadi ada kosong.
sintaks:
touch [OPTION]... FILE...
contoh :
$ touch done
file -
menentukan jenis file.
sintaks:
file [OPTION...] [FILE...]
contoh :
$ file ubuntu-desktop.pdf
locate -
menemukan atau mencari file.
sintaks :
locate [OPTION]... FILE...
contoh :
$ locate file1.txt
whereis -
locate the binary, source, and manual page files for a command.
sintaks :
whereis [-bmsu] [-BMS directory... -f] filename...
contoh :
$ whereis ssh
Pola
Pola
adalah ungkapan yang menggambarkan satu set string yang digunakan untuk
memberikan gambaran ringkas dari sebuah himpunan, tanpa harus daftar semua
elemen. contoh : ab*cd cocok apa pun yang dimulai dengan ab dan diakhiri dengan
cd dll.
$ ls *.txt
artinya mencetak semua file yang berekstensi .txt (file teks)
Pemrosesan
Teks
cat -
menggabungkan file dan cetak pada keluaran standar.
sintaks :
cat [OPTION] [FILE]...
contoh :
$ cat avatar.avi.001 avatar.avi.002 > avatar.avi
$ cat readme.txt
echo -
menampilkan baris teks.
sintaks :
echo [OPTION] [string] ...
contoh :
$ echo I love Indonesia
$ echo $HOME
grep -
mencetak baris yang cocok dengan pola.
sintaks :
grep [OPTION] PATTERN [FILE]..
contoh :
$ grep i apple sample.txt
wc - mencetak jumlah baris,
kata, dan byte di file.
sintaks :
wc [OPTION]... [FILE]...
contoh :
$ wc file1.txt
sort -
mengurutkan file teks baris.
sintaks :
sort [OPTION]... [FILE]...
contoh :
$ sort file1.txt
md5sum -
compute and check MD5 message digest.
sintaks :
md5sum [OPTION]... [FILE]...
contoh :
$ md5sum LinuxMint-5-Fluxbox.iso > md5sums
$ md5sum -c md5sums
Linux
File Permissions
3
jenis file permission – read, write, execute 10 bit format dari perintah 'ls -l'
1 2 3 4 5 6 7 8 9 10 file type owner group others contoh : drwxrwr owner
berarti memiliki semua tiga hak akses, group mempunyai izin membaca dan
menulis, others hanya mempunyai izin membaca. read - 4, write - 2, execute - 1
contoh :
rwxrwr = 764
Sistem
Administrasi
chmod -
mengubah hak akses file.
sintaks :
chmod [OPTION] [MODE] [FILE]
contoh :
$ chmod 744 calculate.sh
chown -
mengubah pemilik file dan group.
sintaks :
chown [OPTION]... OWNER[:[GROUP]] FILE...
contoh :
$ chown ugos myfile.txt
su - mengubah user ID atau
menjadi super-user.
sintaks :
su [OPTION] [LOGIN]
contoh :
$ su ugos
$ su
passwd -
update token otentikasi pengguna.
sintaks :
passwd [options] [LOGIN]
contoh :
$ passwd ugos
who -
menunjukkan siapa yang login.
sintaks :
who [OPTION]
contoh :
$ who
Managemen
Proses
ps - laporan snapshot dari
proses saat ini.
sintaks :
ps [OPTION]
contoh :
$ ps ax
kill -
untuk membunuh proses (menggunakan mekanisme sinyal).
·
sintaks :
kill [OPTION] pid
contoh :
$ kill 9 2275
lsusb -
daftar perangkat USB.
sintaks :
$ lsusb
jobs -
menampilkan nama dan id latar belakang pekerjaan.
sintaks :
$ jobs
top -
tampilan tugas Linux.
sintaks :
top -hv | -bcisSH -d delay -n iterations [-u user | -U user] -p pid [,pid ...]
contoh :
$ top
clear -
menghapus layar terminal.
sintaks :
$ clear
free -
menampilkan jumlah memori yang bebas dan digunakan dalam sistem.
·
sintaks :
free [-b | -k | -m | -g] [-o] [-s delay ] [-t] [-V]
contoh :
$ free -m
Arsip
tar - ke
arsip file.
sintaks :
tar [OPTION] DEST SOURCE
contoh :
$ tar cvf original.tar original/
$ tar -cpvf original.tar.gz original/
$ tar xvf original.tar
$ tar xjvf original.tar.bz2
$ tar --lzma -xvf original.tar.lzma
bzip2 -
kompresor blok-menyortir file.
sintaks :
bzip2 [OPTION] FILE...
contoh :
$ bzip2 original.mp3
$ bzip2 -d original.mp3.bz2
zip -
paket dan kompres (arsip) file.
sintaks :
zip [OPTION] DEST SOURCE
contoh :
$ zip -r original.zip original/
rar -
arsip file dengan kompresi.
sintaks :
rar <command> [-<switch 1> -<switch N>] archive [files...]
contoh :
$ rar original.rar original
unzip -
daftar, test dan ekstrak file yang dikompresi dalam sebuah ZIP archive.
sintaks :
unzip [-Z] [-opts[modifiers]] file[.zip] [list] [-x xlist] [-d exdir]
contoh :
$ unzip original.zip
unrar -
daftar, test dan ekstrak file yang dikompresi dalam sebuah RAR archive.
sintaks :
unrar <command> -<switch 1> -<switch N> <archive> <files...> <@listfiles...> <path_to_extract>
contoh :
$ unrar -x original.rar
7z - Sebuah pengarsipan file
dengan rasio kompresi tertinggi.
sintaks :
7z <command> [<switches>...] <archive_name> [<file_names>...] [<@listfiles...>]
contoh :
$ 7z e original.7z
Jaringan
ssh -
SSH client (remote login program) “ssh adalah program untuk login ke mesin
remote dan untuk mengeksekusi perintah pada mesin remote”.
sintaks :
ssh [options] [user]@hostname
contoh :
$ ssh -l guest 10.105.11.20
scp -
secure copy (copy file program remote) “scp salinan file antara host pada
jaringan”.
sintaks :
scp [options] [[user]@host1:file1] [[user]@host2:file2]
contoh :
$ scp file1.txt guest@ip_address:~/
ifconfig -
mengkonfigurasi perangkat jaringan.
sintaks :
ifconfig [-a] [-v] [-s] <interface> [[<AF>] <address>]
contoh :
$ ifconfig
iwconfig -
mengkonfigurasi perangkat jaringan nirkabel.
sintaks :
iwconfig [interface]
contoh :
$ iwconfig
wget -
Downloader non-interaktif jaringan.
sintaks :
wget [option]... [URL]...
contoh :
$ wget -c http://repo.ugm.ac.id/iso/ubuntu/10.04/ubuntu-10.04-netbook-i386.iso
netstat -
Cetak koneksi jaringan, tabel routing, statistik interface, koneksi masquerade,
dan keanggotaan multicast.
sintaks :
netstat [-vWeenNcCF] [<Af>] -r
contoh :
$ netstat
·
mtr -
tool diagnostik jaringan.
sintaks :
mtr [-hvrwctglspniu46] [--help] [--version] [--report]
contoh :
$ mtr google.co.id
iftop -
menampilkan penggunaan bandwidth pada sebuah perangkat ethernet oleh host.
sintaks :
iftop -h | [-nNpbBP] [-i interface] [-f filter code] [-F net/mask]
contoh :
# iftop -i eth0
File
Systems
fdisk -
partisi manipulator.
sintaks :
fdisk [options] <disk>
contoh :
# fdisk l
mount -
mount file system.
sintaks :
mount t type device dir
contoh :
# mount /dev/sda5 /media/target
umount -
unmount file system.
sintaks :
umount [OPTIONS] dir | device...
contoh :
# umount /media/target
du - estimasi sintaks kapasitas
file.
sintaks :
du [OPTION]... [FILE]...
contoh :
$ du -h
df - diskfile, laporan sintaks kapasitas
hardisk.
sintaks :
df [OPTION]... [FILE]...
contoh :
$ df -h
eject -
eject removable media
sintaks :
eject [OPTION]
contoh :
$ eject
·
$ eject -t
Editor
perintah
nano -
Nano, editor lainnya, yang bebas disempurnakan Pico clone.
sintaks:
nano [OPTIONS] [[+LINE,COLUMN] FILE]..
contoh :
$ nano readme.txt
pico -
sebuah program editor teks yang ditingkatkan.
sintaks:
pico [OPTIONS] [[+LINE,COLUMN] FILE]..
contoh :
$ pico readme.txt
vi - program text editor.
sintaks :
vi [OPTION] [file]...
contoh :
$ vi hello.c
vim - Vi
Improved, program text editor.
sintaks :
vim [OPTION] [file]...
contoh :
$ vim hello.c
Perintah
Advanced
reboot -
reboot sistem.
sintaks :
reboot [OPTION]
contoh :
# reboot
halt -
shutdown komputer.
sintaks :
# halt
shutdown -
shutdown komputer.
sintaks :
shutdown [OPTION]
contoh :
# shutdown -h now
sed -
stream editor untuk penyaringan dan mengubah teks.
sintaks :
sed [OPTION] [inputfile]...
contoh :
$ sed 's/love/hate/g' loveletter.txt
·
awk -
pola scanning dan pengolahan bahasa.
contoh :
$ awk F: '{ print $1 }' sample_awk.txt
watch -
menjalankan program secara berkala, menunjukkan output fullscreen.
sintaks :
watch [OPTION] <command>
contoh :
$ watch lsusb
alias -
membuat alias dari sebuah perintah.
sintaks:
alias [name[=value] ... ]
contoh :
$ alias dir='ls -l'
screen -
layar manajer dengan emulasi terminal VT100/ANSI.
sintaks :
screen [-opts] [cmd [args]]
contoh :
$ screen -S ugos
lshw -
list hardware.
sintaks :
·
lshw [-format] [-options ...]
contoh :
$ lshw -C network
dmidecode -
DMI table decoder
sintaks :
dmidecode [OPTIONS]
contoh :
# dmidecode --type memory
uptime -
menampilkan berapa lama sistem telah berjalan.
sintaks :
$ uptime
split -
membagi file menjadi potongan-potongan.
sintaks :
split [OPTION]... [INPUT [PREFIX]]
contoh :
$ split -b 200MB avatar.avi avatar.avi.
espeak -
Sebuah perangkat lunak multi-lingual speech synthesizer.
sintaks :
espeak [options] [<words>]
contoh :
$ espeak -s 80 "Linux"
aplay -
command-line perekam suara dan pemutar untuk driver soundcard ALSA.
sintaks :
aplay [OPTION]... [FILE]...
contoh :
$ aplay -l
$ aplay donw.wav
arecord -
command-line perekam suara untuk driver soundcard ALSA.
sintaks :
arecord [OPTION]... [FILE]...
contoh :
$ arecord -f cd -t raw | lame -x -r – out.mp3
lsb_release -
cetak distribusi informasi spesifik
sintaks :
lsb_release [options]
contoh :
$ lsb_release -a
cal -
menampilkan sebuah kalender.
sintaks :
cal [-hjy] [[month] year]
contoh :
$ cal 4 2011
date -
mencetak atau mengatur tanggal dan waktu sistem.
sintaks :
date [OPTION]... [+FORMAT]
contoh :
# date 041520152011
artinya Apr 15 8:15 2011
history -
menampilkan perintah-perintah yang sudah digunakan.
sintaks :
$ history
bc - kalkulator.
sintaks :
bc [ -hlwsqv ] [long-options] [ file ... ]
contoh :
$ bc