Thursday, 3 October 2013

Perintah Dasar Linux

File dan Directory

CommandDescription
man [nama perintah]melihat manual perintah
apropos [suatu yang berhubungan dengan perintah]mencari perintah berdasarkan suatu
lsMelihat daftar direktori
mkdir [nama direktori]Membuat direktori
cd [/direktori/lokasi]
Mengubah lokasi direktori
cp [nama file atau direktori] [ke direktori atau nama file]Menyalin file/Direktori
cp -rakan menyalin setiap file dalam direktori yang Anda tentukan.
rm [nama file atau direktori]Menghapus file/Direktori
rm -Rfakan menghapus setiap direktori yang Anda tentukan.
rmdirmenghapus direktori
mv [nama file atau direktori]Ganti Name file/Direktori
locate [nama file atau direktori]Mencari file/Direktori
cat [nama file]melihat isi file
more [nama file]melihat isi file layar per layar
less [nama file]melihat isi file baris per baris
pipeline/vertical barmenggabungkan dua perintah
clearmembersihkan terminal
[nama file]menjalankan file
which [nama file]mencari file
Untuk pengenalan lebih lanjut mengenai baris perintah Linux, silakan baca pengenalan baris perintah https://help.ubuntu.com/community/BasicCommands di wiki Ubuntu. [1]
CommandDescription
# cd /homeenter to directory '/ home'
# cd ..go back one level
# cd ../..go back two levels
# cdgo to home directory
# cd ~user1go to home directory
# cd -go to previous directory
# cp file1 file2copying a file
# cp dir/* .copy all files of a directory within the current work directory
# cp -a /tmp/dir1 .copy a directory within the current work directory
# cp -a dir1 dir2copy a directory
# cp file file1outputs the mime type of the file as text
# iconv -llists known encodings
# iconv -f fromEncoding -t toEncoding inputFile > outputFileconverting the coding of characters from one format to another
# find . -maxdepth 1 -name *.jpg -print -exec convertbatch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick)
# ln -s file1 lnk1create a symbolic link to file or directory
# ln file1 lnk1create a physical link to file or directory
# lsview files of directory
# ls -Fview files of directory
# ls -lshow details of files and directory
# ls -ashow hidden files
# ls *[0-9]*show files and directory containing numbers
# lstreeshow files and directories in a tree starting from root(2)
# mkdir dir1create a directory called 'dir1'
# mkdir dir1 dir2create two directories simultaneously
# mkdir -p /tmp/dir1/dir2create a directory tree
# mv dir1 new_dirrename / move a file or directory
# pwdshow the path of work directory
# rm -f file1delete file called 'file1'
# rm -rf dir1remove a directory called 'dir1' and contents recursively
# rm -rf dir1 dir2remove two directories and their contents recursively
# rmdir dir1delete directory called 'dir1'
# touch -t 0712250000 file1modify timestamp of a file or directory - (YYMMDDhhmm)
# treeshow files and directories in a tree starting from root(1)

Penyuntingan Text

Perintah untuk penyuntingan text pada terminal :
CommandDescription
wc [nama file]menghitung baris, kata, karakter dalam file
sort [nama file]mensortir urutan isi file berdasarkan karakter
grep [text dicari] [nama file]mencari text dalam suatu file
nano [nama file]membuat file txt baru pakai editor nano
pico [nama file]membuat file txt baru pakai editor pico
vi [nama file]membuat file txt baru pakai editor vi
vim [nama file]membuat file txt baru pakai editor vim
mcedit [nama file]membuat file txt baru pakai editor mcedit
cat [nama file] [pipeline] lprprint file

User dan Group

Cara text pada terminal, dalam kondisi administrasi superuser (sudo su), administrasi user :
CommandDescription
useradd [nama user]menambah user
passwd [nama user]mengganti pasword user
chmod 755 [nama file atau dirctory]mengubah mode user file mnjadi 755 (rwx-r-x-r-x)
chgrp [nama grup] [nama file]mengubah grup file
chown [user] [nama file]mengubah user pemilik file

Administrasi Proses

Perintah administrasi pada terminal yaitu:
CommandDescription
alias [nama pengganti]=[nama file]mengubah nama file jadi pengganti
unalias [nama penganti]mengembalikan alias
bg [nama file]memaksa suspend proses file agar berjalan di background
fg [nama file]mengembalikan proses file berjalan di foreground
find [nama file]mencari lokasi file
sudo -slogin sementara sebagai superuser atau root (ubuntu dan debian)
sudo sulogin sementara sebagai superuser atau root (ubuntu dan debian)
sulogin sementara sebagai superuser atau root (semua linux)
startxmenjalankan X-Window bila dalam kondisi single mode
hostnamemenampilkan nama host dari mesin

Manajemen proses

CommandDescription
ps axmelihat seluruh proses yang berjalan, ax = all
kill [signal][pid]perintah menghentikan proses PID (nomor proses)
topmelihat aktifitas proses
dmesgmelihat 10 proses terakhir
tail [namafile]melihat proses tertentu
dfmelihat pembagian partisi harddsik
dumelihat volume disk yang digunakan
freemelihat disk yang kosong
uname -amelihat informasi sistem, arsitektur mesin, kernel sistem operasi digunakan, versi, dan detail lain
ifconfigmelihat semua interface network (antarmuka jaringan)
iwconfigmelihat inteface jaringan nirkabel (wireless LAN)

System information


CommandDescription
# archshow architecture of machine(1)
# cal 2007show the timetable of 2007
# cat /proc/cpuinfoshow information CPU info
# cat /proc/interruptsshow interrupts
# cat /proc/meminfoverify memory use
# cat /proc/swapsshow file(s) swap
# cat /proc/versionshow version of the kernel
# cat /proc/net/devshow network adpters and statistics
# cat /proc/mountsshow mounted file system(s)
# clock -wsave date changes on BIOS
# dateshow system date
# date 041217002007.00set date and time - MonthDayhoursMinutesYear.Seconds
# dmidecode -qshow hardware system components - (SMBIOS / DMI)
# hdparm -i /dev/hdadisplays the characteristics of a hard-disk
# hdparm -tT /dev/sdaperform test reading on a hard-disk
# lspci -tvdisplay PCI devices
# lsusb -tvshow USB devices
# uname -mshow architecture of machine(2)
# uname -rshow used kernel version

Shutdown, Restart and Logout of a system


CommandDescription
# init 0shutdown system(2)
# logoutleaving session
# rebootreboot(2)
# shutdown -h nowshutdown system(1)
# shutdown -h 16:30 &planned shutdown of the system at 16:30
# shutdown -ccancel a planned shutdown of the system
# shutdown -r nowreboot(1)
# telinit 0shutdown system(3)

Bagikan

Jangan lewatkan

Perintah Dasar Linux
4/ 5
Oleh

Subscribe via email

Suka dengan artikel di atas? Tambahkan email Anda untuk berlangganan.