Subscribe to Wordpress Themes Demo
Command Dasar untuk Linux

Sedikit pengetahuan dasar tentang perintah pada consol atau terminal di Linux, Mudah2an pada artikel ini memberikan sedikit manfaat dan wawasan baik untuk Rakha sendiri mupun untuk kita semua, amiin....
ya udah kita mulai aja ya..

Perintah # ls
Ingat perintah DIR di DOS?? Perintah ini sama dengan DIR, gunanya untuk menampilkan 'list' file di dalam directory. Perintah "ls" juga dilengkapi dengan flag tambahan yang bisa di lihat dengan mengetik :
#ls --help [menampilkan bantuan]
#man ls [man bisa juga diartikan manual, jadi manual ls]

Beberapa perintah ls yang umum adalah :
#ls -l [menampilkan informasi tambahan (l = long) ]
#ls -a [menampilkan hidden file (a = attribute) ]
#ls -la [andapun bisa menjawabnya sendiri bukan..??] :D

Perintah #Cat
cat atau concatenate dipakai untuk menampilkan dan menulis/membuat file, kira-kira sama dengan perintah TYPE di DOS.
Untuk menampilkan isi file ketik : "cat " Untuk membuat file ketik : "cat > " ketik isi file dan utk menyimpan, tekan CTRL+C atau CTRL+D kalau namafile sudah ada file tersebut akan ditimpa, jika kita ingin data ditambahkan kefile yang sudah ada ganti > dengan >>------> more
Menampilkan isi dari file, perlayar, tekan q untuk quit
#more jilid1.txt

Perintah #grep
Menampilkan semua baris yang mengandung pola yang diinginkan
#grep document jilid1.txt
akan menampilkan semua baris teks yang mengandung kecoak di file jilid1.txt

Perintah #man
UNIX help/manual, ketik : man untuk eksekusi.
#man pwd

Perintah #echo
echo dipakai utk menampilkan apa yang kita ketik di layar, seperti :
echo "saya belajar linux"
saya belajar linux

atau untuk membuat file, seperti :
#echo "biff n" > .profile

yang akan membuat file .profile di directory aktif yg berisi teks "biff n" atau menambah file isi file dgn mengganti > dengan >> = cp

copy, dipakai untuk mengcopy file.
#cp jilid1.txt jilid1.txt.backup
#cp jilid1.txt ~server/backup/jilid1.txt.backup

Perintah #mv
move, mengganti nama file atau directory
#mv jilid1.txt jilid1a.txt
#mv backup bak

Perintah #rm
remove, hapus file
#rm jilid1.txt ; hapus file jilid1.txt
#rm * ; hapus semua file di directory aktif (hati-hati!)

Perintah #cd
change directory, dipakai untuk pindah directory, sama dengan perintah CD di DOS
#cd /root
perhatikan bahwa di Linux yang digunakan adalah / (slash) bukan (backslash)

Perintah #mkdir
make directory, membuat directory/folder
#mkdir backup

Perintah #rmdir
remove directory, hapus directory, file-file dalam directory harus dihapus dulu sebelum menghapus directory.
#rmdir backup

Perintah #who
who digunakan untuk menampilkan user yang login ke system, hasilnya kira-kira sebagai berikut :
#who
root tty1 Dec 20 17:47
server tty2 Dec 20 17:48
server tty3 Dec 20 17:48
server ttyp0 Dec 20 18:43 (localhost)

pada baris pertama menunjukkan nama user yang login,
pada baris kedua menunjukkan terminal line yang digunakan,
pada baris ketiga menunjukkan waktu login
pada baris keempat menunjukkan domain atau IP asal mereka koneksi, jika kosong berarti mereka main langsung dari console.

Perintah #whoami
Bila anda lupa login sebagai siapa perintahnya : Siapakah Aku?
# whoami

Perintah #pwd
Tampilkan directory aktif, pwd = print working directory, perintah yang dipakai kalo saat jalan2, sudah gak tau mo pulang lewat mana
#pwd
/home/client

