Minggu, 08 April 2012

Perintah Dasar Linux

Perintah Dasar Linux

Berikut adalah beberapa perintah dasar Linux yang biasa dipakai dalam operasional sistem operasi Linux secara umum.
1. Untuk membuat user baru (masuk ke root dahulu)
$ su -l
# adduser namauser
2. Untuk membuat password/mengubah password
# passwd namauser

3. Untuk membuat direktori
$ mkdir namadirektori
4. Melihat isi direktori
$ ls -l
5. Untuk berpindah direktori
$ cd namadirektori
6. Untuk melihat direktori yang sedang aktif
$ pwd
7. Untuk melihat isi sebuah file teks
$ cat namafile
8. Untuk membuat file teks baru
$ cat > namafile
9. Untuk menambahkan File
$ catV>>Vnamafile
10. Untuk mengkopi File ke File lainnya
$ cp namafilesumber namafilekopian
$ cat namafilesumber > namafilekopian
11. Membuat sebuah file kosong
$ touch nama_file
12. Untuk menghapus file
$ rm namafile
13. Untuk menghapus direktory kosong
$ rmdir namafile
14. Untuk menghapus direktory yang sudah ada isinya
$ rm -r namafile (sewaktu menghapus ada konfirmasi bahwa file  
yakin akan dihapus).
$ rm -r -f namafile (sewaktu menghapus tidak ada konfirmasi bahwa 
file akan dihapus).
15. Untuk mengubah ijin akses
Sebelumnya rw-rw-r—diubah menjadi r-xr—w-
$ chmod 542 namafile
atau
$ chmod u-w+x,g-w,o+w-r namafile
atau
$ chmod u=rx,g=r,o=w namafile
Yang kurang nambahin sendiri ya,..
Running kernel and system information
# uname -a                           # Get the kernel version 
(and BSD version)
# lsb_release -a                     # Full release info of any 
LSB distribution
# cat /etc/SuSE-release              # Get SuSE version
# cat /etc/debian_version            # Get Debian version
Use /etc/DISTR-release with DISTR= lsb (Ubuntu), redhat, gentoo, mandrake, sun
 (Solaris), and so on. See also /etc/issue.
# uptime                             # Show how long the system 
has been running + load
# hostname                           # system's host name
# hostname -i                        # Display the IP address of 
the host. (Linux only)
# man hier                           # Description of the file 
system hierarchy
# last reboot                        # Show system reboot history
Kernel detected hardware
# dmesg                              # Detected hardware and boot 
messages
# lsdev                              # information about installed 
hardware
# dd if=/dev/mem bs=1k skip=768 count=256 2>/dev/null | strings -n 
# Read BIOS
# cat /proc/cpuinfo                  # CPU model
# cat /proc/meminfo                  # Hardware memory
# grep MemTotal /proc/meminfo        # Display the physical memory
# watch -n1 'cat /proc/interrupts'   # Watch changeable interrupts 
continuously
# free -m                            # Used and free memory (
-m for MB)
# cat /proc/devices                  # Configured devices
# lspci -tv                          # Show PCI devices
# lsusb -tv                          # Show USB devices
# lshal                              # Show a list of all devices 
with their properties
# dmidecode                          # Show DMI/SMBIOS: hw info 
from the BIOS
Users
# id                                 # Show the active user id 
with login and group
# last                               # Show last logins on the 
system
# who                                # Show who is logged on the 
system
# groupadd admin                     # Add group "admin" and user 
colin (Linux/Solaris)
# useradd -c "Colin Barschel" -g admin -m colin
# usermod -a -G <group> <user>       # Add existing user to group 
(Debian)
# groupmod -A <user> <group>         # Add existing user to group 
(SuSE)
# userdel colin                      # Delete user colin (Linux/
Solaris)
# adduser joe                        # FreeBSD add user joe 
(interactive)
# rmuser joe                         # FreeBSD delete user joe 
(interactive)
# pw groupadd admin                  # Use pw on FreeBSD
# pw groupmod admin -m newmember     # Add a new member to a 
group
# pw useradd colin -c "Colin Barschel" -g admin -m -s /bin
/tcsh
# pw userdel colin; pw groupdel admin

Tidak ada komentar:

Posting Komentar