Basic Linux command sa Linux at Windows Operating System

This writing is useful for those that wish to get started with Linux commands. Here you will find the most common commands that are used in Linux.

If you would like to run Linux commands on Windows then install Cygwin. Cygwin is a Linux layer on top of Windows that allows you to use Linux commands in Windows.

Kung i-install Cygwin sa Windows at pagkatapos ay ang default na landas kapag binuksan mo ang terminal ng Cygwin ay:

C:\cygwin64\home\{username}

 

Gumawa ng bagong halimbawa notepad file

touch textfile.txt

 

Baguhin ang direktoryo

cd {directory path\name}

 

List directory content in long format ( -l ) including hidden files and directories ( -a )

ls -l -a

ls -al

 

Order files and directories by the time they were last modified

ls -t

 

List directory with pause and scrolling

ls -l | less

 

Ipakita ang kasalukuyang lokasyon (print working directory)

pwd

 

I-extract ang huling 100 salita ng isang file

tail -100 {filename.extension}

 

I-extract ang unang 100 hilera ng isang file

head -100 {filename.extension}

 

Kopyahin ang isang file

cp {source} {destination}

 

Ilipat ang isang file

mv {source} {destination}

 

Gumawa ng isang bagong directory

mkdir {new directory name}

 

Tanggalin ang file

rm {filename}

 

Delete an empty directory

rmdir {directory to remove}
rm -d{directory to remove}

 

Delete directory and its contents

rm -r {directory to remove}
rm -R{directory to remove}

 

Pagsunud-sunurin ang mga nilalaman ng isang file

sort {filename to sort}

 

Alisin ang mga duplicate na mga entry sa isang file

uniq {filename to remove duplicates}

 

I-compress ng mga file

gzip {filename}

 

I-compress ang direktoryo

gzip -r {directory name}

 

Bilangin ang bilang ng mga hilera at mga salita sa isang text file

wc {filename}

 

Search text within files for matching string pattern (case sensitive)

grep 'word' {filename}

 

Search text within files for matching string pattern (case insensitive)

grep -i 'word' {filename}

 

Search with a directory

grep -R Arctic /home/ccuser/workspace/geography

 

Ipakita ang nilalaman ng isang text file

cat

 

sed stream editor (similar to find and replace)

sed 's/snow/rain/' forests.txt

 

Palitan ang file at direktoryo ng mga pahintulot

chmod {options} {permissions} {filename}

 

Listahan ng mga kamakailang mga command na ginagamit

history

 

Awtomatikong iskedyul ng mga gawain

cron
crontab

 

Pahintulot Baguhin file

chmod {permission number} {some file or directory}
chmod 777 /storage

 

Palitan recursive pahintulot ng file

chmod -R {permission number} {some file or directory}

 

 

Mag-iwan ng Tugon