Skip to main content

Lebih Mudah Dengan Shell Script

Ada banyak kepentingan dalam bekerja dengan komputer. Yang pasti, bagi sebagian besar orang termasuk saya, sulit untuk bekerja di depan komputer tanpa di iringi oleh musik. Lalu apa masalahnya?

Masalahnya adalah, seringkali kita dalam posisi bekerja dengan aplikasi yang berat semisal GIMP dan Inkscape, sementara aplikasi pemutar musik kita juga lumayan berat, katakanlah Amarok. Menghemat memory sangat penting di sini. Alternatifnya, kita bisa menggunakan aplikasi pemutar musik command-line seperti mpg321 atau Moc. Sangat hemat sekali memory. Dari hasil cek saya lihat di 'gnome-system-monitor', saya dapati aplikasi mpg321 hanya 'memakan' memory sekitar 600-an kilobyte saja! Sangat hemat sekali!


Permasalahan utamanya, dalam banyak konteks dan keperluan, bekerja dengan modus teks terasa tidak praktis, termasuk menggunakan mpg321. Katakanlah kita ingin memainkan musik di direktori :

mpg321 /home/anu/Music/bla/bla/anu/entah\ berantah/dll/ dan/lain\ lain/*.mp3 *.MP3


Repot kan? Lalu bagaimana? Gampang! Buat saja shell script! Struktur shell script mirip dengan struktur html. Misal, sebagai contoh, saya punya koleksi musik di direktori “/home/alwan/Music/Gary\ Moore/Ballad\ And\ Blues\ 1982/-\ 1994/”, shell script untuk menjalankan mpg321 adalah sebagai berikut :

!/bin/sh
mpg321 /home/alwan/Music/Gary\ Moore/Ballad\ And\ Blues\ 1982/-\ 1994/*.MP3

(lebih nyaman bagi saya menggunakan Gedit daripada Vi untuk menulis script)


Simpan dengan nama terserah kita, misal saja “gary_moore”. Terakhir, kita hanya perlu membuatnya executable dengan men-chmod ke u+x.


$ chmod u+x gary_moore (tanpa autentifikasi root)


Jadilah sekarang kita punya shell script memainkan musik menggunakan mpg321. Untuk menjalankannya kita tinggal men-double klik, lalu pilih “Run in Terminal” atau “Run”, dan aplikasi mp321 memainkan koleksi musik kita dengan cara yang sangat simpel dan praktis!


Shell script bisa juga di gunakan untuk perintah lain yang kita butuhkan, dengan memanfaatkan utilitas dasar di sistem linux, atau aplikasi yang ada di sistem kita. Sebagai contoh, saya membuat Shell script untuk membuka dan menutup DVD-ROM. Dengan memanfaatkan utiliti dasar eject, skrip-nya sangat simpel sekali.

Skrip 'buka_dvd'
!/bin/sh
eject

Skrip 'tutup_dvd'
!/bin/sh
eject -t


Menarik bukan? Selamat ber-Linux! ^_^



Comments

Sumodirjo said…
ajarin skripting dong mas :) BTW, gak pake bash?
Alwan Rosyidi said…
mas sumodirjo ada2 saja... semestina saya yang di ajari owgh... ^_^
milano94 said…
mp3blaster.. maknyooosss :)

Popular posts from this blog

Ubuntu Kylin 19.04 Review : A Gorgeous Windows 10 Clone

It's been quite a while since the last post I wrote in this blog. My daily life prevents me to write another stuff about Linux Desktop, and now I'm curious to take a look to the Ubuntu Kylin 19.04. Ubuntu is always be my favorite distro. It supports huge number of hardwares, it has probably the largest Linux software repository. It is also --the most important thing-- very easy to install, even for beginners.  But for some couple of years, because of technical reason, I stopped to play around with the Ubuntu releases. I stood for KDE Neon and became my primary OS because of its simplicity and the look. Few days ago Ubuntu has released its newer version, Ubuntu 19.04 codenamed Disco Dingo. I'm yes impressed by the progress Ubuntu developer has made, especially the way they arrange the GNOME desktop to match the Ubuntu theme. But the most interesting flavor of this release is Ubuntu Kylin. It's an official Ubuntu flavor, designed for Chinese People with its own...

How To Speed Up Your KDE Plasma Desktop (KDE4)

KDE is one of the oldest desktop environment in Linux. While GNOME (the other desktop that as old as KDE) is trying to built its own style of user interface, KDE from the beginning seems to mimics the Microsoft Windows' "classic" user interface. Thus, KDE has its own user base, especially for them who still in love with the Windows' philosophy : a simple desktop, with a single taskbar in the bottom, and a start menu in the left. Personally, I love KDE. It's gorgeous and eyecandy. But sometimes, I feel KDE is little bit slow in my older hardwares. So, after some experiences, I've found some tweak how to make KDE Plasma Desktop Runs Faster . 1. Change The Compositing Engine  Go to System Settings>Desktop Effect>Advanced , and change the Compositing type from OpenGL 2.0 to XRender. 2. Remove All Bloatware Apps There are some uneeded apps installed in Kubuntu (my favorite KDE distro) and you could safely remove them. Here are my list : ...

BAM Huawei Mobile Partner For Linux. Download and Install.

Click to enlarge Profile management Broadband connection is one of the most used internet connections, alongside wired and wi-fi internet connection. And the most used device to use broadband connection is USB Modem (GSM/CDMA), and one of the most used brands is Huawei, a world-recognized Chinese manufacture that focuses to produce great networking devices (modems, router etc). It is probably the most popular brand from China and I have to say that Huawei is a great product. Because of this I decided to buy a CDMA USB modem from Huawei. And greatly, this has already been recognized by Linux from so long time ago and so I can use the modem easily with GNOME's Network Manager. But later I found a problem : how to top up my prepaid internet account? To top up my prepaid internet account, I have to send a SMS to the provider and I can't do this on Linux. With forced, I temporarily used Mobile Partner application on Windows to buy / top up my prepaid internet account. ...