Jumat, 11 November 2016

Belajar Perintah Dasar Linux | Command Line


Belajar Perintah Dasar Linux - Command Line
Perintah-perintah dalam sistem operasi Linux bersifat case sensitive, perintah tersebut membedakan antara penggunaan huruf besar (capital) dan huruf kecil. Artinya penulisan perintah ‘ls’ dengan ‘LS’ atau ‘Ls’ atau ‘lS’ akan diterjemahkan sebagai perintah yang berbeda.

Dalam sistem operasi under Unix banyak sekali kombinasi perintah yang bisa digabungkan dalam satu perintah artinya dalam satu perintah bisa terdiri dari beberapa perintah dasar. Apabila kita kesulitan atau bingung karena banyak kombinasi perintah, option, atau sintak yang digunakan, kita bisa melihat howto-nya, readme, atau pada manual page-nya. Contoh, bila kita ingin mengetahui sintak-sintak apa saja yang dapat digunakan dalam perintah ‘ls’, cukup kita mengetikkan ‘man ls’ atau ‘ls –help’ maka nanti akan ditampilkan semua informasi tentang perintah ‘ls’ dari option-optionnya, sintak penulisannya. Berikut ini adalah beberapa perintah dalam sistem operasi under Unix khususnya Linuxdan membandingkannya dengan perintah yang ada di DOS (Disk Operating System).


1.             man <command> atau <command> -help
fungsi  : untuk melihat halaman manual dari suatu perintah (help)
man ls : melihat halaman manual dari perintah ls
DOS : <command> /? atau help <command>
dir /?

2.             ls <option>
fungsi : untuk melihat isi suatu direktori, contoh:
ls –l   : untuk melihat file atau direktori pada direktori aktif dengan menyertakan  atributnya
ls –la /etc : untuk melihat file atau direktori pada direktori /etc beserta file    hiddennya
DOS : dir 
dir \windows : untuk melihat file atau direktori pada direktori windows
Ket : pada sistem operasi under Unix menggunakan ‘/’ untuk memisahkan parent direktorydengan child direktory, sedangkan pada DOS menggunakan ‘\’

3.             cd <option> <direktori>
fungsi : untuk berpindah direktori (change directory), contoh:
cd /home/amikom : untuk berpindah ke direktori /home/amikom
cd ..     : untuk berpindah ke parent direktori dari direktori aktif (direktori di atasnya). 
DOS : cd
          Sintak hampir sama
Ket : penggunaan ‘cd’ tanpa nama direktori akan menuju ke home direktori, sedangkan penggunaan ‘cd-‘ akan menuju ke direktori aktif sebelumnya. 

4.             mkdir <nama_direktori>
fungsi : untuk membuat direktori baru
mkdir amikom : untuk membuat direktori baru dengan nama amikom  pada direktori aktif
DOS : md <nama_direktori>
Sintak hampir sama
Ket : penggunaan spasi pada nama direktori akan diasumsikan sebagai beberapa nama direktori baru.

5.             rmdir <nama_direktori>
fungsi : untuk menghapus direktori yang sudah kosong
rmdir amikom : untuk menghapus direktori dengan nama amikom
DOS : rd <nama_direktori>
Sintak hampir sama
Ket : untuk menghapus direktori yang dimaksud harus benar-benar kosong

6.             cp <target> <tujuan>
fungsi : untuk mengkopi file atau direktori
cp so_ti /home : mengkopi file so_ti ke direktori /home
cp coba /home/kopian : apabila dalam direktori home tidak ada direktori kopian, maka file coba akan dikopi di direktori home sekaligus diganti namanya dengan nama kopian
DOS : copy
          Sintak hampir sama

7.             mv <target> <tujuan>
fungsi : untuk memindahkan file atau direktori dan atau merename-nya
mv /home/so /etc : memindahkan file atau direktori so didirektori /home ke dalam direktori /etc dengan nama so
mv amik stmik :   mengubah (merename) file amik menjadi stimik pada direktori aktif
DOS : move
Ket : pada DOS untuk mengganti nama file bisa menggunakan ‘rename’ atau ‘ren’
8.             rm <file>
fungsi : untuk menghapus file
rm dataku : menghapus file dataku pada direktori aktif
DOS : del atau erase
          sintak sama

9.             pwd
fungsi : untuk mengetahui path direktori yang sedang aktif (print working directory)
DOS : - (tidak ada)

10.         cat <nama_file>
fungsi :untuk melihat isi file atau membuat suatu file
cat amikom : melihat isi file amikom
cat>data : membuat file baru dengan nama data (untuk mengakhirinya    menggunakan ^D (Ctrl+D))  *lihat kombinasi perintah
DOS : type atau copy con
          untuk membuat file baru di DOS sama dengan ‘copy con’ sedangakan ‘type’ hanya untuk melihat isi file

