common command in linux terminal

View folder’s content: dir

rizky@rizky-laptop:~$ dir
ADTAntriList2.c     cobamatx.c~         konversi.h~
ADTAntriList2.c~    coba.out            konversi.o

Change directory: cd <destination>

If you wanna go to child folder just write cd <folder nama>, and cd .. to go to parent folder

rizky@rizky-laptop:~$ cd demo
rizky@rizky-laptop:~/demo$ cd ..
rizky@rizky-laptop:~$

run something as super user: sudo <sth>

For example, I’ll run gedit editor. After write that code, you’ll be asked your admin password. Don’t worry if you can’t see the character you type. Just type it and enter.

rizky@rizky-laptop:~$ sudo gedit
[sudo] password for rizky: 

rizky@rizky-laptop:~$

Check your IP Address: ifconfig

rizky@rizky-laptop:~$ ifconfig
eth0      Link encap:Ethernet  HWaddr....................
.........................................................
sorry, so so...

View your harddisk and media capacity: df

rizky@rizky-laptop:~$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/sda4              5676640   4270760   1117524  80% /
/dev/sdb3             10227712   4544656   5683056  45% /media/URGENT
/dev/sdb6             52221948  45488564   6733384  88% /media/VI
/dev/sdb1             31344640  22781344   8563296  73% /media/DATA
/dev/sdb2             31726592  26840160   4886432  85% /media/GAMU
/dev/sdb5             30703616  26828096   3875520  88% /media/APP

View “help menu” of command/View command’s arguments:

<command> –help

for example, I want to look at sudo additional arguments, then I’ll type:

rizky@rizky-laptop:~$ sudo --help
sudo:   please use single character options
usage:  sudo -h | -K | -k | -L | -l | -V | -v
usage:  sudo [-bEHPS] [-p prompt] [-u username|#uid] [VAR=value]
             {-i | -s | <command>}
usage:  sudo -e [-S] [-p prompt] [-u username|#uid] file ...

Use tar archiver: tar <options> <file>

First fact: tar compressor is a default installed program there. Second fact: actually you can extract or compress the files on desktop/interface. Third fact: you can see the syntax on tar help: tar –help

Create/compress: -cf for creating file.tar, -czf for creating file.tar.gz

rizky@rizky-laptop:~$ tar -cf test.tar coba.in
rizky@rizky-laptop:~$ tar -czf test.tar.gz coba.in
rizky@rizky-laptop:~$

Extract: -xf for extracting file.tar, -xzf for extracting file.tar.gz

rizky@rizky-laptop:~$ tar -xf test.tar
rizky@rizky-laptop:~$ tar -xzf test.tar.gz
rizky@rizky-laptop:~$

Clear view: clear

Actually this command doesn’t really clear your terminal’s view. It’s just make the terminal go down until the previous line unseen. If you scroll up your terminal you’ll see the previous line after some empty space.

rizky@rizky-laptop:~$ clear

rizky@rizky-laptop:~$

Download and Install: apt-get

apt-get is a simple command line interface for downloading and installing packages. The most frequently used commands are update and install.

rizky@rizky-laptop:~$ sudo apt-get install libapache2-mod-auth-mysql
[sudo] password for rizky: 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
libapache2-mod-auth-mysql is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
rizky@rizky-laptop:~$

========================

Okay, that’s it all. if I found some later, I’ll add it next time ..

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s