Basic Unix Command

January 6th, 2009

Command2 penting

  • whereis : buat cari lokasi program
  • which : mirip2 sama whereis
  • locate : buat cari file
  • man : buat cari tau command itu gunanya buat apa
  • top : buat liast process list yang lagi jalan
  • kill : matiin paksa process
  • df : disk free
  • du : disk usage
  • ps auxww : buat liat process list
  • tail namafile 10 : buat liat 10 baris terakhir dari log file
  • setup : buat setup gampang tentang IP, service, SELinux, Firewall
  • ln -s : Buat symbolic link
  • Buat cari kata pada semua file di directory tertentu : grep -Rn directory


  • Extract tar.gz: tar zxvf
  • Extract tar.bz2: tar jxvf
  • Extract .zip: unzip
  • Compress tar.gz: tar zcvf


Adalah package managernya buat centOS. Bisa dipake buat install dan remove aplikasi

  • Install : yum install
  • Remove : yum remove
  • Buat cari fastest mirror : yum -y install yum-fastestmirror
  • Update semua paket yang udah di install : yum -y update


yum install httpd-devel
yum install mysql-server
yum install php php-mbstring php-mysql php-curl php-xml php-pear [dan laen2]


Semua yang masuk ke dalam direktori ini bakal di jalanin pas apache di start. Jangan lupa set extensionnya dengan .conf .


Initial Setting

  1. Inget supaya ganti magic_gpc supaya jadi on. Defaultnya di centOS itu adalah Off
  2. Check session.save_path (harusnya kalo di centOS udah di set dengan bener sih)

Daemon Control

/sbin/service httpd start   #Buat nyalain apache
/sbin/service httpd stop    #Stop apache
/sbin/service httpd restart #Restart confignya

IP Tables

# Simpen dulu data configurasi nya
/etc/init.d/iptables save
# Buka configurasi nya
vi /etc/sysconfig/iptables
# Abis itu edit2 filenya di dalem situ, kalo bingung copy aja baris yang udah ada
# terus di ganti port nya aja
# Restart IPTables nya
/etc/init.d/iptables restart

User management

#Tambah user
#Ganti password
#Hapus user
userdel -r 
#Buat masukin user ke dalam group
usermod -G  
vi /etc/pam.d/su
#hapus comment di depan #auth       required     /lib/security/$ISA/ use_uid
echo "SU_WHEEL_ONLY yes" >> /etc/login.defs

Tambahan dari website

ac		Print statistics about users' connect time.
accton		Turn on accounting of processes. To turn it on type "accton /var/log/pacct".
adduser		Ex: adduser mark - Effect: Adds a user to the system named mark
chage		Used to change the time the user's password will expire.
chfn		Change the user full name field finger information
chgrp		Changes the group ownership of files.
chown		Change the owner of file(s ) to another user.
chpasswd		Update password file in batch.
chroot		Run command or interactive shell with special root directory.
chsh		Change the login shell.
edquota		Used to edit user or group quotas. This program uses the vi editor to edit the quota.user and files. If the environment variable EDITOR is set to emacs, the emacs editor will be used. Type "export EDITOR=emacs" to set that variable.
faillog		Examine faillog and set login failure limits.
finger		See what users are running on a system.
gpasswd		Administer the /etc/group file.
groupadd		Create a new group.
grpck		Verify the integrity of group files.
grpconv		Creates /etc/gshadow from the file /etc/group which converts to shadow passwords.
grpunconv		Uses the files /etc/passwd and /etc/shadow to create /etc/passwd, then deletes /etc/shadow which converts from shadow passwords.
groupdel		Delete a group.
groupmod		Modify a group.
groups		Print the groups a user is in
id		Print real and effective user id and group ids.
last		Display the last users logged on and how long.
lastb		Shows failed login attempts. This command requires the file /var/log/btmp to exist in order to work. Type "touch /var/log/btmp" to begin logging to this file.
lastcomm		Display information about previous commands in reverse order. Works only if process accounting is on.
lastlog		Formats and prints the contents of the last login.
logname		Print user's login name.
newgrp		Lets a suer log in to a new group.
newusers		Update and create newusers in batch.
passwd		Set a user's pass word.
pwck		Verify integrity of password files.
pwconv		Convert to and from shadow passwords and groups.
quota		Display users' limits and current disk usage.
quotaoff		Turns system quotas off.
quotaon		Turns system quotas on.
quotacheck		Used to check a filesystem for usage, and update the quota.user file.
repquota		Lists a summary of quota information on filesystems.
sa		Generates a summary of information about users' processes that are stored in the /var/log/pacct file.
smbclient		Works similar to an ftp client enabling the user to transfer files to and from a windows based computer.
smbmount		Allows a shared directory on a windows machine to be mounted on the Linux machine.
smbpasswd		Program to change users passwords for samba.
su		Ex: su mark - Effect: changes the user to mark, If not root will need marks password.
sulogin		Single user login.
ulimit		A bash builtin command for setting the processes a user can run.
useradd		Create a new user or update default new user information.
userdel		Delete a user account and related files.
usermod		Modify a user account.
users		Print the user names of users currently logged in.
utmpdump		Used for debugging.
vigr		Edit the password or group files.
vipw		Edit the password or group files.
w		Display users logged in and what they are doing.
wall		Send a message to everybody's terminal.
who		Display the users logged in.
whoami		Print effective user id.

Ubuntu timezone set

dpkg-reconfigure tzdata
  1. No comments yet.
  1. No trackbacks yet.

Switch to our mobile site