11.         find <option>
fungsi : untuk mencari file/direktori
find / -name data.txt –print : mencari file data.txt keseluruh direktori dan menampilkannya pada layer
DOS : -
Ket : untuk mencari file atau direktori pada direktori tertentu missal /home setelah ‘find’ diikuti dengan nama direktorinya misal ‘find /home –name...’
12.         pico <nama_file> atau vi <nama_file>
fungsi : editor file / text editor.
pico amikom.txt : mengedit file amikom.txt
DOS : edit <nama_file>
Ket :apabila nama file yang dimaksud tidak ditemukan maka akan dianggap sebagai file baru (dibuatkan file dengan nama tersebut.

13.         who atau w
fungsi : untuk melihat user yang sedang aktif
DOS : -

14.         ps <option> *lihat manajemen proses
fungsi untuk melihat proses yang sedang aktif / sedang dijalankan oleh system
DOS : -
15.         kill <signal> <PID>
fungsi untuk menghentikan atau mematikan proses yang ada
kill -9 253 : untuk menghentikan proses dengan nomor PID 253
DOS : -
Ket : untuk <signal> bisa menggunakan nomor signalnya bisa juga menggunakan nama signalnya
16.         more <nama_file>
fungsi : untuk melihat isi file dan melihat output di layar, bila dalam satu layar tidak cukup maka akan ditampilkan secara perlayar
dos : more
ket : apabila more dikombinasikan dengan perintah lain menggunakan pipeline maka output perintah pertama akan ditampilkan perlayar apabila outputnya tidak memenuhi layar )* lihat pada kombinasi perintah.

17.         clear
fungsi : untuk membersihkan layar dari tampilan text
DOS : cls

18.         reboot atau CTRL+ALT+DEL
fungsi : untuk membooting ulang computer (restart)
DOS : -

19.         halt atau  shutdown <option> atau init 0
fungsi : untuk mematikan atau men-shutdown computer
DOS : - 
Ket : untuk command prompt pada windows XP bisa menggunakan shutdown

Perintah DOS (Disk Operating System) | Command Line


