In general, Linux commands and UNIX has the following syntax:
command [option ...] [argument ...]
Option is an option that we can use to provide specific results from a command. The argument usually is something that will be processed by the command, for example the name of the file or directory name.
Now we start with the basic commands that are commonly used in Linux:
ls
This command is a command to display the contents of a directory. This command is similar to the dir command in DOS.
There are several ways to use this command, for example:
# Ls
# Ls-l
To learn more about the ls command, please refer to the manual with the command man ls.
more
More commands can be used to browse a text file with a long form. for more exiting by pressing q.
cat
This command is used to display the contents of the file to the screen without a screen display facilities.
Usually used in conjunction with the pipeline or redirection. For example to display the contents of the file / etc / passwd and / etc / group, use the command:
# Cat / etc / passwd / etc / group
CD
This command is similar to the cd command in DOS is used to move to a specific directory. Example command:
# Cd / home / adje
To go back to the directory / home, then use the command:
# Cd ..
cp
This command is used to copy a file or directory. for example:
# Cp example 1
The above command will copy the example 1 point to a file contoh2. To copy the whole directory using the command:
# Cp-R / home / adje / home / Afri
mv
This command is used to transfer a file to another location or under another name. Example:
# Mv contoh1.php contoh2.php
# Mv contoh1.php / home/adje/contoh2.php
rm
This command is used to delete the directory or file. This command is similar to the del command in DOS. In using this command to be careful because in Linux there is no undelete or unerase command. Examples of the use rm as follows:
# Rm contoh1.php
To remove a directory use the command:
# Rm / home / adje / temp
mkdir
This command is used to create directories. For example:
# Mkdir examples
Pipeline
On Linux and UNIX, the output of a process program can be provided as input to other processes. For example:
# Ls-l / home / adje | more
grep
The grep command is used to download the filter input and display in the form of lines that match the pattern you want. Example:
# Ps ax | grep wvdial
Redirection
In Linux or UNIX, you can turn swung the standard input, output or standard error to another destination.
For example you can redirect standard output of a program to redirect standard input file or a program from a file. Pembelokkan process is called redirection and in * NIX used the symbol ">" (to bend the standard output to a file) and the symbol "<" (to bend the standard input from file). Example:
To save view the content of all directories / etc to a file, use the command:
# Ls-lr / etc> content-etc
To add the contents of the file contents, etc with other data, use the symbol ">>" (append) the redirection, ie:
# Ls-lr / home / adje>> content-etc
To make the sorting order of data contained in the file contoh.txt can use the command:
# Sort
The commands above are the commands used in Linux or UNIX. If you still find difficulty please consult her first. Since reading the manual it is very important when we often had oprek Linux or UNIX. From the manual we can get a solution to the problem we face
0 comments:
Post a Comment