Perintah #ps
Menampilkan proses yang aktif
#ps
PID TTY STAT TIME COMMAND
87 2 S 0:00 -bash
88 3 S 0:00 -bash
1440 2 S 0:00 pico jilid2.txt
1443 3 R 0:00 ps

Perintah #ping
Mengecek host apakah 'up' utk istilah teknisnya silakan 'man ping'
#ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.2 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.1 ms

--- localhost ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.1/0.2 ms
serverservices:~$ ping 127.0.0.1
PING 127.0.0.1 (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.2 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.1 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.1 ms

--- 127.0.0.1 ping statistics ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.1/0.1/0.2 ms
serverservices:~$
Perhatikan bahwa localhost dan 127.0.0.1 adalah sama
127.0.0.1 adalah local loopback yang disediakan untuk testing.

Perintah #finger
Mencari informasi user
#finger
Login Name Tty Idle Login Time Office Office Phone
clientbug clientBug 2 Dec 22 01:10
clientbug clientBug 3 Dec 22 01:10
root 1 1:37 Dec 22 01:10

Perintah #telnet
Melakukan komunikasi dengan host lain melalui telnet protocol
#telnet localhost
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Welcome to Linux 2.0.34.
serverservices login: server
Password: r4h45a
Linux 2.0.34.
Last login: Tue Dec 22 01:13:52 on tty4.
No mail.

#telnet localhost 25
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 serverservices.com ESMTP Sendmail 8.9.0/8.9.0; Tue, 22 Dec 1998
03:52:51 +0800
helo darling
250 serverservices.com Hello client@localhost [127.0.0.1], pleased to
meet you
mail from: guest©serverservices.com
250 guest©serverservices.com... Sender ok
rcpt to: untukmu©seorang.jauh.disana
250 untukmu©seorang.jauh.disana... Recipient ok (will queue)
data
354 Enter mail, end with "." on a line by itself
Kukirim lagu dan salam rinduku
.
250 EAA01615 Message accepted for delivery
quit

Perintah #ftp
Menggunakan file transfer program
#ftp localhost
Connected to localhost.
220 serverservices.com FTP server (Version wu-2.4.2-academ[BETA-15](1) Wed
May 20 13:45:04 CDT 1998) ready.
Name (localhost:client): ftp
331 Guest login ok, send your complete e-mail address as password.
Password: server©k-elektronik.org
230-Welcome, archive user!
230 Guest login ok, access restrictions apply.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp>ftp juga bisa dilakukan dengan melakukan telnet ke port 21
#telnet localhost 21
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 serverservices.com FTP server (Version wu-2.4.2-academ[BETA-15](1) Wed
May 20 13:45:04 CDT 1998) ready.

Perintah #talk
Berbicara dengan user lain, misalnya client request talk ke root sbb:
#talk root atau
#talk root©server.com



[Waiting for your party to respond]
[Ringing your party again]
Di terminal root akan muncul pesan :

Message from Talk_Daemon@server at 10:00 ...
talk: connection requested by server@localhost.
talk: respond with: talk client@localhost

root harus mengetik talk server@localhost jika ingin menjawab request
talk client@localhost
[Connection established]
Tekan Ctrl+C untuk terminate connection.

Printah code
mkdir /mnt/Document_Sharing
mkdir /mnt/Download_Sharing
mkdir /mnt/my_music
chmod 777 /mnt/
mcedit /etc/fstab
//1.0.0.10/Document_Sharing /mnt/Document_Sharing smbfs username=server,password=server,uid=1000,gid=1000 0 0
//1.0.0.10/Download_Sharing /mnt/Download_Sharing smbfs username=server,password=server,uid=1000,gid=1000 0 0
//1.0.0.10/my_music /mnt/my_music smbfs username=server,password=server,uid=1000,gid=1000 0 0
echo "mount -a" /etc/rc.d/rc.local
mount -a
echo "client0....... ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
chmod 7755 /sbin/shutdown
chmod 7755 /sbin/reboot

Tidak ada komentar:

Posting Komentar