Perintah DOS Disk Operating System Command Line

  • APPEND : Causes MS-DOS to look in other directories when editing a file or running a command. 
  • ARP : Displays, adds, and removes arp information from network devices
  • ASSIGN : Assign a drive letter to an alternate letter
  • ASSOC : View the file associations
  • AT : Schedule a time to execute commands or programs.
  • ATMADM : Lists connections and addresses seen by Windows ATM call manager.
  • ATTRIB : Display and change file attributes.
  • BATCH : NRecovery console command that executes a series of commands in a file.
  • BOOTCFG : Recovery console command that allows a user to view, modify, and rebuild the boot.ini
  • BREAK : Enable / disable CTRL + C feature.
  • CACLS : View and modify file ACL's.
  • CALL : Calls a batch file from another batch file.
  • CD : Changes directories.
  • CHCP : Supplement the International keyboard and character set information.
  • CHDIR Changes directories.
  • CHKDSK : Check the hard disk drive running FAT for errors.
  • CHKNTFS : Check the hard disk drive running NTFS for errors.
  • CHOICE : Specify a listing of multiple options within a batch file.
  • CLS : Clears the screen.
  • CMD : Opens the command interpreter.
  • COLOR : Easily change the foreground and background color of the
  • MS-DOS window.
  • COMP : Compares files.
  • COMPACT : Compresses and uncompress files.
  • CONTROL : Open control panel icons from the MS-DOS prompt.
  • CONVERT : Convert FAT to NTFS.
  • COPY : Copy one or more files to an alternate location.
  • CTTY : Change the computers input/output devices.
  • DATE : View or change the systems date.
  • DEBUG : Debug utility to create assembly programs to modify hardware settings.
  • DEFRAG : Re-arrange the hard disk drive to help with loading programs.
  • DEL : Deletes one or more files.
  • DELETE : Recovery console command that deletes a file.
  • DELTREE : Deletes one or more files and/or directories.
  • DIR : List the contents of one or more directory.
  • DISABLE : Recovery console command that disables Windows system services or drivers.
  • DISKCOMP : Compare a disk with another disk.
  • DISKCOPY : Copy the contents of one disk
  • DOSKEY : Command to view and execute commands that have been run in the past.
  • DOSSHELL : A GUI to help with early MS-DOS users.
  • DRIVPARM : Enables overwrite of original device drivers.
  • ECHO : Displays messages and enables and disables echo.
  • EDIT : View and edit files.
  • EDLIN : View and edit files.
  • EMM386 : Load extended Memory Manager.
  • ENABLE : Recovery console command to enable a disable service or driver.
  • ENDLOCAL : Stops the localization of the environment changes enabled by the setlocal command.
  • ERASE : Erase files
  • EXPAND : Expand a Microsoft Windows file back to it's original format.
  • EXIT : Exit from the command interpreter.
  • EXTRACT : Extract files from the Microsoft Windows cabinets.
  • FASTHELP : Displays a listing of MS-DOS commands and information about them
  • FC : Compare files.
  • FDISK : Create the partitions on the hard disk drive.
  • FIND : Search for text within a file.
  • FINDSTR : Searches for a string of text within a file.
  • FIXBOOT : Writes a new boot sector.
  • FIXMBR : Writes a new boot record to a disk drive.
  • FOR : Boolean used in batch files.
  • FORMAT : Command to erase and prepare a disk drive.
  • FTP : Command to connect and operate on a FTP server.
  • FTYPE : Displays or modifies file types used in file extensio asociations.
  • GOTO : Moves a batch file to a specific label or location.
  • GRAFTABL : Show extended characters in graphics mode.
  • HELP : Display a listing of commands and brief explanation.
  • IF : Allows for batch files to perform conditional processing.
  • IFSHLP.SYS : 32-bit file manager.
  • IPCONFIG : Network command to view network adapter settings and assigned values.
  • KEYB : Change layout of keyboard.
  • LABEL : Change the label of a disk drive.
  • LH : Load a device driver in to high memory.
  • LISTSVC : Recovery console command that displays the services and drivers.
  • LOADFIX : Load a program above the first 64k.
  • LOADHIGH : Load a device driver in to high memory.
  • LOCK : Lock the hard disk drive.
  • LOGON : Recovery console command to list installations and enable administrator login.
  • MAP : Displays the device name of a drive.
  • MD : Command to create a new directory.
  • MEM : Display memory on system.
  • MKDIR : Command to create a new directory.
  • MODE : Modify the port or display settings.
  • MORE : Display one page at a time.
  • MOVE : Move one or more files from one directory to another DIRECTORY
  • MSAV : Early Microsoft Virus scanner.
  • MSD : Diagnostics utility.
  • MSCDEX : Utility used to load and provide access to the CD-ROM.
  • NBTSTAT : Displays protocol statistics and current TCP/IP connections using NBT
  • NET : Update, fix, or view the network or network settings
  • NETSH : Configure dynamic and static network information from MS-DOS.
  • NETSTAT : Display the TCP/IP network protocol statistics and information.
  • NLSFUNC : Load country specific information.
  • NSLOOKUP : Look up an IP address of a domain or host on a network.
  • PATH : View and modify the computers path location
  • PATHPING : View and locate locations of network latency
  • PAUSE : command used in batch files to stop the processing of a command.
  • PING : Test / send information to another network computer or network device .
  • POPD : Changes to the directory or network path stored by the pushd command.
  • POWER : Conserve power with computer portables.
  • PRINT : Prints data to a printer port.
  • PROMPT : View and change the MS-DOS prompt.
  • PUSHD : Stores a directory or network path in memory so it can be returned to at any time.
  • QBASIC : Open the QBasic.
  • RD : Removes an empty directory.
  • REN : Renames a file or directory.
  • RENAME : Renames a file or directory.
  • RMDIR : Removes an empty directory.
  • ROUTE : View and configure windows network route tables.
  • RUNAS : Enables a user to execute a program on another
  • computer.
  • SCANDISK : Run the scandisk utility.
  • SCANREG : Scan registry and recover registry from errors.
  • SET : Change one variable or string to another.
  • SETLOCAL : Enables local environments to be changed without affecting anything else.
  • SHARE : Installs support for file sharing and locking capabilities.
  • SETVER : Change MS-DOS version to trick older MS-DOS programs.
  • SHIFT : Changes the position of replaceable parameters in a batch program.
  • SHUTDOWN : Shutdown the computer from the MS-DOS prompt.
  • SMARTDRV : Create a disk cache in conventional memory or extended memory.
  • SORT : Sorts the input and displays the output to the screen.
  • START : Start a separate window in Windows from the MS-DOS prompt.
  • SUBST : Substitute a folder on your computer for another drive letter.
  • SWITCHES : Remove add functions from MS-DOS.
  • SYS : Transfer system files to disk drive.
  • TELNET : Telnet to another computer / device from the prompt.
  • TIME : View or modify the system time.
  • TITLE : Change the title of their MS-DOS window.
  • TRACERT : Visually view a network packets route across a network.
  • TREE : View a visual tree of the hard disk drive.
  • TYPE : Display the contents of a file.
  • UNDELETE : Undelete a file that has been deleted.
  • UNFORMAT : Unformat a hard disk drive.
  • UNLOCK : Unlock a disk drive.
  • VER : Display the version information.
  • VERIFY : Enables or disables the feature to determine if files have been written properly.
  • VOL : Displays the volume information about the designated drive.
  • XCOPY : Copy multiple files, directories, and/or drives from one location to another.
  • TRUENAME : When placed before a file, will display the whole directory in which it exists
  • TASKKILL : It allows you to kill those unneeded or locked up applications