File dan Directory
Untuk pengenalan lebih lanjut mengenai baris perintah Linux, silakan baca pengenalan baris perintah https://help.ubuntu.com/community/BasicCommands di wiki Ubuntu. [1]
Command | Description |
---|---|
# cd /home | enter to directory '/ home' |
# cd .. | go back one level |
# cd ../.. | go back two levels |
# cd | go to home directory |
# cd ~user1 | go to home directory |
# cd - | go to previous directory |
# cp file1 file2 | copying 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 dir2 | copy a directory |
# cp file file1 | outputs the mime type of the file as text |
# iconv -l | lists known encodings |
# iconv -f fromEncoding -t toEncoding inputFile > outputFile | converting the coding of characters from one format to another |
# find . -maxdepth 1 -name *.jpg -print -exec convert | batch resize files in the current directory and send them to a thumbnails directory (requires convert from Imagemagick) |
# ln -s file1 lnk1 | create a symbolic link to file or directory |
# ln file1 lnk1 | create a physical link to file or directory |
# ls | view files of directory |
# ls -F | view files of directory |
# ls -l | show details of files and directory |
# ls -a | show hidden files |
# ls *[0-9]* | show files and directory containing numbers |
# lstree | show files and directories in a tree starting from root(2) |
# mkdir dir1 | create a directory called 'dir1' |
# mkdir dir1 dir2 | create two directories simultaneously |
# mkdir -p /tmp/dir1/dir2 | create a directory tree |
# mv dir1 new_dir | rename / move a file or directory |
# pwd | show the path of work directory |
# rm -f file1 | delete file called 'file1' |
# rm -rf dir1 | remove a directory called 'dir1' and contents recursively |
# rm -rf dir1 dir2 | remove two directories and their contents recursively |
# rmdir dir1 | delete directory called 'dir1' |
# touch -t 0712250000 file1 | modify timestamp of a file or directory - (YYMMDDhhmm) |
# tree | show files and directories in a tree starting from root(1) |
Penyuntingan Text
Perintah untuk penyuntingan text pada terminal :
Command | Description |
---|---|
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] lpr | print file |
User dan Group
Cara text pada terminal, dalam kondisi administrasi superuser (sudo su), administrasi user :
Command | Description |
---|---|
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:
Command | Description |
---|---|
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 -s | login sementara sebagai superuser atau root (ubuntu dan debian) |
sudo su | login sementara sebagai superuser atau root (ubuntu dan debian) |
su | login sementara sebagai superuser atau root (semua linux) |
startx | menjalankan X-Window bila dalam kondisi single mode |
hostname | menampilkan nama host dari mesin |
Manajemen proses
Command | Description |
---|---|
ps ax | melihat seluruh proses yang berjalan, ax = all |
kill [signal][pid] | perintah menghentikan proses PID (nomor proses) |
top | melihat aktifitas proses |
dmesg | melihat 10 proses terakhir |
tail [namafile] | melihat proses tertentu |
df | melihat pembagian partisi harddsik |
du | melihat volume disk yang digunakan |
free | melihat disk yang kosong |
uname -a | melihat informasi sistem, arsitektur mesin, kernel sistem operasi digunakan, versi, dan detail lain |
ifconfig | melihat semua interface network (antarmuka jaringan) |
iwconfig | melihat inteface jaringan nirkabel (wireless LAN) |
System information
Command | Description |
---|---|
# arch | show architecture of machine(1) |
# cal 2007 | show the timetable of 2007 |
# cat /proc/cpuinfo | show information CPU info |
# cat /proc/interrupts | show interrupts |
# cat /proc/meminfo | verify memory use |
# cat /proc/swaps | show file(s) swap |
# cat /proc/version | show version of the kernel |
# cat /proc/net/dev | show network adpters and statistics |
# cat /proc/mounts | show mounted file system(s) |
# clock -w | save date changes on BIOS |
# date | show system date |
# date 041217002007.00 | set date and time - MonthDayhoursMinutesYear.Seconds |
# dmidecode -q | show hardware system components - (SMBIOS / DMI) |
# hdparm -i /dev/hda | displays the characteristics of a hard-disk |
# hdparm -tT /dev/sda | perform test reading on a hard-disk |
# lspci -tv | display PCI devices |
# lsusb -tv | show USB devices |
# uname -m | show architecture of machine(2) |
# uname -r | show used kernel version |
Shutdown, Restart and Logout of a system
Command | Description |
---|---|
# init 0 | shutdown system(2) |
# logout | leaving session |
# reboot | reboot(2) |
# shutdown -h now | shutdown system(1) |
# shutdown -h 16:30 & | planned shutdown of the system at 16:30 |
# shutdown -c | cancel a planned shutdown of the system |
# shutdown -r now | reboot(1) |
# telinit 0 | shutdown system(3) |
Bagikan
Perintah Dasar Linux
4/
5
Oleh
Hanya Catatan Pribadi